# Patent

## Title
Arrangement for and method of protecting a data processing device against an attack or analysis

## Abstract

In order to further develop an arrangement for as well as a method of protecting at least one data processing device, in particular at least one embedded system, for example at least one chip card or smart card, against at least one attack, in particular against at least one side-channel attack, for example against at least one current trace analysis, the data processing device, in particular at least one integrated circuit of the data processing device, carrying out calculations, in particular cryptographic operations wherein an attack, for example an E[lectro]M[agnetic] radiation attack, or an analysis, for example a D[ifferential]P[ower]A[nalysis], such attack or such analysis in particular targeted on finding out a private key, is to be securely averted, it is proposed to blind all intermediate results of the calculations by at least one random variable, without inverting any operand of the calculations.

## Background
The present invention relates in general to the technical field of impeding crypto analysis, in particular of protecting at least one data processing device against at least one attack, for example against at least one E[lectro]M[agnetic] radiation attack, or against at least one analysis, for example against at least one D[ifferential]P[ower]A[nalysis].
More specifically, the present invention relates to an arrangement for and a method of protecting at least one data processing device, in particular at least one embedded system, for example at least one chip card or smart card, against at least one attack, in particular against at least one side-channel attack, for example against at least one current trace analysis, the data processing device, in particular at least one integrated circuit of the data processing device, carrying out calculations, in particular cryptographic operations.
Data processing devices, in particular embedded systems, such as chip cards or smart cards, use P[ublic]K[ey]I[nfrastructure] systems for exchanging keys and have to be protected against several forms of attacks targeted on finding out the private key. One such attack is to influence the calculation, in particular the cryptographic operation, by directing

    
    
        one or more light sources on the chip, in particular on the naked (and thus light-sensitive) chip or
        some kind of E[lectro]M[agnetic] radiation source(s) on the chip.
    
    


For calculations based on the R[ivest-]S[hamir-]A[dleman] algorithm and/or on the E[lliptic]C[urve]C[ryptography] algorithm, a lot of multiplications are required. Normally, these calculations are performed without protection against side-channel attacks, as for instance current trace analysis.
This might be vulnerable to a D[ifferential]P[ower]A[nalysis] attack because an attacker might take a lot of current traces each time the same multiplication is performed. After adding these traces, most of the noise is removed. When the attacker does the same but for different inputs, the attacker can compare the current traces and learn the secret key bitwise, i.e. bit for bit.
Prior art document WO 01/97009 A1 discloses a method for cryptographic calculation comprising a modular exponentiation routine. This known method works with two random variables to blind intermediate results; in this context, prior art document WO 01/97009 A1 works also with an addition of a random variable but only the multiplication operation is blinded.
However, before the result is used for the next calculation, this result is first unblinded which makes the result again vulnerable; not only the multiplication is sensitive to D[ifferential]P[ower]A[nalysis] but also the access of the R[andom]A[ccess]M[emory] of the unblinded results.
Prior art article “On Boolean and Arithmetic Masking against Differential Power Analysis” by Jean-Sébastien Coron and Louis Goubin discusses the D[ifferential]P[ower]A[nalysis] attack and suggests in the fourth and fifth paragraph of page 2 to mask all inputs and outputs. The fifth paragraph discusses masking of R[ivest-]S[hamir-]A[dleman] by multiplication, wherein reference is made to Thomas S. Messerges, “Securing the AES Finalists Against Power Analysis Attacks”, FSE 2000, Springer-Verlag.
Prior art thesis “Modeling and applications of current dynamics in a complex processor core” by Radu Muresan mentions on pages 33 to 37 the blinding of the point on the elliptic curve before applying E[lliptic]C[urve]C[ryptography].
Regarding the technical background of the present invention, additional reference can be made to

    prior art article “Energy-Efficient Data Scrambling on Memory-Processor Interfaces” by Luca Benini, Angelo Galati, Alberto Macii, Enrico Macli, and Massimo Poncino;
    prior art article “A Study of Power Analysis and the Advanced Encryption Standard-Recommendations for Designing Power Analysis Resistant Devices” by Tom Lash;
    prior art document EP 1 014 617 A2;
    prior art document EP 1 267 514 A9;
    prior art document GB 2 345 229 A;
    prior art document US 2003/0194086 A1;
    prior art document WO 00/42511 A1;
    prior art document WO 01/08012 A1;
    prior art document WO 01/31436 A1;
    prior art document WO 02/50658 A1;
    prior art document WO 03/101039 A1; and
    prior art thesis “An Investigation of Differential Power Analysis Attacks on FPGA-based Encryption Systems” by Larry T. McDaniel III.


