1. Field of the Invention
The invention relates to a calculation unit for executing at least one part of a cryptographic protocol including determining the inverse of an integer modulo a large number.
The invention relates more particularly to means for determining this kind of inverse quickly.
2. Description of the Prior Art
Some cryptographic protocols, for example those known as the Digital Signature Algorithm (DSA) and the Elliptic Curve DSA (ECDSA), have to calculate the inverse of a random integer modulo a large number repetitively. For more details on such protocols see IEEE publication P1363/D13 and especially sections 6.2.7 and 7.2.7 thereof. The aforementioned large number is denoted N in the remainder of this description.
Two numbers are the inverse of each other if their product is identically equal to 1 modulo said large number. For example, the numbers 3 and 5 are the inverse of each other modulo 14. This is because 3×5=15≡1 modulo 14.
One prior art method of performing this calculation is based on the following equation:
y=x−1=xφ(N)−1 modulo N
in which φ(N) is the number of integers prime with N and less than N. This is Euler's “totient” function.
If N is prime, the following simplification is valid:
φ(N)=N−1
and consequently:
y=x−1=xN−2
In binary, this calculation requires 3n/2 multiplications of n×n bits where n=log2 N, in other words of the order of 160 multiplications in practice.
The invention proposes a faster calculation method in which two numbers that are the inverse of each other modulo N are generated at the same time, by a specific calculation, for example based on a random number.
To be more precise, the invention provides a calculation unit adapted to execute at least one part of a cryptographic protocol including determining the inverse of an integer modulo a large number, which unit includes:
Two numbers are prime to each other if they have no common divisor.
A preferred embodiment of the calculation unit includes:
In one embodiment, the means for providing the series of binary numbers include means for storing the numbers constituting that series. Those numbers are precalculated during a preparatory phase that does not have to be executed again each time a pair of numbers that are the inverse of each other modulo N is calculated.
Another embodiment of the means for providing the series include means for generating at least some numbers of the series in real time.
If most of the numbers of the set can be calculated using a fast execution function, time is saved compared to the cited first embodiment in which the numbers are read from a memory.
The precalculation means include means for determining a set of numbers that are prime with the large number, the set constituting numbers of the series, and means for determining the inverse of the product of numbers of the set modulo said large number, the inverse constituting a particular number from the series and completing it.
If all the numbers of the series must be stored, the precalculation means are used once and all the results are stored. On the other hand, if some numbers of the set are obtained by a fast calculation, the precalculation means are used to choose the numbers from the set that can be recalculated each time, based on the use of a fast execution function. It is the choice of numbers from the series that enables an adequate fast execution function to be “found”. When that function has been determined and “implemented”, it is generally sufficient to store, on the one hand, a number from the set, constituting a point of departure for calculating the other numbers of the set and, on the other hand, the inverse of the product of the numbers of said set (modulo the large number). All the elements are then available that are needed to obtain the numbers of the series, essentially by calculation.
For example, the calculation unit can include storage means containing, on the one hand, the smallest number of the set and, on the other hand, the inverse of the product of the numbers of the set modulo the large number, and the generator means can include means for applying a fast execution function successively, starting from the smallest number, to obtain a succession of numbers constituting the set, the series being formed by the numbers and the inverse.
In a preferred example, the fast execution function obtains each number by adding 1 to the preceding number. This type of fast execution function can be used in particular if the large number is prime. If it is not, it is often possible to find a range of numbers in which all the consecutive numbers are prime with the large number and less than it.
The invention will be better understood and other advantages of the invention will become more clearly apparent in the light of the following description of various embodiments of a calculation unit according to the invention, which description is given by way of example only and with reference to the accompanying drawings.
The functioning of the calculation unit defined above is justified by the following demonstration:
It is shown that S0 is also prime with N.
It is easy to verify that:
Consequently, if the k+1 numbers Si of this product are divided at random into two groups of numbers and if the respective products Π1 and Π2 of the numbers from the two groups are obtained, then the two numbers x and y that result from the products Π1 and Π2 are the inverse of each other modulo N.
In other words, the basic principle of the invention leads to choosing a number k and a large number N, for example, and then, in a precalculation phase, determining, on the one hand, a set of k numbers S1 . . . Sk all less than N and prime with N and, on the other hand, an additional number S0 that constitutes the inverse of the product of the numbers S1 . . . Sk modulo N. When this precalculation is effected, a series of k+1 binary numbers is available. These numbers can be stored, for example, to be used whenever necessary, during the execution of a cryptographic calculation to determine two numbers x, y that are the inverse of each other modulo N.
The calculation phase proper can proceed in accordance with the
Also, a binary number e of k+1 bits is chosen at random and is thus made up of k+1 bits (e0 . . . ek) each having the value 0 or 1.
If the result of test E4 is positive, the two values x and y represent the required two numbers that are the inverse of each other modulo N.
The precalculation means include a generator Gp for numbers that are prime with said large number N. Those numbers take the form of words on w bits. As the generator Gp generates a succession of numbers prime with N, those numbers S1 . . . Si . . . Sk are stored in a memory M that is part of the calculation means 13.
In parallel with this, the numbers S1-Sk are sent to a circuit Inv which calculates the number S0. The number S0 is the inverse of the product of the numbers S1 to Sk. When this calculation is completed, the value of S0 is stored in the memory M. At this point the precalculation means can be disconnected from the calculation means 13 because the values of the numbers S0-Sk are stored in the memory M. The calculation unit includes a random number generator Ga for generating random numbers on k+1 bits and connected to a register 14 for containing a random number e on k+1 bits. At the beginning of the calculation process, the generator Ga writes the random number into the register 14.
The memory M is connected to a selector SE1 whose output is connected to one input of a multiplier Mu. A selector SE2 has its output connected to the other input of the multiplier Mu. The output of the multiplier is connected to an input of a router AI which has two outputs connected to respective inputs of two registers 16, 18 in which are written two variables x and y which are the results of products of numbers from the series S0-Sk. The two outputs of the registers x and y are looped to the two inputs of the selector SE2. Reading the register 14 bit by bit controls the setting of both the selector SE2 and the router AI.
To be more precise, the bits e0 . . . ei . . . ek of the register 14 are scrutinized on each iteration and if the bit ei concerned is equal to 1, then the selector SE2 connects the output of the register 16 to an input of the multiplier Mu and the router AI connects the output of the multiplier Mu to the input of the register 16. Similarly, if ei is equal to 0, then the selector SE2 connects the output of the register 18 to the input of the multiplier Mu and the router AI connects the output of the multiplier Mu to the input of the register 18.
In parallel with this, on each iteration, the selector SE1 sends the numbers S0-Sk to the other input of the multiplier Mu in succession, one-by-one.
Consequently, on each iteration, the content of a register 16 or 18 (depending on the value of ei) is multiplied by a number Si and the result is written into the same register, overwriting the preceding value. When all the numbers S0-Sk have been processed, the registers 16 and 18 contain two numbers which are the inverse of each other modulo N.
However, in this example the number N is a chosen prime number. Consequently, any series of consecutive numbers Si is a series of numbers that are prime with N. It is therefore possible to define a fast execution function that simply obtains one of the numbers by adding 1 to the number Si previously obtained, as follows:
Si+1=Si+1
In this case, the smallest number S1 of said set is any chosen number.
There is therefore no need for the set of numbers Si determined by the precalculation means 12 to be transferred and stored for use by the calculation means 13. It is simply sufficient to store the smallest number S1 of said set and the number S0 calculated by the circuit Inv.
Given that these two numbers are stored in two registers 20, 21 of the calculation means 13, it is sufficient to add means 22 for applying a fast execution function, here the function Si+1=Si+1, to the calculation means.
Under these conditions, the selector SE1 is connected to the output of the means 22 and to the outputs of the two registers 20 and 21. In other words, in the series of numbers S0 . . . Sk, only the numbers S0 and S1 are read in the registers and all the others, from S2 to Sk, are calculated in real time by the means 22. It appears that obtaining the greater part of the numbers Si by fast calculation of the kind indicated above saves time compared to the preceding embodiment, which entails reading each number in a memory.
Apart from the means connected to the selector SE1, the remainder of the calculation means 13 is identical to the
It should be noted that the
This condition will be met in particular if the smallest prime factor of N (denoted p) is greater than S1+(k−1).
In this case, since p is a prime number, the sequence S1, S1+1, . . . S1+k−1 is formed of k consecutive integers that are prime with p, and therefore prime with N. In this case, the means 20 for applying the fast execution function as already described can be used, i.e. the function:
Si+1=Si+1
If the above condition is not satisfied, in other words if p≦S1+(k−1), S1 is chosen to be prime with p since p is prime and, each time, 1 is added to Si. A test is executed to determine if the number obtained is prime with p and only numbers that are prime with p are retained. In this case there is obtained, instead of a series of consecutive numbers, a number of groups of consecutive numbers, all prime with N. It is then sufficient to modify accordingly the definition of the fast execution function to be able to recalculate in real time the set of numbers S2 to Sk, whenever necessary.
More generally, whenever it is possible to define a fast execution function from a judicious selection of the numbers prime with N delivered by the generator Gp, an embodiment of the kind described with reference to
It should further be noted that it is advantageous to choose the numbers in said series from smaller numbers that are all prime with and less than said large number N. To give an idea of the order of magnitude concerned, said large number N can be a binary number on 163 bits, the number w can be a binary number on 32 bits and k can be equal to 160.
Number | Date | Country | Kind |
---|---|---|---|
00 13373 | Oct 2000 | FR | national |
Number | Name | Date | Kind |
---|---|---|---|
5414772 | Naccache et al. | May 1995 | A |
20010010077 | McGregor et al. | Jul 2001 | A1 |
20020041681 | Hoffstein et al. | Apr 2002 | A1 |
20050175174 | Kahl | Aug 2005 | A1 |
20060126830 | Shimizu | Jun 2006 | A1 |
Number | Date | Country | |
---|---|---|---|
20020061104 A1 | May 2002 | US |