CO6GC: Higher-Order Threshold Implementations

This is a post in COSIC’s Guide to Crypto! In this series, researchers from COSIC will be informally writing about different concepts in cryptography. Our aim is to introduce the reader to these concepts with explanations, illustrations and examples; so let’s get started! This blog post takes a closer look at higher-order threshold implementations, which is a technique from a recent paper by Beyne, Dhooghe, and Zhang.

Side-Channel Protection and Randomness

Let’s say you are designing some new kind off device that will alleviate all humanity’s problems. But for it to do this in a secure way you need to use some cryptographic primitives. And you are in luck, because modern day cryptography has a whole arsenal of those giving you ample protection. You smile knowing how far the field of cryptography has come.

But then it hits you! In order to really secure this device, you need to make sure that even if an attacker gets their hold on it, they still won’t be able to break it. You read up on the devastating threat of Differential Power Analysis (DPA) attacks and come to the conclusion the algorithms on your device need some side-channel protection. The disaster seems almost averted when you find papers on masking. Provable protection independent of the platform, and the costs seem reasonable as well!

You waste no time and start masking your application. You are almost finished, when suddenly, you come to a stop. You realize that in order for this countermeasure to work, you need to generate some randomness. Seems easy enough, cryptographers know how to do this. We simply take a strong symmetric primitive and extend the length of a random chosen seed.

But… if we needed masking to protect the original symmetric primitive, wouldn’t we need randomness to mask the primitive generating the randomness? Hmm, this is a chicken and egg problem… Ah yes! Instead we could use a TRNG. That way the attacker couldn’t use any side-channel attack to discover the seed, because there is no seed. That might actually work! However, your masking countermeasure uses thousands of bits of randomness per cycle. This would be too expensive to generate using TRNGs…

The Wonders of Threshold Implementations

This is where threshold implementations come into play. The technique was created here in COSIC by Svetla Nikova, Christian Rechberger, and Vincent Rijmen.1 As one of its contributions, it states the importance of the masked building blocks (like your linear layers or the masked S-box) to be permutations. That way, the entropy of the masking which is initially injected is kept throughout the computation of the masked cipher. Since that entropy is maintained, you don’t need extra randomness to refresh it every round. When masking a cipher in practice, uniformity makes the difference between using tens of thousands of bits versus using less than a thousand bits of randomness. The latter number is sufficiently low such that it can be efficiently created by a TRNG.

Sugar, spice and everything nice? Not really. Threshold implementations are a good start but the problem is they only secure against first-order side-channel attacks. That means that by collecting power traces, the adversary tries to guess secret information by correlating the means of those traces. When using higher statistical moments, threshold implementations (such as all other first-order masking schemes) break. And while the number of traces needed for a higher-order attack to be statistically relevant is much higher than for a first-order attack, a second-order attack (using the variance of the trace) is practically still usable. Long story short, there is research to be done.

Cryptanalysis in Side-Channel Analysis?

On first sight it might seem weird. What does the field of symmetric key cryptanalysis have to do with side-channel analysis? Shouldn’t we focus on studying the behavior of our hardware to protect against these attacks? Perhaps learn from the field of multiparty computation on how we can better secure our algorithms? Of course, those directions are important. But the surprising result is that it is cryptanalysis which can teach us how to create secure higher-order threshold implementations and how to safely recycle randomness when faced against higher-order attacks.

The previous section already held a bit of a teaser. “First-order” threshold implementations require that each masked function is a permutation. Higher-order threshold implementations require more properties from the implemented Boolean functions. They require that the masked cipher is itself crytographically strong, and more specifically, strong against linear cryptanalysis. In other words, we require that the masked S-box is highly nonlinear and that the masked linear layers properly diffuse the shares.

Alright, you have a choice now and it is your last chance. After this, there is no turning back. You take the blue pill—the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill—you stay in Wonderland, and I show you how deep the rabbit hole goes. Remember: all I’m offering is the truth. Nothing more.

But Why Now?

So let’s drop the story. It’s just you, me, and science. Are you ready?