Starting from the disadvantages and shortcomings as described above and taking the prior art as discussed into account, an object of the present invention is to further develop an arrangement as described in the technical field as well as a method of the kind as described in the technical field in order to be capable of securely averting an attack, for example an E[lectro]M[agnetic] radiation attack, or an analysis, for example a D[ifferential]P[ower]A[nalysis], such attack or such analysis in particular targeted on finding out a private key.
The object of the present invention is achieved by an arrangement comprising the features of claim 1 as well as by a method comprising the features of claim 8. Advantageous embodiments and expedient improvements of the present invention are disclosed in the respective dependent claims.
The present invention is principally based on the idea to use an arrangement for as well as a method of blinding intermediate results for providing invulnerability, in particular D[ifferential]P[ower]A[nalysis] invulnerability; in particular, such blinding is employed in multiplications, for example by addition, comprised by the calculations, in particular by the cryptographic operations, by employing at least one random variable, wherein the calculation of the inversion of any operand is not required.
More specifically, a message M can be blinded with a variable V. This variable V can be derived from a randomly chosen variable v. In this way, all intermediate results are also blinded; these intermediate results remain blinded until the end of the calculations, in particular until the end of the cryptographic operations.
According to an expedient embodiment of the present invention, all intermediate results are blinded by a random variable which is kept constant during a complete R[ivest-]S[hamir-]A[dleman] calculation or a complete E[lliptic]C[urve]C[ryptography] calculation but which is changed when a new calculation is started. By this, all current traces are changed, even when all inputs are the same because the random variable is not the same.
In a preferred embodiment of the present invention, the principle of Montgomery reduction is used. The Montgomery reduction is an efficient algorithm for multiplication in modular arithmetic introduced in 1985 by Peter L. Montgomery. More concretely, the Montgomery reduction is a method for computing c=a·b mod(n) where a, b, and n are k-bit binary numbers.
The Montgomery reduction is now applied particularly in cryptography. Let m be a positive integer, and let R and T be integers such that R>m, g[reatest]c[ommon]d[ivisor](m,R)=1, and 0≦T<m·R. To calculate TR−1 mod(m) without using classical method is called the Montgomery reduction of T modulo m with respect to R. With suitable choice of R, the Montgomery reduction can be efficiently computed.
Advantageously, the present invention is not restricted to the Montgomery reduction but the present invention can also be adapted to other reduction principles.
The present invention does not require the ability to calculate the inversion of an operand, which might be favourable for R[ivest-]S[hamir-]A[dleman] applications.
The present invention further relates to a data processing device, in particular to an embedded system, for example to a chip card or to a smart card, comprising at least one integrated circuit carrying out calculations, in particular cryptographic operations, wherein the integrated circuit is protected

    
    
        against at least one attack, in particular against at least one E[lectro]M[agnetic] radiation attack, or
        against at least one crypto-analysis, in particular against at least one D[ifferential]P[ower]A[nalysis]
    
    


by blinding all intermediate results of the calculations by at least one random variable, without inverting any operand of the calculations.
The present invention finally relates to the use of at least one arrangement as described above and/or of the method as described above in at least one data processing device as described above to be protected against D[ifferential]P[ower]A[nalysis].



