The present invention relates to a method of performing an inversion operation and to apparatus for performing an inversion operation.
Elliptic Curve Cryptography (ECC) involves the use of calculations on an elliptic curve relationship over GF(p) or GF(2n) and requires the multiplication of long integers which are carried out repeatedly during the implementation of, for example, public key algorithms in cryptographic processors.
Typically, the multiplication operations must be carried out many hundreds of times to complete an encryption or decryption operation, and so it is important that the cryptographic devices that perform these operations execute the long multiplications quickly using a high speed multiplier.
ECC calculations require also an inversion calculation, i.e. the calculation of Z−1, such that the product Z.Z−1=1 mod M. Every point addition and point doubling calculation requires such a calculation. The present algorithms are computational intensive.
Another way is working in the so-called Projective Space. This postpones the inversion calculation to the end and has to be done only once, but the trade-off is that the number of multiplications is largely increased.
Increasingly, such cryptographic algorithms are used in electronic devices for example smart cards, and in these applications processing capability and power consumption is severely limited.
One conventional calculation method is the binary GCD system which works with pairs of auxiliary variables. One pair is reduced in size by dividing by 2 when even, or by subtracting when odd.
However, in the GCD system often it is necessary to correct the operation on the other pair by the addition of half of the modulus.
Another conventional calculation method is the Kaliski system which again uses two pairs of auxiliary variables, of which one pair is reduced by dividing by 2 when even, or by subtracting when odd.
However, in this system, any required correction is delayed to the second stage.
It is therefore an object of the present invention to provide a more efficient inversion operation.
It is also an object of the present invention to provide a inversion process with fewer operations.
It is also an object of the present invention to provide an inversion operation which is completed faster than in conventional systems.
According to one aspect, the present invention provides a method of performing an inversion operation in a cryptographic calculation with at least two auxiliary variables, the method comprising shifting a variable, then effecting a reduction by subtracting that variable from a larger variable.
One advantage of the present invention is that most operations are only done on the Most Significant Words of the auxiliary variables. After a number of such computations, a number of multiplications are done on the complete auxiliary variables, which are simpler.
These advantages result in the number of necessary operations being reduced as compared to conventional methods, thereby ensuring that the calculations can be effected more quickly.
Thus a significant benefit provided by the present invention is that the time taken to complete the entire calculating operation is reduced.
Moreover, the degree of security afforded by the method of the present invention is maintained as compared to conventional cryptographic methods.
Preferably, the method comprises four auxiliary variables being U, V, R and S having the invariances:—
|S.V−R.U|=N
S.Y=U mod N
R.Y=V mod N.
Preferably, the method operates with the Most Significant Words of the variables.
Thus an advantage of the present invention is that the calculation operations are effected faster.
According to another aspect, the present invention provides a computer program product directly loadable into the internal memory of a digital computer, comprising software code portions for performing the method of the present invention when said product is run on a computer.
According to another aspect, the present invention provides a computer program directly loadable into the internal memory of a digital computer, comprising software code portions for performing the method of the present invention when said program is run on a computer.
According to another aspect, the present invention provides a carrier, which may comprise electronic signals, for a computer program embodying the present invention.
According to another aspect, the present invention provides electronic distribution of a computer program product, or a computer program, or a carrier of the present invention.
According to another aspect, the present invention provides apparatus for performing an inversion operation in a cryptographic calculation with at least two auxiliary variables, the apparatus comprising means to shift a variable, and means to effect a reduction by subtraction or addition of that variable from a larger variable.
The method and apparatus of the present invention is applicable to calculations over GF(p), GF(2n) and also long-integer division.
In order that the present invention may more readily be understood, a description is now given, by way of example only, reference being made to the accompanying drawings, in which:—
In a variant, the present invention is implemented in software with a microprocessor, ALU to provide add, subtract, shift operations with programming of the controller to provide control logic, and degree detection by shift registers. 2
There is shown in Figure e an inversion operation of the present invention which is described below.
Thus this method of calculation over GF(p) involves the operation
having four auxiliary variables U, V, S and R, with
U and V always being positive.
The degree of an auxiliary variable is the number of relevant bits to represent it. Thus for example, if U=111100
then the degree of U=dU is 6;
and, if V=001110,
then the degree of V=dV is 4.
The operation involves taking:
and, if b<0, then performing the operations (Step S2, S3):—
then U=U−2b.V
and if (U<0)
then (Step S4) U=−U
if (R<0), then R=R+N
if (R>N), then R=R−N.
Thus the following invariants hold after each loop iteration:
In every step, either the degree of U is decreased or the degree of V. Therefore U and V become smaller and smaller, until in the last step U becomes 0 (U=2bV).
Since U=0, the invariance gcd(U,V)=gcd(Y,N) implies V=gcd(Y,N)=1, since Y and N are relative prime.
Then RY=1 mod N or R=Y−1 mod N.
When U=0, −N<R<2N,
giving at most one correction step namely: either adding or subtracting N.
In practice, R appears always to be smaller than N, so that subtraction of N never occurs.
Also, |SV|<2N and |RU|<2N temporary.
Since they are all integers,
For these variables, only one bit more than N requires representing them. For S and R, a sign-bit is needed too.
Registers 10, 11, 12 and 13 hold variables U, V, S, R. The adders 14, 15 perform addition, subtraction, negation and mod 2 additions. V and R can be shifted over b bits. The control logic 16 controls the process. There are two degree detectors 17,18, one for U and one for V. The dSubtractor 19 gives the difference (b).
Initially, Y is loaded into U, N into V, S is set to 1 and R to 0.
Then the process is started.
When b<0, U and V exchange their contents, S and R do the same, and b is negated.
Both adders are set to subtraction and the shifters are set to shift over b bits. Then the subtraction is performed. When U is negative, the adders are set to negate both U and S.
The process is done as long as U·0.
When U=0 and R<0 or R>N, S is loaded with N. Then either R+N or R−N is calculated.
Normally, the operands consist of a number of words. However, in a variant, the calculations can be speeded up by using only the Most Significant Word two of the variables and 4 auxiliary variables with the size of 1 word, while keeping the invariances valid. It saves also chip area and power. The result is used as an estimator for the subsequent calculation on the whole operands.
UH and VH are initially loaded with the Most Significant Word of U and V.
U=uu.U0−uv.V0
V=vu.U0−vv.V0
S=uu.S0−uv.R0
R=vu.S0−vv.R0
uu, uv vu and vv are words of convenient size.
The operation starts with uu=1, vv=−1 and uv=vu=0,
Assume that the equations are still correct after a number of steps. After the next calculation, the equations are still correct. Since they are correct in the beginning, they remain correct.
When calculating U′=U−2bV and S′=S−2bR, then choose:
When it is necessary to calculate U′=U+2bV and S′=S+2bR, then choose:
When required, swap uu and vu, uv and vv.
This swaps U and V as well R and S.
To update the operands, start with loading UH with MSW of U and VH with the MSW of V. Then,
uu=1, vv=−1 and uv=uv=0.
Then a number of calculations are done, the amount depending on the size of the words and how many useful bits are left over.
Since VH is shifted, it is supplemented with zeros instead of the (unknown) right bits so UH and VH become smaller and smaller. The operation is halted when there are almost no bits left. Also the determination of the sign become incorrect.
Then calculate U, V, S and R by means of uu . . . vv and U0 . . . S0.
This gives new reduced values of U and V, which still obey the invariance.
Then set U0 to U, V0 to V and the same for S0 and R0. Again set uu=1, vv=−1 and uv=vu=0.
Then repeat the procedure. Every time U and V become smaller and smaller, until they fit in the UH and VH registers.
Then the calculation is no longer an estimation, but an exact calculation and it ends with the correct result. Finally, only R has to be recalculated to find Y−1
In a variant to the method of FIGS. 1 to 4, the calculation method allows negative values for U and V and removes the correction step when U is negative (see
The degree of positive numbers is the number of bits after removing all leading zeroes and the degree of negative numbers is the number of bits after removing all leading ones.
Again, the auxiliary variables are:
while (U≠0) and
if (b<0) then effect:
if (Sign(U)=Sign(V))
then effect
if (R>N) then, R=R−N.
α is the variable of the polynomials, U, V, S and R;
N is the irreducible polynomial;
the algorithm is simpler since there are no negative values and there is only a mod 2 addition.
Thus with
while (U>0)
if (R>N) R=R⊕DN.
Thus, initially, Y is loaded into U, N into V, S is set to 1 and R to 0.
Then the process is started (Steps S10-S12).
When b<0, U and V exchange their contents, S and R do the same and b is negated.
Both adders are always set to add mod 2. The shifters are set to shift over b bits. Then the addition is performed.
The process is done as long U≠0
When U=0 and R=R>N, S is loaded with N, then R ED N is calculated.
Initially, X is loaded into U, Y into V, S is set to 0 and R to 1.
When U>0, then the UV-adder is set to subtraction and the RS-adder to addition, or the reverse is done, as appropriate. The shifters are set to shift over b bits. Then the addition/subtraction operation is performed.
The process is done for as long U≠0 and b≧0.
When the process is ready and U<0, then b is set to 0. Then one addition/subtraction is performed (U=U+V; S=S−R).
Then U is the remainder R′ and S is the quotient Q, X=Q.Y+R′ with 0≦R′<Y.
Number | Date | Country | Kind |
---|---|---|---|
03145620 | Jun 2003 | GB | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/IB04/01981 | 6/10/2004 | WO | 12/22/2005 |