Procédé cryptoqrαphiquβ comprenant une exponentiation modulaire sécurisée contre les attaques à canaux cachés, cryptoprocesseur pour la mise en oeuyre du procédé et carte à puce associée Cryptoqrαphiquβ method comprising a secure modular exponentiation against hidden channel attacks, cryptoprocessor for implementing the method and associated smart card
L' invention concerne un procédé cryptographique sécurisé contre les attaques à canaux cachés au cours duquel, pour réaliser une exponentiation modulaire de type C = AB1 mod N, où A est un opérande, Bl un premier exposant, N est un module et C est un résultat, on réalise les étapes suivantes, consistant à :The invention relates to a secure cryptographic method against concealed channel attacks in which, to carry out a modular exponentiation of type C = A B1 mod N, where A is an operand, B1 is a first exponent, N is a module and C is a result, the following steps are carried out, consisting of:
• El : masquer l'opérande A par un nombre s, s est un nombre aléatoire, ou un nombre résultant d'une fonction générant une suite de nombres s déterministe, ou une nombre secret fixe,El: hide the operand A by a number s, s is a random number, or a number resulting from a function generating a sequence of deterministic numbers, or a fixed secret number,
• E2 : réaliser une exponentiation modulaire de l'opérande masqué par l'exposant Bl, puis• E2: to realize a modular exponentiation of the operand masked by the exponent B1, then
• E3 : démasquer le résultat de l'exponentiation, en enlevant au résultat de l'exponentiation une contribution du nombre aléatoire s.• E3: to unmask the result of the exponentiation, removing from the result of the exponentiation a contribution of the random number s.
De tels procédés sont notamment intéressants pour des applications asymétriques de signature et de chiffrement. A est alors selon l'application un message à signer, à vérifier, à chiffrer ou à déchiffrer. Bl est selon l'application une clé publique ou privée. C est un résultat selon l'application un message signé, ou déchiffré .Such methods are particularly interesting for asymmetric applications of signature and encryption. A is then according to the application a message to sign, to verify, to encrypt or to decipher. Bl is according to the application a public or private key. This is a result depending on the application a signed message, or decrypted.
Masquer le nombre A par un nombre s est une contre-mesure connue pour sécuriser les opérations d'exponentiation modulaire, notamment lorsqu'elles sont implémentées dans les microcircuits de type carte à puce, contre des attaques dites par canaux auxiliaires ou à canaux cachés (en anglais Side Chanel Attacks) qui permettent d'obtenir de 1 ' information sur le nombre Bl .
Une première contre-mesure connue du document Dl (Timing Attack on Implementations of Diffie-Hellman, RSA, DSS and Other Systems, Paul Rocher, Crypto 1996, LNCS Springer) consiste à tirer un aléa s, calculer sB2, où B2 est une clé privée ou publique associée à Bl, puis multiplier sB2 par A (sB2.A), élever le résultat de la multiplication à la puissance Bl ((sB2.A)B1) puis réduire modulo N. Bl et B2 étant une clé publique et une clé privée associée, on a Bl. B2 = 1 modulo φ (N), où φ représente la fonction d'Euler, de sorte que le résultat ((sB2.A)B1) modulo N se simplifie pour donner (s.AB1) modulo N. Une division par s permet finalement d'obtenir le résultat recherché C = AB1 mod N. Cette solution est certes efficace, mais sa mise en œuvre est onéreuse. En effet, pour que la mesure soit efficace, il est indispensable que sB2 soit de taille supérieure à la taille de A. Ce qui suppose que s soit de grande taille, plus précisément de taille supérieure à la taille de A divisée par la taille de B2. Si B2 est de petite taille (par exemple de moins de dix-sept bits) , s doit être de grande taille (par exemple de plus du nombre de bits du module divisé par dix-sept) . Produire des nombres aléatoires de grandes tailles nécessite l'utilisation d'un générateur de grande taille, qui d'une part consomme un courant important et d'autre part nécessite un temps relativement important, ce qui n'est pas toujours compatible avec des applications de type carte à puce. De plus le temps pour réaliser la division peut être long.Masking the number A by a number s is a known countermeasure for securing modular exponentiation operations, especially when implemented in smart card microcircuits, against so-called auxiliary channel or hidden channel attacks ( Side Chanel Attacks) which provide information on the number Bl. A first known countermeasure of Dl (Timing Attack on Implementations of Diffie-Hellman, RSA, DSS and Other Systems, Paul Rocher, Crypto 1996, LNCS Springer) is to draw a hazard s, calculate s B2 , where B2 is a private or public key associated with Bl, then multiply s B2 by A (s B2 .A), raise the result of the multiplication to the power Bl ((s B2 .A) B1 ) then reduce modulo N. Bl and B2 being a public key and an associated private key, we have Bl. B2 = 1 modulo φ (N), where φ represents the function of Euler, so that the result ((s B2 .A) B1 ) modulo N is simplified to give (sA B1 ) modulo N. A division by s finally makes it possible to obtain the desired result C = A B1 mod N. This solution is certainly effective, but its implementation is expensive. Indeed, for the measurement to be effective, it is essential that s B2 is larger than the size of A. This assumes that s is large, more precisely larger than the size of A divided by size. B2. If B2 is small (for example less than seventeen bits), s must be large (for example, more than the number of bits in the module divided by seventeen). Producing random numbers of large sizes requires the use of a large generator, which on the one hand consumes a large current and on the other hand requires a relatively large time, which is not always compatible with applications smart card type. Moreover the time to realize the division can be long.
Une deuxième contre-mesure, connue notamment du document D2 (J. S. Coron, P. Paillier « Countermeasure method in an electronic component which uses on RSA-type public key cryptographie algorithm » Patent number FR 2799851.A second countermeasure, known in particular from the document D2 (J. S. Coron, P. Paillier "Countermeasure method in an electronic component which uses RSA-type public key cryptography algorithm" Patent number FR 2799851.
Publication date 2001-04-20. Int Pub Numb . WO0128153), consiste à utiliser deux nombres aléatoires si, s2 pour réaliser l'opération (A+sl.N)B1 mod (s2.N). On enlève ensuite à la fin du calcul la contribution apportée par
si et s2. Comme si, s2 peuvent être de petite taille, leur obtention est plus aisée. Toutefois, cette méthode nécessite de réaliser une opération modulo s2.N. Ceci nécessite l'utilisation d'un multiplieur de plus grande taille et n'est pas toujours compatible avec des applications de type carte à puce.Publication date 2001-04-20. Int Pub Numb. WO0128153), consists in using two random numbers if, s2 to perform the operation (A + sl.N) B1 mod (s2.N). At the end of the calculation, the contribution made by if and s2. As if, s2 can be small, getting them is easier. However, this method requires performing a modulo operation s2.N. This requires the use of a larger multiplier and is not always compatible with smart card type applications.
Un but de 1 ' invention est de proposer une solution pour réaliser une opération modulaire de type AB1 mod N plus intéressante que les solutions connues car peu onéreuse à mettre en œuvre.An object of the invention is to provide a solution for performing a modular operation type A B1 mod N more interesting than the known solutions because inexpensive to implement.
Pour cela, l'invention propose de masquer l'opérande A en multipliant l'opérande A par un paramètre de la forme KS'B2, où K est une constante (éventuellement publique) et B2 est un deuxième exposant tel que Bl. B2 = 1 mod φ(N) .For this, the invention proposes to mask the operand A by multiplying the operand A by a parameter of the form K S ' B2 , where K is a constant (possibly public) and B2 is a second exponent such that B1. = 1 mod φ (N).
Pour les applications cryptographiques envisagées, Bl et B2 sont naturellement des clés privée et publique associées .For the cryptographic applications envisaged, B1 and B2 are naturally associated private and public keys.
Lors de l'étape de démasquage après exponentiation, on enlève la contribution Ks apportée par l'aléa s.During the unmasking step after exponentiation, the contribution K s brought by the hazard s is removed.
Dans l'invention, l'aléa s est d'une part multiplié par B2 et d'autre part il est placé en exposant. Ainsi, le paramètre κs-B2 est suffisamment grand pour masquer l'opérande A, même lorsque s est petit. Avec l'invention, il n'est donc pas nécessaire de disposer d'un générateur aléatoire de grande taille.In the invention, the hazard s is on the one hand multiplied by B2 and on the other hand it is placed in exponent. Thus, the parameter κ s - B2 is large enough to mask the operand A, even when s is small. With the invention, it is therefore not necessary to have a large random generator.
Un autre but de 1 ' invention est de proposer un procédé rapide à mettre en œuvre.Another object of the invention is to provide a rapid process to implement.
Pour cela, dans un mode préféré de mise en œuvre de l'invention, on réalise les étapes de masquage El, d'exponentiation E2 et de démasquage E3 en utilisant un multiplieur de Montgomery, qui a l'avantage de réaliser des multiplications modulaires qui sont particulièrement
rapides à exécuter par rapport à des multiplieurs classiques et très utiles pour les exponentiations.For this, in a preferred embodiment of the invention, the steps of E1 masking, E2 exponentiation and E3 unmasking are carried out using a Montgomery multiplier, which has the advantage of making modular multiplications which are particularly quick to execute compared to conventional multipliers and very useful for exponentiation.
De préférence également, on choisit la constante K égale à 2P, p étant un nombre entier compris entre 0 et n, n étant un majorant de la taille du module N. Par majorant de la taille de N, on entend ici un nombre égal ou légèrement supérieur à la taille de n, et classiquement dépendant du choix d' implémentation de la multiplication de Montgomery et /ou des possibilités matérielles du processeur dans lequel la multiplication est implémentée. Par exemple, si N est un nombre de 520 bits, et si le processeur utilisé travaille avec des mots de 576 bits, on choisira avantageusement n égal à 576 bits. Le choix de la constante K = 2P permet d'utiliser avantageusement les propriétés des multiplieurs de Montgomery pour accélérer les calculs tout en garantissant la sécurité du procédé. Le choix d'un nombre p = n tel que K = 2n est optimal comme on le verra mieux par la suite.Also preferably, the constant K equal to 2 P is chosen, p being an integer between 0 and n, n being an enhancer of the size of the module N. By adding the size of N, we mean here an equal number or slightly larger than the size of n, and conventionally dependent on the choice of implementation of Montgomery multiplication and / or the hardware capabilities of the processor in which the multiplication is implemented. For example, if N is a number of 520 bits, and if the processor used works with words of 576 bits, advantageously n will be chosen equal to 576 bits. The choice of the constant K = 2 P makes it possible to advantageously use the properties of Montgomery multipliers to accelerate the calculations while guaranteeing the safety of the process. The choice of a number p = n such that K = 2 n is optimal, as will be seen later.
L'invention concerne également un cryptoprocesseur comprenant notamment un multiplieur de Montgomery pour la mise en œuvre d'un procédé tel que décrit ci-dessus. L'invention concerne enfin une carte à puce comprenant un cryptoprocesseur tel que décrit ci-dessus.The invention also relates to a cryptoprocessor including in particular a Montgomery multiplier for the implementation of a method as described above. The invention finally relates to a smart card comprising a cryptoprocessor as described above.
L'invention sera mieux comprise, et d'autres caractéristiques et avantages de l'invention ressortiront clairement de la description qui est faite ci-après, à titre indicatif et nullement limitatif, du mode préféré de mise en œuvre de l'invention.
Comme on l'a dit précédemment, l'invention concerne un procédé cryptographique sécurisé au cours duquel, pour réaliser une exponentiation modulaire de type C = AB1 mod N, où A est un opérande, Bl un premier exposant, N est un module et C est un résultat, on réalise les étapes suivantes, consistant à :The invention will be better understood, and other characteristics and advantages of the invention will emerge clearly from the description which is given below, by way of indication and in no way limiting, of the preferred embodiment of the invention. As has been said previously, the invention relates to a secure cryptographic method during which, to carry out a modular exponentiation of type C = A B1 mod N, where A is an operand, B1 a first exponent, N is a module and C is a result, the following steps are carried out, consisting of:
• El : masquer l'opérande A par un nombre aléatoire s,• El: hide operand A by a random number s,
• E2 : réaliser une exponentiation modulaire de l'opérande masqué par l'exposant Bl, puis• E2: to realize a modular exponentiation of the operand masked by the exponent B1, then
• E3 : démasquer le résultat de l'exponentiation, en enlevant au résultat de l'exponentiation une contribution du nombre aléatoire s.• E3: to unmask the result of the exponentiation, removing from the result of the exponentiation a contribution of the random number s.
Selon l'invention, lors de l'étape El de masquage de l'opérande A, on multiplie l'opérande A par un paramètre de la forme KS'B2, où K est une constante et B2 est un deuxième exposant tel que Bl. B2 = 1 mod φ(N) . On obtient ainsi un opérande masqué A' = KS'B2.A. L'exponentiation deAccording to the invention, during the masking step E1 of operand A, operand A is multiplied by a parameter of the form K S ' B2 , where K is a constant and B2 is a second exponent such that B1 is a constant. B2 = 1 mod φ (N). This gives a masked operand A '= K S ' B2 .A. The exponentiation of
A' (étape E2) par Bl donne le résultat masqué C = KS.AB1 mod N. Enfin, lors de l'étape E3, on enlève à C la contribution Ks apportée par l'aléa s pour retrouver le résultat recherché C.A '(step E2) by B1 gives the masked result C = K S .A B1 mod N. Finally, during step E3, the contribution K s brought by the hazard is removed at C to find the desired result vs.
L'invention est mise en œuvre de préférence en utilisant un multiplieur de Montgomery.The invention is preferably implemented using a Montgomery multiplier.
Avant de décrire plus complètement le procédé de l'invention, il convient de rappeler quelques propriétés connues d'un multiplieur de Montgomery, décrites par exemple dans le document D3 (P. L. Montgomery, Modular Multiplication without trial division, Mathematics of computation, 44(170) pp 519-521, april 1985).Before describing more completely the method of the invention, it is necessary to recall some known properties of a Montgomery multiplier, described for example in the document D3 (Montgomery PL, Modular Multiplication without trial division, Mathematics of computation, 44 (170). pp. 519-521, april 1985).
Un multiplieur de Montgomery permet de réaliser des multiplications du type Mgt(A,B,N) = A. B. R"1 mod N. Un avantage de ce multiplieur est sa rapidité de calcul. Un
inconvénient de ce multiplieur est qu'il introduit dans le calcul une constante R, appelée constante de Montgomery. R est une puissance de 2 co-première avec N : R = 2n avec n tel que PGCD(R, N) = 1. La constante de Montgomery est intrinsèque au multiplieur et il est nécessaire de supprimer sa contribution en amont du calcul, au cours du calcul ou à la fin. Ainsi, pour calculer C = A. B mod N, on peut par exemple calculer d'abord A. R puis Mgt(A.R,B,N) = A. B mod N. On peut également réaliser une lere multiplication Co = Mgt(A.R, B. R, N) = A. B. R mod N puis une deuxième multiplication de type C = Mgt(l,C0, N) = A. B mod N.A multiplier of Montgomery makes it possible to carry out multiplications of the type Mgt (A, B, N) = AB R "1 mod N. One advantage of this multiplier is its speed of computation. The disadvantage of this multiplier is that it introduces into the computation a constant R, called the Montgomery constant. R is a power of 2 co-prime with N: R = 2 n with n such that PGCD (R, N) = 1. The Montgomery constant is intrinsic to the multiplier and it is necessary to suppress its contribution upstream of the computation, during the calculation or at the end. Thus, for calculating C = AB mod N, it is for example first calculate A. R then Mgt (CA, B, N) = AB mod N. It can also perform the multiplication ere Co = Mgt (AR, B. R, N) = AB R mod N then a second multiplication of type C = Mgt (l, C 0 , N) = A. B mod N.
Le multiplieur de Montgomery permet également de réaliser des exponentiations modulaires de type C = MgtExp (A, B, N) = AB.R~{B~1] mod N ou C = MgtExp (A. R, B, N) = AB . R mod N (on compense dans ce cas la constante R~B introduite par le calcul en multipliant A par R en amont du calcul) . Concrètement, pour réaliser une exponentiation de Montgomery, on exécute un algorithme comme par exemple celui communément appelé "square and multiply" consistant, dans une boucle indicée par i variant entre q-1 et 0, q étant la taille du nombre B, en une succession de multiplications de type U1 = Mgt (U1-I, U1-I, N) et éventuellement Mgt (U1, A, N) (ou Mgt (U1, A. R, N) ), selon la valeur d'un bit B1 de B associé à l'indice i, U1 étant une variable de boucle initialisée à la valeur Uq = R. Cette exponentiation est expliquée plus en détails dans le document D4 (Handbook of Applied Cryptography par A. Menezes, P. Van Oorschot et S. Vanstone, CRC Press 1996, chapitre 14, algorithme 14.94). Ce calcul d'exponentiation a l'avantage d'être particulièrement rapide .The Montgomery multiplier also makes it possible to realize modular exponentiations of type C = MgtExp (A, B, N) = A B .R ~ {B ~ 1] mod N or C = MgtExp (A. R, B, N) = A B. R mod N (in this case the constant R ~ B introduced by the computation is compensated by multiplying A by R upstream of the computation). Concretely, to realize an exponentiation of Montgomery, one executes an algorithm like for example the one commonly called "square and multiply" consisting, in a loop indexed by i varying between q-1 and 0, q being the size of the number B, in one sequence of multiplications of type U 1 = Mgt (U 1 -I, U 1 -I, N) and optionally Mgt (U 1 , A, N) (or Mgt (U 1 , A. R, N)), according to the value of a bit B 1 of B associated with the index i, U 1 being a loop variable initialized at the value U q = R. This exponentiation is explained in more detail in the document D4 (Handbook of Applied Cryptography by A Menezes, P. Van Oorschot and S. Vanstone, CRC Press 1996, chapter 14, algorithm 14.94). This exponentiation calculation has the advantage of being particularly fast.
Les opérations de Montgomery ont notamment les propriétés suivantes, qui seront utilisées par la suite :
Mgt(A,B,N) = A. B. R"1 mod NMontgomery's operations include the following properties, which will be used later: Mgt (A, B, N) = AB R "1 mod N
Mgt (A. R, B. R, N) = A. B. R mod NMgt (A.R, B.R, N) = A.B.R mod N
Mgt (1,1,N) = Mgt (N-I, N-I, N) = R"1 mod NMgt (1.1, N) = Mgt (NI, N, N) = R "1 mod N
Mgt (A, 1,N) = Mgt (N-A, N-I, N) = A. R"1 mod NMgt (A, 1, N) = Mgt (NA, N, N) = A. R "1 mod N
MgtExp (A. R, B, N) = AB . R mod NMgtExp (A. R, B, N) = A B. R mod N
Dans le mode préféré de mise en œuvre du procédé de l'invention, on utilise les multiplications et les exponentiations de Montgomery pour accélérer le calcul d'exponentiation masqué par l'aléa KS'B2.In the preferred embodiment of the method of the invention, the Montgomery multiplications and exponentiations are used to accelerate the exponentiation calculation masked by the hazard K S ' B2 .
Tout d'abord, lors de l'étape El de masquage de l'opérande A on réalise les sous-étapes suivantes, consistant à :First, during step E1 of masking operand A, the following sub-steps are carried out, consisting of:
• EIl : réaliser une première exponentiation de Montgomery de la constante K par le produit du nombre aléatoire s par le deuxième exposant B2 ; on obtient ainsi le masque κs'B2 mod N puis• EIl: make a first Montgomery exponentiation of the constant K by the product of the random number s by the second exponent B2; we thus obtain the mask κ s ' B2 mod N then
• E12 : réaliser une multiplication de Montgomery du résultat de la première exponentiation de Montgomery (= le masque KS'B ) par l'opérande A pour produire un opérande masqué A' (A' = KS'B2.A mod N) .• E12: make a Montgomery multiplication of the result of the first exponentiation of Montgomery (= mask K S ' B ) by operand A to produce a masked operand A' (A '= K S ' B2 .A mod N) .
Ensuite, lors de l'étape d'exponentiation E2 de l'opérande masqué A', on réalise la sous-étape suivante :Then, during the exponentiation step E2 of the masked operand A ', the following sub-step is carried out:
• E212 : réaliser une deuxième exponentiation de Montgomery de l'opérande masqué A' par le premier exposant Bl pour produire un résultat masqué C• E212: make a second Montgomery exponentiation of the masked operand A 'by the first exponent B1 to produce a masked result C
Enfin, lors de l'étape E3 de démasquage du résultat masqué, on réalise les sous-étapes suivantes :Finally, during step E3 of unmasking the masked result, the following sub-steps are carried out:
• E31 : réaliser une troisième exponentiation de Montgomery pour calculer le paramètre K~s,• E31: make a third exponentiation of Montgomery to compute the parameter K ~ s ,
• E32 : réaliser une multiplication de Montgomery du résultat masqué C par K~s .
Comme on l'a vu précédemment, les multiplications et les exponentiations de Montgomery introduisent dans le résultat une contribution fonction de la constante R de• E32: perform a Montgomery multiplication of the masked result C by K ~ s . As we saw earlier, the multiplications and exponentiations of Montgomery introduce into the result a contribution according to the constant R of
Montgomery. Cette constante peut être éliminée en fin de chaque multiplication, par exemple en réalisant une multiplication de Montgomery par R2 après un calcul.Montgomery. This constant can be eliminated at the end of each multiplication, for example by performing a Montgomery multiplication by R 2 after a calculation.
Lorsque cela est possible, et notamment pour les exponentiations, il est plus facile de compenser la constante R en amont, en multipliant l'opérande par la constante R, plutôt que de compenser une puissance de RWhere possible, and especially for exponentiation, it is easier to compensate for the constant R upstream by multiplying the operand by the constant R rather than to compensate for a power of R
(à fortiori une puissance négative de R) en sortie.(a fortiori a negative power of R) in output.
Egalement, un choix approprié de la constante K permet d'accélérer encore le calcul, et notamment l'étape E31 de calcul de K~s . Plus précisément, choisir une constante K = 2P (p compris entre 0 et n) de la même forme que la constante de Montgomery R = 2n, permet de simplifier les calculs. On a en particulier :Also, an appropriate choice of the constant K makes it possible to accelerate the calculation even more, and in particular the step E31 for calculating K ~ s . More precisely, choosing a constant K = 2 P (p between 0 and n) of the same shape as the Montgomery constant R = 2 n , simplifies the calculations. We have in particular:
Mgt(l,l,N) = Mgt (N-I, N-I, N) = R"1 mod N Mgt (A, 1,N) = Mgt (N-A, N-I , N) = A. R"1 mod N Mgt(2p,l,N) = Mgt (N-2P,N-1,N) = 2p.2"n mod NMgt (l, l, N) = Mgt (N1, N1, N) = R "1 mod N Mgt (A, 1, N) = Mgt (NA, N1, N) = A. R " 1 mod N Mgt ( 2 p, l, N) = Mgt (N-2 P N-1, N) = 2 p .2 "n mod N
= (2""P)"1 mod N= (2 "" P ) "1 mod N
Mgt (2n"p, 1,N) = Mgt (N-2n"p, N-I , N) = 2n"p.2"n mod N = (2p)~λ mod N, avec 2n"p = R/K Le calcul de l'inverse de K puis de K~s est ainsi facilité .Mgt (2 n "p , 1, N) = Mgt (N-2 n" p , N1, N) = 2 n " p2 " n mod N = ( 2p ) ~ λ mod N, with 2 n " p = R / K The calculation of the inverse of K then of K ~ s is thus facilitated.
Après diverses simplifications suite au choix de K = 2P, on obtient finalement un procédé comprenant l'ensemble des étapes suivantes. EO : initialisation :After various simplifications following the choice of K = 2 P , we finally obtain a process comprising all of the following steps. EO: initialization:
EOIl : choisir un entier j et calculer la constante K = R/2:, (comme R = 2n, K = 2P avec p=n-j )EOIl: choosing an integer j, and calculate the constant K = R / 2, (as R = 2 n, K = 2 P p = nj)
E012 : choisir un nombre aléatoire s et le multiplier par B2 pour obtenir si,
E013 : calculer R2,E012: choose a random number s and multiply it by B2 to get if, E013: calculate R 2 ,
El : masquer A en A'El: hide A to A '
EIl : calculer le masque Ksl EIl: calculate the K sl mask
ElIl : calculer Tl = Mgt(K,R2,N) = K*R mod N ; cette étape permet de compenser en amont la contribution de R dans l'exponentiation qui suitElIl: calculate Tl = Mgt (K, R 2 , N) = K * R mod N; this step makes it possible to compensate upstream the contribution of R in the following exponentiation
E112 : calculer Ul = MgtExp (Tl, si, N) = Ksl*R mod N E12 : masquer A en A'E112: calculate Ul = MgtExp (Tl, if, N) = K sl * R mod N E12: hide A to A '
E121 : calculer Ml = Mgt(Ul,A,N) = Ksl.A mod N E2 : calculer C = A'B1 mod NE121: calculate Ml = Mgt (U1, A, N) = K sl .A mod N E2: calculate C = A ' B1 mod N
E211 : calculer M2 = Mgt(Ml,R2,N) = Ksl.A.R mod N cette étape permet de compenser en amont la contribution de R dans l'exponentiation qui suitE211: calculate M2 = Mgt (Ml, R 2 , N) = K sl .AR mod N this step makes it possible to compensate upstream the contribution of R in the following exponentiation
E212 : calculer U2 = MgtExp (Ml, Bl, N) = AB1.KS.R mod NE212: calculate U2 = MgtExp (M1, B1, N) = A B1 .K S .R mod N
E3 : retrouver C à partir de C E31 : calculer K"s E3: find C from C E31: calculate K "s
E311 : calculer II = Mgt(2:,l,N) = K"1 mod N E312 : calculer 12 = Mgt(Il,R2,N) = K"1. R mod N E313 : calculer V = MgtExp (12, s, N) = K"S.R mod NE311: calculating II = Mgt (2:, l, N) = K "1 mod N E312: calculating 12 = Mgt (II, R 2, N) = K" 1. R mod N E313: calculate V = MgtExp (12, s, N) = K "S .R mod N
E32 : calculer C = C'.K"S E32: calculate C = C'.K "S
E321 : calculer U3 = Mgt(U2,V,N) = AB1.R mod N E322 : calculer U4 = Mgt(U3,l,N) = AB1 mod NE321: calculate U3 = Mgt (U2, V, N) = A B1 .R mod N E322: calculate U4 = Mgt (U3, l, N) = A B1 mod N
A noter que, lors de la mise en œuvre du procédé ci- dessus dans un cryptoprocesseur, un même registre ou une même partie de mémoire peut être utilisé pour mémoriser des variables intermédiaires dont le nom comprend la même lettre : Ml, M2 peuvent être stockées successivement dans un registre M, de même les variables II, 12, V peuvent être stockées dans un même registre I, et les variables Ul, U2, U3, U4 peuvent être stockées dans un même registre U.
w_Note that, when implementing the above method in a cryptoprocessor, the same register or the same part of memory can be used to store intermediate variables whose name includes the same letter: Ml, M2 can be stored successively in a register M, likewise the variables II, 12, V can be stored in the same register I, and the variables U1, U2, U3, U4 can be stored in the same register U. w_
Le choix particulier de K = 2n permet encore d'accélérer le calcul car le fait que K = R permet des simplifications supplémentaires.The particular choice of K = 2 n still makes it possible to speed up the calculation because the fact that K = R allows additional simplifications.
Après simplifications, on obtient le procédé ci-dessous : EO : initialisationAfter simplifications, we obtain the following process: EO: initialization
E012 : choisir le nombre aléatoire s et calculer si = S.B2+1,E012: choose the random number s and calculate if = S.B2 + 1,
E013 : calculer R2,E013: calculate R 2 ,
El : masquer A en A' EIl : calculer le masque Rsl El: hide A in A 'EIl: calculate the mask R sl
E112 : calculer Ul = MgtExp (R2, si, N) = Rsl.R mod NE112: calculate Ul = MgtExp (R 2 , if, N) = R sl .R mod N
E12 : masquer A en A'E12: hide A to A '
E E112211 :: ccaa.lculer Ml = Mgt(Ul,A,N) = Rsl.A mod N = RS'B2.A.R mod N E2 : calculer C = A'B1 mod NE E112211 :: ccaa.lculate Ml = Mgt (UI, A, N) = R sl .A mod N = R S ' B2 .AR mod N E2: calculate C = A' B1 mod N
E212 : calculer U2 = MgtExp (Ml, Bl, N) = AB1.RS.R mod NE212: calculate U2 = MgtExp (M1, B1, N) = A B1 .R S .R mod N
E3 : retrouver C à partir de CE3: find C from C
E31 : calculer R-(s+1) E313 : calculer V = MgtExp (1, s+1, N) = R"(s+1).R modE31: calculate R- (s + 1) E313: calculate V = MgtExp (1, s + 1, N) = R "(s + 1) .R mod
N E32 : calculer C = C'.K"(s+1) N E32: calculate C = C'.K "(s + 1)
E321 : calculer U3 = Mgt(U2,V,N) = AB1 mod NE321: calculate U3 = Mgt (U2, V, N) = A B1 mod N
Par rapport au cas général où K = 2P, les simplifications suivantes ont été faites :Compared to the general case where K = 2 P , the following simplifications have been made:
• K étant égal à R, l'étape EOIl devient inutile,K being equal to R, the step EOI1 becomes unnecessary,
• l'étape ElIl devient également inutile puisque R2 a été calculé lors de l'étape E013Step ElIl also becomes unnecessary since R2 has been calculated during step E013
• en calculant si =s.B2+l (au lieu de si = s.B2) lors de l'étape E012, l'étape E211 devient inutileBy calculating if = s.B2 + 1 (instead of si = s.B2) during step E012, step E211 becomes useless
• le calcul de R'1 est immédiat de sorte que les étapes E311 et E312 deviennent inutiles
n_• the calculation of R '1 is immediate so that steps E311 and E312 become unnecessary not_
• en choisissant à l'étape E31 s = s+1 on évite ainsi l'étape E322.• choosing in step E31 s = s + 1 is thus avoided step E322.
Bien sûr, dans le procédé détaillé ci-dessus, certaines étapes peuvent être déplacées ou permutées par rapport aux autres. Par exemple, dans l'étape d'initialisation EO, les sous-étapes peuvent être réalisées dans un ordre différent .Of course, in the method detailed above, some steps can be moved or swapped with respect to others. For example, in the initialization step EO, the substeps can be performed in a different order.
Comme on vient de le voir ci-dessus, l'invention peut être avantageusement mise en œuvre pour la réalisation de l'exponentiation C = AB1 mod N selon les 3 principales étapes suivantes :As we have just seen above, the invention can be advantageously implemented for carrying out the exponentiation C = A B1 mod N according to the following 3 main steps:
• El : A' = A.KS-B2 (masquage de A) • E2 : C = A'B1 mod N (exponentiation)• El: A '= AK S - B2 (masking of A) • E2: C = A' B1 mod N (exponentiation)
• E3 : C = C'*K~S (démasquage)• E3: C = C '* K ~ S (unmasking)
L'invention peut également être avantageusement combinée avec le théorème des restes Chinois pour accélérer le calcul de l'exponentiation, on parle alors communément de RSA-CRT.The invention can also be advantageously combined with the Chinese remainder theorem to accelerate the calculation of the exponentiation, it is commonly referred to as RSA-CRT.
Selon le théorème des restes chinois (ou CRT pour Chinese Remainder Theorem, connue du document D5 (Cryptography Theory and Practice, chapter 4, Douglas R. Stinson, 1995, CRC Press), un calcul d'exponentiation classique C = AB1 mod N peut se décomposer de la manière suivante :According to the Chinese Remainder Theorem (CRT) theorem, known from the Cronography Theory and Practice (D5), chapter 4, Douglas R. Stinson, 1995, CRC Press, a classical exponentiation calculation C = A B1 mod N can be broken down as follows:
• Cp = (A mod p) Bpl mod p• Cp = (A mod p) Bpl mod p
• Cq = (A mod q) Bql mod q• Cq = (A mod q) Bql mod q
• C = Cq + q* (Iq* (Cp-Cq) mod p) mod N où • p et q sont deux entiers premiers tels que p*q = N,• C = Cq + q * (Iq * (Cp-Cq) mod p) mod N where • p and q are two prime integers such that p * q = N,
• BpI = Bl mod (p-1)• BpI = Bl mod (p-1)
• BqI = Bl mod (q-1)• BqI = Bl mod (q-1)
• Iq = q"1 mod p
Appliquée à cette décomposition CRT, l'invention conduit au procédé suivant :• Iq = q "1 mod p Applied to this CRT decomposition, the invention leads to the following method:
• El : masquer l'opérande A (A' = KU'B2 * A) par un nombre u égal à deux fois le nombre s, en multipliant l'opérande A par un paramètre KU'B2,• El: hide the operand A (A '= K U ' B2 * A) by a number u equal to twice the number s, by multiplying the operand A by a parameter K U ' B2 ,
• E2 : calcul de C par le théorème des Restes Chinois• E2: Calculation of C by the Chinese Remainders Theorem
(exponentiation) :(exponentiation):
Cp' = (A' mod p)Blp mod p ; Cq' = (A' mod q)Blq mod q ;Cp '= (A' mod p) Blp mod p; Cq '= (A' mod q) Blq mod q;
C = Cq' + q* (Iq. (Cp '-Cq' ) mod p) mod N = KU*AB1 mod N = K2s*C mod NC = Cq '+ q * (Iq. (Cp' -Cq ') mod p) mod N = K U * A B1 mod N = K 2s * C mod N
• E3 : C = C * K"2s mod N (démasquage) De préférence, pour un calcul plus facile, on calculera d'abord K2, puis (K2)"3.• E3: C = C * K "2s mod N (unmasking) Preferably, for an easier calculation, one will calculate first K 2 , then (K 2 ) " 3 .
Dans une variante, on peut aussi réaliser :In a variant, it is also possible to carry out:
• El : masquer l'opérande A par un nombre u égal à deux fois le nombre s, de la manière suivante : Ap' = KU'B2 * A mod p• El: hide the operand A by a number u equal to twice the number s, in the following way: Ap '= K U ' B2 * A mod p
Aq' = KU'B2 * A mod qAq '= K U ' B2 * A mod q
• E2 : calcul de C' par le théorème des Restes Chinois (exponentiation) :• E2: Calculation of C 'by the Chinese Remainders Theorem (exponentiation):
Cp' = (Ap' )Blp mod p ; Cq' = (Aq' ) Blq mod q ;Cp '= (Ap') Blp mod p; Cq '= (Aq') Blq mod q;
C = Cq' + q* (Iq. (Cp '-Cq' ) mod p) mod NC = Cq '+ q * (Iq. (Cp' -Cq ') mod p) mod N
= KU*AB1 mod N= K U * A B1 mod N
= K2s*C mod N= K 2s * C mod N
• E3 : C = C * K"2s mod N (démasquage)• E3: C = C * K "2s mod N (unmasking)
Dans un mode préféré de réalisation, on choisira une constante K = 2 maκ(taille(p) ' tanieiqn = 2^ QÙ r est la plus grande taille parmi la taille de p et la taille de q. Ce
u_In a preferred embodiment, constant K = 2 is chosen maκ (height (p) 'ta n ia i q n = 2 ^ r that is the largest size among the size of p and q of size. This u_
choix permet des simplifications lors de la mise en œuvre du procédé à l'aide d'un processeur de Montgomery.choice allows simplifications when implementing the process using a Montgomery processor.
On remarque alors qu'à l'étape E3 la valeur K2 dans (K2) ~s est appropriée pour les opérations modulaires de Montgomery sur le module N sachant que la taille de N est inférieure ou égale à la somme des tailles de p et q, taille (N)≤taille (p) +taille (q)< 2*max (taille (p) , taille (q) ) .Note then that in step E3 the value K 2 in (K 2 ) ~ s is appropriate for the Montgomery modular operations on the module N, given that the size of N is less than or equal to the sum of the sizes of p. and q, size (N) ≤ size (p) + size (q) <2 * max (size (p), size (q)).
A noter enfin que le procédé de 1 ' invention peut être combiné avec des procédés antérieurs pour augmenter encore la sécurité du procédé.Finally, it should be noted that the process of the invention can be combined with previous methods to further increase the safety of the process.
Par exemple, en plus du masquage de A par KS'B2, on pourra également utiliser un aléa s2 pour masquer N, comme décrit dans le document D2 et l'art antérieur de la présente demande. Si le théorème des restes Chinois est utilisé, on pourra de même masquer p et q par s2.
For example, in addition to the masking of A by K S ' B2 , it is also possible to use a randomness s2 to mask N, as described in document D2 and the prior art of the present application. If the Chinese remainder theorem is used, we can similarly hide p and q by s2.