As already discussed above, there are several options to embody as well as to improve the teaching of the present invention in an advantageous manner. To this aim, reference is made to the claims respectively dependent on claim 1 and on claim 8; further improvements, features and advantages of the present invention are explained below in more detail with reference to a preferred embodiment by way of example and to the accompanying drawings where
FIG. 1 schematically shows an embodiment of a modular multiplication for four words;
FIG. 2 schematically shows an embodiment of normal R[ivest-]S[hamir-] A[dleman] squaring and of the Montgomery reduction for four words;
FIG. 3 schematically shows an embodiment of a multiplier unit as comprised by the arrangement of FIG. 4; and
FIG. 4 schematically shows an embodiment of an arrangement according to the present invention working in compliance with the method of the present invention.



The same reference numerals are used for corresponding parts in FIG. 1 to FIG. 4.
The embodiment of a data processing device, namely an embedded system in the form of a chip card or of a smart card comprising an I[ntegrated]C[ircuit] carrying out cryptographic operations refers to a P[ublic]K[ey]I[nfrastructure] system and works according to the method of the present invention, i. e. is protected by a protection arrangement 100 (cf. FIG. 4) from abuse and/or from manipulation.
The present invention does not require the ability to calculate the inversion of an operand.
The cryptographic calculations of the integrated circuit can be based on the R[ivest-]S[hamir-]A[dleman] algorithm (cf. prior art document U.S. Pat. No. 4,405,829 or prior art article “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems” by Ron Rivest, Adi Shamir, and Len Adleman in Communications of the ACM, 21 (2), pages 120 to 126, February 1978) calculating for encryption C=Me mod(N) wherein

    
    
        M is the message to be encrypted,
        N=p·q,
        e is coprime to (p-1)(q-1),
        d is such that xed mod [(p-1)(q-1)]=1;
    
    


the decryption calculates M=Cd mod(N).
One of the ways to calculate Me (or Cd) is the following:
first step: starting with R=1;
second step: scanning the exponent e from left to right:
third step: always calculating R=R2 mod(N);
fourth step: when the scanned bit of e=1, moreover R=R.M mod(N) is calculated.
Thus, the calculation comprises a number of squarings and multiplications.
It is assumed that the modulus N comprises a number of words m of n bits,

i. e. N=+nm−1Bm−1+nm−2Bm−2 . . . +n1B+n0 with B=2n.

After the modular reduction, the variables comprise also of m words of n bits, although the M[ost]S[ignificant]W[ord] might have a few bits more. Before the modular reduction, the result will have more words, usually one.
As will be shown in more detail below, the present invention initially blinds M with a randomly chosen variable v of one word. This randomly chosen variable v is subtracted from every word of M mod(N). With V=(Bm−1+Bm−2+ . . . +B+1)v, M can be calculated as M=M−V mod(N); in this context, the underlining indicates that the variable is blinded. Then the multiplication and the squarings are modified such that the result R is also blinded in the same way with V; so all intermediate results are also blinded. Then at the very last end, when the exponentiation is ready, the result is unblinded.
In more detail, in the first stage of initial blinding let v be a randomly chosen variable of n bits. An additional condition can be v<nm−1 in order to facilitate the reduction but when nm−1 has a number of leading zeroes, this might jeopardize the blinding because v would always receive at least the same number of leading zeroes.
Then, the randomly chosen variable v is subtracted from every word of M. If the result is negative, N or 2N is added; however, it is expedient to know beforehand whether the result is negative or not.
For this, first Mm−1−v−1+nm−1 is calculated:

    
    
        when the result overflows, M−V is calculated;
        when the result is positive but does not overflow, M−V+N is calculated;
        when the result is negative, M−V+2N is calculated.
    
    


The subtraction of v is done by using its 2's complement,
i. e. −V=−Bm+(B−v−1)Bm−1+ . . . +(B−v−1)B+(B−v−1)+1. So all positive numbers except for Bm are added. The term −Bm is not used but when the addition of (B−v−1)Bm−1+ . . . +(B−v−1)B+(B−v−1)+1 to another variable gives a carry bit, the term −Bm is annihilated.
The mathematical implementation of the above-described calculations is as follows:














