The present invention relates generally to digit recoding and, more specifically, to unsigned digit recoding.
This section is intended to introduce the reader to various aspects of art, which may be related to various aspects of the present invention that are described and/or claimed below. This discussion is believed to be helpful in providing the reader with background information to facilitate a better understanding of the various aspects of the present invention. Accordingly, it should be understood that these statements are to be read in this light, and not as admissions of prior art.
Cryptographic exponentiation algorithms have been shown to be vulnerable to side channel attacks. In “Differential Power Analysis” (in M. J. Wiener, editor, Advances in Cryptology—CRYPTO '99, volume 1666 of Lecture Notes in Computer Science, pages 388-397, Springer Verlag 1999), Paul Kocher, Joshua Jaffe and Benjamin Jun describe an attack using observation of the power consumption, while attacks using observation of electromagnetic emanations have been described by Karine Gandolfi, Christophe Mourtel and Francis Olivier in “Electromagnetic Analysis: Concrete Results (in . K. Koç, D. Naccache and C. Paar, editors, Cryptographic Hardware and Embedded Systems—CHES 2001, volume 2162 of Lecture Notes in Computer Science, pages 251-261, Springer Verlag 2001) and by Jean-Jacques Quisquater and David Samyde in “Electromagnetic Analysis (EMA): Measures and Counter-Measures for Smart Cards” (in I. Attali and T. P. Jensen, editors, Smart Card Programming and Security (E-Smart 2001), volume 2140 of Lecture Notes in Computer Science, pages 200-210, Springer Verlag 2001).
These attacks, called Simple Power Analysis (SPA) and Simple Electromagnetic Analysis (SEMA), can reveal the exponent used in naïvely implemented exponentiation algorithms, as the operations required are dependent on the bitwise representation of the exponent.
Recoding algorithms have been developed in order to decrease the number of operations required to compute an exponentiation. The most commonly known example is Non-Adjacent Form (NAF) recoding described by Ian Blake, Gadiel Seroussi and Nigel Smart in “Elliptic Curves in Cryptography” (volume 265 of London Mathematical Society Lecture Note Series. Cambridge University Press. 1999). NAF recoding recodes the bits of an exponent using the values in {−1, 0, 1}. This reduces the number of multiplications that are required in the subsequent exponentiation algorithm, something that can be generalised to m-ary recoding, as described by Donald E. Knuth in The Art of Computer Programming (volume 2/Seminumerical Algorithms. Addison-Wesley, 2nd edition, 1981). However, these recoding algorithms are designed to increase the efficiency of the exponentiation algorithms and not to increase the resistance to side channel attacks.
Several other recoding algorithms have been proposed:
However, as noted by Yasuyuki Sakai and Kouichi Sakurai in “A New Attack with Side Channel Leakage During Exponent Recoding Computations” (In M. Joye and J.-J. Quisquater, editors, Cryptographic Hardware and Embedded Systems—CHES 2004, volume 3156 of Lecture Notes in Computer Science, pages 298-311, Springer Verlag 2004), to achieve a regular exponentiation algorithm any recoding algorithm that is used must also be regular. In a regular recoding algorithm, there is no test in the main loop during the evaluation of the algorithm.
While it could be argued that the recoding could be performed when the exponent is generated, this is for example not possible if the exponent is combined with a random value, as the recoding has to be performed just prior to the exponentiation. The combination with a random value is made to prevent certain side channel analyses, as described by Jean-Sébastien Coron in “Resistance against Differential Power Analysis for Elliptic Curve Cryptosystems” (In . K. Koç and C. Paar, editors, Cryptographic Hardware and Embedded Systems—CHES '99, volume 1717 of Lecture Notes in Computer Science, pages 292-302, Springer Verlag 1999) and by Paul Kocher in “Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems” (In N. Koblitz, editor, Advances in Cryptology—CRYPTO '96, volume 1109 of Lecture Notes in Computer Science, pages 104-113, Springer Verlag 1996).
Other recoding algorithms have been proposed in order to make the exponentiation regular. Bodo Möller describes in “Securing Elliptic Curve Point Multiplication against Side-Channel Attacks” (In G. Davida and Y. Frankel, editors, Information Security (ISC 2001), volume 2200 of Lecture Notes in Computer Science, pages 324-334, Springer Verlag 2001) a recoding algorithm for m-ary exponentiation. Each digit equal to zero is replaced with −m, and the next most significant digit is incremented by one. This leads to an exponent recoded with digits comprised in the set {1, . . . , m−1}U{-m}. Combined with the m-ary exponentiation algorithm, this implies that x−m should be pre-computed. While this “computation is “easy” on elliptic curves, it is not the case for the multiplicative group of a finite ring.
An unsigned version of Möller's algorithm is described by Camille Vuillaume and Katsuyuki Okeya in “Flexible Exponentiation With Resistance to Side Channel Attacks” (In J. Zhou, M. Yung and F. Bao, editors, Applied Cryptography and Network Security—ACNS 2006, volume 3989 of Lecture Notes in Computer Science, pages 268-283, Springer Verlag 2006). The digits are recoded in the set {1, . . . , m}: each zero digit is replaced with m and the next digit is decremented by one.
A drawback with the signed and the unsigned versions of Möller's algorithm is that they cannot easily be implemented in a regular manner.
It will thus be appreciated that there is a need for a recoding algorithm for regular exponentiation where the exponent is simply recoded in a regular manner. This invention provides several variants for such a solution.
In a first aspect, the invention is directed to a regular method for recoding a first positive integer n being the exponent of a cryptographic exponentiation algorithm. A processor chooses a second integer s smaller than n, defines a third integer n′=n−s, and adds, for a fourth integer m, the m-ary representation of the third integer n′ digit-wise to the m-ary representation of s to yield a recoded representation of n.
In a first preferred embodiment, m=2k.
In a second preferred embodiment,
where l denotes the m-ary length of n. It is advantageous that si=α for some 0<α<m; where, preferably, α=1 or α=m−1.
In a second aspect, the invention is directed to a device for regularly recoding a first positive integer n. The device comprises a processor adapted to: choose a second integer s smaller than n; define a third integer n′=n−s; and add, for a fourth integer m, the m-ary representation of the third integer n′ digit-wise to the m-ary representation of s to yield a recoded representation of n.
In a third aspect, the invention is directed to a computer program product storing instructions that, when executed by a processor, performs the method of the first aspect of the invention.
Preferred features of the present invention will now be described, by way of non-limiting example, with reference to the accompanying drawings, in which:
In the FIGURE, the represented blocks are functional entities, which do not necessarily correspond to physically separate entities. These functional entities may be implemented as hardware, software, or a combination of software and hardware; furthermore, they may be implemented in one or more integrated circuits.
In exponentiation, z=xn is computed for an integer n and an element x in a (multiplicatively written) group. Let
where l is the m-ary length of n, denote the expansion of n in radix m (typically m=2k). Take a positive integer s<n and define n′:=n−s. If
respectively denote the m-expansion of n′ and s, it follows that xn=xn′+s, where
where in turn ki=d′i+si.
If we define the most significant digit of s in radix m to be zero, then the most significant digit of n′ in radix m (i.e. kl-1) will remain greater than, or equal to, zero. If this were not the case, then the recoding would not be unsigned and would thus not be suitable for groups where computing inversions are expensive.
Let α be an integer satisfying 0<α<m.
Choose
This may be seen as setting all digits of s to the same value, i.e. α. Since n′iε{0, . . . , m−1}, it follows that kiε{α, . . . , α+(m−1)}. The following algorithm may then be used for the recoding.
Input: n≧1, m=2k, l (the m-ary length of n).
Output: n=(kl-1, . . . k0)m with kiε{α, . . . , α+(m−1)}, 0≦i≦l−2
Algorithm:
A first preferred choice for α is 1, as it leads to smaller values for recoded digits. A second preferred choice for α is m−1, since this gives s=ml-1 (i.e. a succession of k(l−1) set to 1).
Two examples will now illustrate the first preferred embodiment. For the two examples the parameters take the following values:
k=2
m=4
n=73=(1,0,2,1)4=1·40+2·41+0·42+1·43
l=4
In the first example α=1; in the second example α=m−1=3.
n:=n−s=73−21=52
loop: for i=0 to l−2, i.e. for i=0 to 2
k3:=n=0
k=(k3,k2,k1,k0)=(0,4,2,1)
As expected, the recoded n is equal to the original n.
n:=n−s=73−63=10
loop: for i=0 to l−2, i.e. for i=0 to 2
k3:=n=0
k=(k3,k2,k1,k0)=(0,3,5,5)
As expected, the recoded n is once more equal to the original n.
It should be noted that the algorithm according to the first embodiment is simple to implement, but that it requires knowledge of the m-ary length of n (i.e. of l) ahead of time. As this may be a drawback, a second preferred embodiment overcomes this problem, while it is a little bit more complicated to implement.
If one looks in more detail at the subtraction step, n′:=n−s, one may set up the following equations d′i=(di−si+γi)mod m and
where the “borrow” is initialised to 0, i.e. γ0=0. This is the classical subtraction algorithm learnt at school. Since di,siε{0, . . . , m−1}, this gives ki=d′i+si which is equal to di+γi, if di+γi≧si, and di+γi+m otherwise.
Hence, for any choice of si≠0 when diε{0,1} leads to a non-zero value for ki. As in the first preferred embodiment,
for some 0<α<m. Further, to use only unsigned arithmetic, γ′i=γi+1ε{0,1}:
Input: n≧1, m=2k, 0<α<m
Output: n=(kl-1, . . . k0)m with kiε{α, . . . , α+(m−1)}, 0≦i≦l−2
Algorithm:
As in the first preferred embodiment, preferred choices for α are 1 and m−1.
Two examples will now illustrate the second preferred embodiment. For the two examples the parameters take the following values:
k=2
m=4
n=73=(1,0,2,1)4=1·40+2·41+0·42+1·43
In the first example α=1; in the second example α=m−1=3.
i:=0
γ′=1
n=73≧(m+α)=4+1=5, so the while-loop is executed
n=18≧(m+α)=4+1=5, so the while-loop is executed again
n=4<(m+α)=4+1=5, so the while-loop is NOT executed again k2:=n+γ′1=4+1−1=4
k=(k3,k2,k1,k0)=(0,4,2,1)
As expected, the recoded n is equal to the original n.
i:=0
γ′=1
n=73≧(m+α)=4+3=7, so the while-loop is executed
n=18≧(m+α)=4+1=5, so the while-loop is executed again
n=4<(m+α)=4+1=5, so the while-loop is NOT executed again k2:=n+γ′−1=4+0−1=3
k=(k3,k2,k1,k0)=(0,3,5,5)
As expected, the recoded n is equal to the original n.
It will be appreciated that both embodiments as expected give the same recoded digits for the same input. For example the first example gives (4,2,1) for both embodiments, while the second embodiment gives (3,5,5) for both embodiments.
It will also be appreciated that both embodiments are regular, as there are no tests inside the main loop; in the first embodiment, there is no test inside the for loop, and in the second embodiment, there is no test inside the while loop.
It may thus be appreciated that the present invention enables regular recoding of a positive integer.
Each feature disclosed in the description and (where appropriate) the claims and drawings may be provided independently or in any appropriate combination. Features described as being implemented in hardware may also be implemented in software, and vice versa. Connections may, where applicable, be implemented as wireless connections or wired, not necessarily direct or dedicated, connections.
Reference numerals appearing in the claims are by way of illustration only and shall have no limiting effect on the scope of the claims.
Number | Date | Country | Kind |
---|---|---|---|
08305581.4 | Sep 2008 | EP | regional |
08291125.6 | Nov 2008 | EP | regional |