First of all, we need to specify what our adversary and security models are. For this we use the probing model. In this model, the adversary can read the inputs of a number of Boolean functions in the implementation. The number of probes the adversary can place determines the order of the attack. More info on the probing model is found in the original work.2
This is where the magic happens and the first new step from our work is made. We leave the comfortable world of perfect security and enter the reality that is a bounded query model. This switch is what enables us to use cryptanalysis.

The adversary receives several inputs of Boolean functions per masked cipher call. In order to prove that no secret information is leaked, we show that these values are indistinguishable from uniform random. In other words, that the entropy of the received values is maximal. This is where I yell abdracadabra! Because this entropy can be bounded by the non-trivial coefficients of the Fourier transform of its distribution. In other words, by using linear cryptanalysis we can show our masking method is secure.

That is the main point of the work. Using the known art of finding trails in ciphers, one can show that an adversary does not learn any secret information either when there is a zero-correlation trail between the probed values (perfect security) or the trails between the probed values have sufficiently low maximal absolute correlation (bounded query security).

Working with an Example

It’s time now to forget about side-channel analysis and put on those cryptanalysis goggles. The masking technique is best explained with an example, namely a second-order masking of the LED cipher.3

In traditional side-channel masking, the largest part of text is typically allotted on how to mask the S-box. Instead, here we will focus more on the diffusion in the shared cipher. Our (deus ex machina) designer simply tells us that there exists a masking of the LED S-box which is second-order non-complete and a permutation. On top of that, the designer also verified the masking to be highly nonlinear. We now claim that, even though we do not use any fresh randomness per round, the masked cipher is multivariate second-order secure. That the cipher is univariate secure, meaning that the adversary only received information from one round of the masked cipher, comes from the second-order non-completeness.4 Instead we focus on the case where the adversary receives information from two different rounds. For ease, assume that the adversary can only observe the power consumption of an S-box.
We take a look at the activity pattern from LED activating a single S-box. Remember that its diffusion layers are basically those of the AES.

The gray areas denote the activated cells caused by probe in an S-box of the masked LED. The adversary could potentially break the masking if the second probe would be placed in a state where only one gray cell would be present. We see from the above activity pattern that this would not happen in the first three rounds of the masked LED, meaning that three rounds of the cipher are perfectly secure. However, one can find a trail with non-zero correlation probing two S-boxes which are four rounds apart. The good news is that due to the amazing diffusion LED has to offer, at least 24 S-boxes have been passed on the way. Luckily enough our (deus ex machina) designer was so smart to choose a masking which has very low maximum correlation. Because of this decision, and when viewing the actual numbers, we can show that breaking the masked LED is as difficult as breaking the unmasked LED.

Conclusion

So what does this mean? Using this technique we can finally create higher-order secure threshold implementations. And what’s better is that we can minimize randomness costs even against higher-order attacks. But… we are far from done.
These techniques are very new and there are several ciphers out there which do not seem easy to protect. These are ciphers like PRESENT due to its weakness against linear cryptanalysis and its bit-wise diffusion layer, or like AES which currently has no known uniform sharing of its S-box. The future does seem quite exciting though as these techniques hint at several interesting roads of future work. The need for ideal randomness has been relaxed, so one can question if it is possible to secure PRNG‘s against side-channel attacks without falling into the typical “chicken-and-egg” problems. But this work also seems to hint at the use of cryptanalysis in attacking masked primitives. The question is whether we can match differential power analysis attacks with the use of linear cryptanalytic hulls. Whether this is possible, only time will tell.

Further reading and references

  1. Nikova, S., Rechberger, C., Rijmen, V.: Threshold implementations against side-channel attacks and glitches. In: Ning, P., Qing, S., Li, N. (eds.) ICICS 06.
  2. Ishai, Y., Sahai, A., Wagner, D.: Private circuits: Securing hardware against probing attacks. In: Boneh, D. (ed.) CRYPTO 2003.
  3. Guo, J., Peyrin, T., Poschmann, A., Robshaw, M.J.B.: The LED block cipher. In:Preneel, B., Takagi, T. (eds.) CHES 2011.
  4. Bilgin, B., Gierlichs, B., Nikova, S., Nikov, V., Rijmen, V.: Higher-orderthreshold implementations. In: Sarkar, P., Iwata, T. (eds.) ASIACRYPT 2014