c = 1



if Mm−1−v−1+nm−1 ≧ B









for j = 0 to m−1: B·c+Rj = Mj+(B−v−1)+c









else if Mm−1−v−1+nm−1 ≧ 0











for j = 0 to m−1: B·c+Rj = Mj+(B−v−1)+c+nj



else
or for j = 0 to m−1: B·c+Rj = Mj+(B−v−1)+c+2nj









In the fourth step of R[ivest-]S[hamir-]A[dleman] calculation without protection, i. e. of multiplication, the following calculations are performed:

R=X*Y mod(N)

X=xm−1Bm−1+xm−2Bm−2+ . . . +x1B+x0 

Y=ym−1Bm−1+ym−2Bm−2+ . . . +y1B+y0 

B=2n,

wherein m is the number of words, for instance m=16, and n is the number of bits of a word, for instance n=64.
FIG. 1 gives an example of such modular multiplication of X*Y for four words, i. e. for m=4. Each time one word of Y is multiplied by the complete X, and the previous result R is added. Then, the result is reduced, in the example of FIG. 1 by a Montgomery reduction (=reference numeral Mr in FIG. 1). Then, the procedure is repeated with the next word of Y, until all words of Y have been used.
In a substep of the multiplication, X·Yj+R is calculated, and then a Montgomery reduction Mr is performed. This is done as follows:

C=0;

for i=0 to m−1. {(B·C+Ri)=XiYj+Ri+C}

Rm=C. 

In the case of protection, it is assumed that all operands are blinded with V,
i. e. V=(Bm−1+ . . . +B+1)v
Then, X=X−V mod(N), Y=Y−V mod(N), and R=R−V mod(N) are calculated.
First, Yj, is unblinded:
v is added to every word Yj; when it gives a carry, it is added to the next higher word Yj+1:

B·c+Yj=Yj+v+c. 

Now, R′=X·Yj+R+V·Yj−Bm·v=(X−V)Yj+R−V+V·Yj−Bm·v=X·Yj+R−V−Bm·v=R′−V is calculated. The term −Bm·v is to blind the M[ost]S[ignificant]W[ord] (index m) of the product X·Yj. So the new result R′ is also blinded by V. Therefore, V·Yj−Bm·v has to be added to the multiplication X·Yj+R; it can be written v·Yj=BWH+WL.
This results in the following algorithm:

C=0;

B·c+Yj=Yj+v+c; 

B·WH+WL=v·Yj;

for i=0 to m−1: {(B·C+Ri)=XiYj+B·WH+WL+Ri+C}

Rm=C−v. 

For j=0, R=X·Y has to be calculated without the addition of R which performed a part of the blinding; in that case, X·Y0−V is calculated instead:

C=0;

B·c+Y0=Y0+v+c; 

B·WH+WL=v·Y0;

for i=0 to m−1: {(B·C+Ri)=Xi·Y0+B·WH+WL−v+C}

Rm=C−v. 

As to the substep of additional reduction, the Montgomery reduction Mr reduces by one word which might be insufficient. During the multiplication, R′=X·Yj+R+V·Yj−Bm·v is calculated. In this context, it should be noted that for Yj=B−1, it is V·Yj−Bm·v=−v. With 0≦X<Bm, 0≦Yj<B, 0≦R<Bm, 0≦v<B, it follows that −Bm+1<R′<Bm+1. The intermediate result might be negative.
The total result of the multiplication and reduction is R′′=(N·Q+X·Yj+R+V·Yj−Bm·v)/B. When it is assumed that Yj has its maximum value B−1, then (V·Yj−Bm·v)/B=−v/B>−1, so those terms can be ignored.
In that case, it can be proven that when R<N+X, then also R′′<N+X. So R and therefore R′′ is at most one bit larger but it does not accumulate during a number of calculations. Only at the very last end, i. e. when Ym−1 is used, then an additional reduction by subtracting N at most twice might have to be performed.
At the other end, when Q=0 and Yj−1=0, it can be proven that when R>−v·Bm−1, then also R′′>−v·Bm−1; so R′′ might become negative but it will not accumulate during a number of additional reductions; so the result is left negative. Only, at the very last end, i. e. when Ym−1 is used, then an additional reduction by adding N at most twice might have to be performed.
The above-described calculations additionally imply that

    
    
        each time when the next Yj is loaded first v has to be added and then v·Yj=B·WH+WL has to be calculated before, and WH as well as WL have to be stored; this is an additional multiplication by which the calculation time might be enlarged;
        B·WH+WL has to be added during the multiplication implying additional adder inputs to the multiplier 10 (cf. FIGS. 3 and 4); and
        during the last multiplication of the reduction, v has to be subtracted from the upper part of that result requiring also an adaptation of the multiplier 10 (cf. FIGS. 3 and 4).
    
    


In the third step of R[ivest-]S[hamir-]A[dleman] calculations without protection, i. e. of squaring, FIG. 2 depicts the first substep of normal RSA squaring and the Montgomery reduction (=reference numeral Mr in FIG. 2) for four words, i. e. m=4.
It is XHj=B31 1Xm−1+ . . . +Bj+1Xj+1, i.e. all terms of X starting with Xj+1;
RHj=Bm−1Rm−1+ . . . +Bj+1Rj+1i. e. all terms of R starting with Rj+1;
however, RH0=0.
In general, it is calculated Xj2+Rj and 2XHj·Xj+RHj+C; then, a Montgomery reduction (=reference numeral Mr in FIG. 2) is performed.
In the third step of R[ivest-]S[hamir-]A[dleman] calculations without protection, i. e. of squaring, it is assumed that all operands are blinded with V, i. e. V=(Bm−1+ . . . +B+1)v.
After calculating X=X−V mod(N) and R=R−V mod(N), first Xj is unblinded; v is added to every word Xj; when it gives a carry, it is added to the next higher word Xj+1: B·c+Xj=Xj+v+c.
Now, for the squaring, the following is calculated:

B·C+Rj′=Xj·Xj+Rj+v·Xj=(Xj−v)·Xj+Rj+v·Xj=Xj2+Rj.

The addition of the blinded Rj blinds the term Rj′ again.
For the double products,

RHj′=2XHj·Xj+RHj+C+2VHj·Xj−Bm·v=2XHj·Xj+RHj+C−Bm·v, 

wherein VHj=(Bm−1+ . . . +Bj+1)v:
The term RHj blinds all terms with index ranging from j+1 to m−1;
the term −Bm·v blinds the M[ost]S[ignificant]W[ord] of the result (Rm);
all terms R with index ranging from 0 to j−1 are unchanged and therefore blinded.
So, the new result R′ is also blinded by V.
Therefore, v·Xj has to be added to the squaring, and 2VHj·Xj−Bm·v has to be added to the double products.
For j=0, R=X2 has to be calculated without the addition of R which performed a part of the blinding; in that case, X·X0−V is calculated instead.
This gives the following algorithm:












// j = 0


B·c + X0 = X0 + v;


B·WH + WL = v·X0;


B·C + R0 = X0·X0 + B·WH + WL −v


for i = 1 to m−1: {B·C + Ri = 2X0·X0 + B·2WH + 2WL − v + C}


Rm = C − v;


R = Montgomery(R);


// j > 0


for j = 1 to m−1:








{
B·c + Xj = Xj + v + c;



B·WH + WL = v·Xj;



B·C + Rj = Xj·Xj + B·WH + WL + Rj;



for i = j+1 to m−1: {B·C + Ri = 2Xi·Xj + B·2WH + 2WL + Ri + C}



Rm = C − v;



R = Montgomery(R);


}









In the substep of additional reduction, the Montgomery reduction (=reference numeral Mr in FIG. 2) reduces by one word which might be insufficient.
During the multiplication, it is calculated:

R=(Xj·Xj+Rj+v·Xj)Bj+2XHj·Xj+RHj+2VHj·Xj−Bm·v with

R<2XHj−1·Xj+RHj−1+2VHj−1·Xj−Bm·v. 

With Xj<B, XHj−1<Bm−Bj; VHj−1<Bm−Bj; v<B, it follows that R′<3Bm+1. With all variables being zero, except for v, then R′>−Bm+1. The intermediate result might be negative or when positive overflow by two bits.
The total result of the multiplication and reduction is

R′′<(N·Q+2XHj−1·Xj+RHj−1+2VHj−1·Xj−Bmv)/B. 

It can be proven that when R<N+2XHj−1+2VHj−1−Bm,
then also R′′<N+2XHj−1+2VHj−1−Bm<3Bm+N<4Bm.
So R and therefore R′′ is at most two bit larger but it does not accumulate during a number of calculations. So, it can be left for all reductions, except for the last one.
The last reduction, however, ends with only a squaring and no double products. This gives the same result as multiplication (see above substep of additional reduction during multiplication without protection).
The above-described calculations additionally imply that also 2(B·WH+WL) has to be added, beside B·WH+WL, during the multiplication; this implies that the additional adder for B·WH+WL has a multiplexer at the input for shifting the input.
For E[lliptic]C[urve]C[ryptography] (cf. prior art article “A Reconfigurable System on Chip Implementation for Elliptic Curve Cryptography over GF(2n)” by M. Ernst, M. Jung, F. Madlener, et al., pages 381 to 399), an elliptic curve and a point P on that curve are chosen.
At a first instance A, a random number a is chosen; a·P is calculated and sent as public key to a second instance B. At this second instance B, also a random number b is chosen; b·P is calculated and sent as public key to the first instance A. Then the first instance A calculates K=a·(b·P) and the second instance B calculates K′=b·(a·P). Now K=K′ and this is the common secret of the two instances A and B.
The basic operation is the multiplication of a point P by a scalar a. This is a repeated point addition X=aP=P+P+ . . . +P (a times). It is started with point P, and the scalar a is scanned from left to right:

    
    
        starting with R=P;
        scanning the scalar a from left to right:
        always calculating R=2R mod(N) (so-called point doubling);
        when the scanned bit of a=1, moreover R=R+P mod(N) is calculated (so-called point addition).
    
    


The algorithm for the so-called point doubling and the algorithm for the so-called point addition use operations as X·Y mod(N) and X2 mod(N) (like the R[ivest-]S[hamir-]A[dleman] algorithm) but also by operations as R=X+Y mod(N) and R=X−Y mod(N).
The point doubling algorithm and the point addition algorithm require also an inversion operation calculating X−1 with X·X−1 mod(N)=1.
The blinding is not suited for inversion, so the operand has first to be unblinded, then inverted and then blinded again; this is not such a problem because most algorithms work with projective coordinates having only one inversion, and this is postponed to the end. There are other known ways to blind the inversion operation.
The number of words for E[lliptic]C[urve]C[ryptography] is much smaller than the number of words for R[ivest-]S[hamir-]A[dleman]. Therefore, first the complete multiplication with addition/subtraction is performed before the reduction. Like RSA, it is also possible to interleave the multiplication and the reduction.
Here, the Montgomery reduction is used but the blinding can also be designed for other types of reduction.
In the first stage of initial blinding, this initial blinding is performed in the same way as described above for the R[ivest-]S[hamir-]A[dleman] algorithm but now both coordinates of point P have to be blinded. All operations give a result which is blinded in the same way.
In the second stage of multiplication (X·Y mod(N)) and squaring (X2 mod(N)), the blinding of these operations is performed in the same way as described above for the R[ivest-]S[hamir-]A[dleman] algorithm.
In the last step of additional reduction (R=X±Y mod(N)),

    
    
        in case of addition, R=X+Y+V=(X−V)+(Y−V)+V=R−V is calculated, and
        in case of subtraction, R=X−Y−V=(X−V)−(Y−V)−V=R−V is calculated.
    
    


The implementation of the present invention may be at least partly on software basis; in this context, processors being suited for R[ivest-]S[hamir-]A[dleman] programming and/or for E[lliptic]C[urve]C[ryptography] programming can also implement the additional reduction algorithm as described above.
An exemplary hardware implementation of the protecting arrangement 100 according to the present invention is shown in FIGS. 3 and 4; for maximum speed, the multiplier unit 10 as exemplified in FIG. 3 is able to calculate the following formula:

B·c+r=x·y+B·u−k·B·x+z+c for k=−2, . . . ,3;

r is the L[east]S[ignificant]W[ord] and c is the M[ost]S[ignificant]W[ord] of the result for example for n2·g+B·r5−B·k·n2+c2+c or for x·y±B·z+r+c for the multiplication of X·Y±Z.
The multiplier 10

    
    
        (i) calculates the product x·y;
        (ii) adds z to the lower part of this product x·y, if desired;
        (iii) adds the contents of the c-register 14c to the lower part of this product x·y, if desired;
        (iv) adds u to the upper part of this product x·y, if desired;
        (v) adds or subtracts a multiple of x to the upper part of this product x·y, if desired;
        (vi) stores the lower part of the result in the r-register 14r; and
        (vii) stores the upper part of the result in the c-register 14c for use in the next calculation.
    
    


As can further be taken from FIG. 3, the multiplier 10 comprises

    
    
        a full adder 16r for the result r;
        a full adder 16c for the carry when the multiplication is complete; and
        a ranger 18 deciding in which range (with respect to 2p) the result is.
    
    


The building of the multiplier 10 with look-up tables is advantageous, for instance two bit because then the multiples of x (especially 3x) are already available.
Independently thereof or in connection therewith, it is also advantageous to perform the summation with carry-save adders and to use only for the r-register 14r a full-adder 16r. In this case, c then comprises two words, namely the carry and the sum of the carry-save adders. The c-registers 14c are then doubled, and also the input c comprises two words.
The ranger 18 has to decide whether the result B·c+r is smaller than f·2p/Bm−1 where f has the following values: 0, 3⁄4 or 1 (for Re) and −7⁄8, −3⁄4, −1⁄2, 0, 3⁄4, 7⁄8, 1, 3/2, 7/4 and 2. Whether the result B·c+r is positive or negative can be found by looking at the sign bit. For a value of 7⁄8 for instance, then the four bits from position p-2m−1 and below are 0111. If p=Bm, then these four bits are the four M[ost]S[ignificant]B[it]s of c.
The multiplier 10 is connected (=reference numerals 12a, 12b in FIG. 4) to a memory 20 in which all operands are stored. Also the result is stored in this memory 20.
Furthermore, there is a state machine 30

    
    
        controlling the multiplier 10 for performing the required type of calculation,
        choosing the value of ke as well as the value of k,
        reading the input operands from the memory 20, and
        writing of the result to the memory 20.
    
    


LIST OF REFERENCE NUMERALS


    100 arrangement
    10 multiplier unit of arrangement 100
    12a first connection between multiplier unit 10 and memory unit 20, in particular connection from multiplier unit 10 to memory unit 20
    12b second connection between multiplier unit 10 and memory unit 20, in particular connection from memory unit 20 to multiplier unit 10
    14c c-register module of multiplier unit 10
    14r r-register module of multiplier unit 10
    16c first full adder module of multiplier unit 10
    16r second full adder module of multiplier unit 10
    18 ranger module of multiplier unit 10
    20 memory unit of arrangement 100
    30 state machine of arrangement 100
    Mr Montgomery reduction

## Claims

1. A system for data processing, the system being arranged to use operands to carry out a cryptographic operation on an input message (M), the system comprising:
a memory for storing instructions,
the system being configured to perform, by the instructions:
blinding the input message (M) using a first random variable (V) to generate a blinded input message; and
blinding all intermediate results (R) of the cryptographic operation using the first random variable (V) to generate corresponding blinded intermediate results;

wherein none of the operands is inverted during the cryptographic operation;
wherein the blinded input message is calculated as M−V mod(N) and each blinded intermediate result is calculated as R−V mod(N), and the first random variable (V) is calculated as (Bm−1+B−2+ . . . +B+1)v, wherein N is a modulus comprising m words, each of the m words comprises n bits, v is a second random variable that is one word comprising n bits, and B is equal to 2n.

2. The system according to claim 1, wherein the first random variable (V) is kept constant during a complete cryptographic operation, and is changed when a new cryptographic operation is started.

3. The system according to claim 1, wherein the cryptographic operation is based on at least one of Rivest-Shamir-Adleman (RSA) algorithm and Elliptic Curve Cryptography (ECC) algorithm.

4. The system according to claim 1, further comprising using a Montgomery reduction (Mr).

5. The system according to claim 1, comprising:
at least one memory unit for storing the operands and the results of the calculations,
at least one multiplier unit connected to the memory unit,
at least one state machine for controlling the multiplier unit for performing the calculations, for reading the input operands from the memory unit, and/or
for writing the results of the calculations to the memory unit.

6. The system according to claim 5, wherein the multiplier unit comprises at least one c-register module, at least one r-register module, at least one first full adder module connected to the c-register module, at least one second full adder module connected to the r-register module, and at least one ranger module for determining the range of the result.

7. A computer-implemented method of protecting at least one data processing device against at least one attack, the data processing device being arranged to use operands to carry out a cryptographic operation on an input message (M), the method comprising:
blinding the input message (M) using a first random variable (V) to generate a blinded input message; and
blinding all intermediate results (R) of the cryptographic operation using the first random variable (V) to generate corresponding blinded intermediate results;
wherein none of the operands is inverted during the cryptographic operation;
wherein the blinded input message is calculated as M−V mod(N) and each blinded intermediate result is calculated as R−V mod(N), and the first random variable (V) is calculated as (Bm−1+Bm−2+ . . . +B+1)v, wherein N is a modulus comprising m words, each of the m words comprises n bits, v is a second random variable that is one word comprising n bits, and B is equal to 2n.

8. The method according to claim 7, wherein the first random variable (V) is kept constant during a complete cryptographic operation, and is changed when a new cryptographic operation is started.

9. The method according to claim 7, wherein the cryptographic operation is based on at least one of Rivest-Shamir-Adleman (RSA) algorithm and Elliptic Curve Cryptography (FCC) algorithm.

10. The method according to claim 7, further comprising using a Montgomery reduction (Mr).

11. A non-transitory computer readable storage medium storing one or more instructions, when executed by a processor cause the processor to perfume a method of protecting at least one data processing device against at least one attack, the data processing device being arranged to use operands to carry out a cryptographic operation on an input message (M), the method comprising:
blinding the input message (M) using a first random variable (V) to generate a blinded input message; and
blinding all intermediate results (R) of the cryptographic operation using the first random variable (V) to generate corresponding blinded intermediate results;
wherein none of the operands is inverted during the cryptographic operation;
wherein the blinded input message is calculated as M−V mod(N) and each blinded intermediate result is calculated as R−V mod(N), and the first random variable (V) is calculated as (Bm−1+Bm−2+ . . . +B+1)v, wherein N is a modulus comprising m words, each of the m words comprises n bits, v is a second random variable that is one word comprising n bits, and B is equal to 2n.

12. The computer readable storage medium according to claim 11, wherein the first random variable (V) is kept constant during a complete cryptographic operation, and is changed when a new cryptographic operation is started.

13. The computer readable storage medium according to claim 11, wherein the cryptographic operation is based on at least one of Rivest-Shamir-Adleman (RSA) algorithm and Elliptic Curve Cryptography (FCC) algorithm.

14. The computer readable storage medium according to claim 11, wherein the method further comprises using a Montgomery reduction (Mr).