FR2864390A1 - Cryptographic process for e.g. message encryption and decryption, involves scanning bits of preset value from left to right in loop, and calculating and storing partial updated result equal to exponentiation in accumulator - Google Patents

Cryptographic process for e.g. message encryption and decryption, involves scanning bits of preset value from left to right in loop, and calculating and storing partial updated result equal to exponentiation in accumulator Download PDF

Info

Publication number
FR2864390A1
FR2864390A1 FR0314959A FR0314959A FR2864390A1 FR 2864390 A1 FR2864390 A1 FR 2864390A1 FR 0314959 A FR0314959 A FR 0314959A FR 0314959 A FR0314959 A FR 0314959A FR 2864390 A1 FR2864390 A1 FR 2864390A1
Authority
FR
France
Prior art keywords
register
variable
mod
contents
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
FR0314959A
Other languages
French (fr)
Other versions
FR2864390B1 (en
Inventor
Mames Benoit Chevallier
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gemplus SA
Original Assignee
Gemplus Card International SA
Gemplus SA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Gemplus Card International SA, Gemplus SA filed Critical Gemplus Card International SA
Priority to FR0314959A priority Critical patent/FR2864390B1/en
Priority to PCT/EP2004/053472 priority patent/WO2005069122A2/en
Priority to EP04804829A priority patent/EP1695204A2/en
Priority to CN 200480041877 priority patent/CN1918543A/en
Publication of FR2864390A1 publication Critical patent/FR2864390A1/en
Application granted granted Critical
Publication of FR2864390B1 publication Critical patent/FR2864390B1/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/723Modular exponentiation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
    • G06F21/72Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information in cryptographic circuits
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/72Indexing scheme relating to groups G06F7/72 - G06F7/729
    • G06F2207/7276Additional details of aspects covered by group G06F7/723
    • G06F2207/7285Additional details of aspects covered by group G06F7/723 using the window method, i.e. left-to-right k-ary exponentiation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/724Finite field arithmetic
    • G06F7/725Finite field arithmetic over elliptic curves

Abstract

The process involves scanning bits of a preset value from left to right in a loop indicated by a preset integer varying in a predetermined range. A partial updated result equal to exponentiation is calculated and stored in an accumulator. Result of multiplication of content in the accumulator with a function number in a register is stored in the accumulator for realizing modular exponentiation.

Description

PROCEDE CRYPTOGRAPHIQUE D' EXPONENTIATION MODULAIRE PROTEGE CONTRECRYPTOGRAPHIC METHOD OF MODULAR EXPONENTIATION PROTECTED AGAINST

LES ATTAQUES DE TYPE DPADPA ATTACKS

Dans le domaine de la protection des algorithmes cryptographiques contre les attaques DPA, l'invention concerne un procédé au cours duquel on réalise une exponentiation modulaire de type xAd, avec d un exposant entier de m+l bits, en balayant les bits de d de gauche à droite dans une boucle indicée par i variant de m à 0 et en calculant et en mémorisant dans un accumulateur (RO), à chaque tour de rang i, un résultat partiel actualisé égal à x'b(i). b(i) correspond aux m-i+l bits de poids les plus forts de l'exposant d: b(i) = dm_>i. Le nombre constitué des bits de poids j à k de d est défini par: dk->j= (dk,... , dj)2 = e=j di.2A (i - j) .  In the field of protection of cryptographic algorithms against DPA attacks, the invention relates to a method in which a modular exponentiation of xAd type, with an integer exponent of m + 1 bits, is carried out by scanning the bits of d left to right in a loop indexed by i varying from m to 0 and calculating and storing in an accumulator (RO), at each turn of rank i, an updated partial result equal to x'b (i). b (i) corresponds to the m-i + 1 most significant bits of the exponent d: b (i) = dm_> i. The number of bits of weight j to k of d is defined by: dk-> j = (dk, ..., dj) 2 = e = j di.2A (i-j).

L'exponentiation modulaire est une des opérations élémentaires utilisés dans de nombreux cryptosystèmes, tels que les cryptosystèmes RSA (Rivest, Shamir and Adleman) ou les cryptosystèmes DH (Diffie and Hellman). Pour de telles applications, x est par exemple un message à chiffrer ou déchiffrer, à signer ou à authentifier, et d est par exemple une clé publique, une clé secrète, ou une partie d'une telle clé.  Modular exponentiation is one of the basic operations used in many cryptosystems, such as RSA cryptosystems (Rivest, Shamir and Adleman) or DH (Diffie and Hellman) cryptosystems. For such applications, x is for example a message to be encrypted or decrypted, to sign or to authenticate, and d is for example a public key, a secret key, or a part of such a key.

Depuis l'invention de la cryptographie à clé publique par Diffie et Hellman, de nombreux cryptosystèmes à clé publique ont été proposés. Parmi ceux qui résistent à l'analyse cryptographique, le cryptosystème RSA est sans aucun doute le plus largement utilisé. Sa sécurité intrinsèque réside dans la difficulté de factoriser des grands nombres entiers. En dépit d'intensives recherches, le problème de la factorisation est encore considéré comme un important problème, rendant le cryptosystème RSA sûr pour des applications sensibles comme par exemple le chiffrement de données ou la signature digitale.  Since the invention of public key cryptography by Diffie and Hellman, many public key cryptosystems have been proposed. Among those that resist cryptographic analysis, the RSA cryptosystem is undoubtedly the most widely used. Its intrinsic security lies in the difficulty of factoring large integers. Despite intensive research, the problem of factorization is still considered an important problem, making the RSA cryptosystem safe for sensitive applications such as data encryption or digital signature.

Aussi, plutôt que de tenter de casser l'algorithme RSA à un niveau mathématique, les cryptographes se sont intéressés aux implémentations concrètes des cryptosystèmes RSA. Ceci a conduit à l'essor des attaques par fautes et des attaques à canaux cachés, visant à découvrir notamment des informations confidentielles (comme par exemple des clés ou des parties des clés) manipulées au cours de l'une ou de l'autre des étapes mises en oeuvre par le dispositif de calcul exécutant une opération cryptographique.  Also, rather than attempting to break the RSA algorithm at a mathematical level, cryptographers have been interested in the actual implementations of RSA cryptosystems. This has led to the rise of fake attacks and hidden channel attacks, aimed at discovering in particular confidential information (such as keys or parts of keys) manipulated during one or the other of steps implemented by the computing device executing a cryptographic operation.

Les attaques à canaux cachés les plus connues sont dites simples ou différentielles. On entend par attaque à canal caché simple (SPA) ou différentielle (DPA), une attaque basée sur la mesure d'une grandeur physique depuis l'extérieur du dispositif, dont l'analyse directe (attaque simple SPA) ou l'analyse selon une méthode statistique (attaque différentielle DPA) permet de découvrir des informations manipulées dans le dispositif. Ces attaques ont notamment été dévoilées par Paul Kocher (Advances in Cryptology - CRYPTO'99, vol. 1666 of Lecture Notes in Computer Science, pp.388-,397. Springer-Verlag, 1999), Parmi les grandeurs physiques qui peuvent être exploitées à ces fins, on peut citer le temps d'exécution, la consommation en courant, le champ électromagnétique rayonné par la partie du composant utilisée pour exécuter le calcul, etc. Ces attaques sont basées sur le fait que, au cours de l'exécution d'un algorithme, la manipulation d'un bit, c'est à dire son utilisation par une instruction particulière, laisse une empreinte particulière sur la grandeur physique considérée, selon la valeur de ce bit et / ou selon l'instruction.  The most known hidden channel attacks are called simple or differential. Simple concealed channel (SPA) or differential (DPA) attack is understood to mean an attack based on the measurement of a physical quantity from outside the device, including direct analysis (simple SPA attack) or analysis according to a statistical method (DPA differential attack) makes it possible to discover information manipulated in the device. These attacks have been unveiled by Paul Kocher (Advances in Cryptology - CRYPTO'99, 1666 of Lecture Notes in Computer Science, pp.388-, 397. Springer-Verlag, 1999), Among physical quantities that can be exploited for these purposes, the execution time, the power consumption, the electromagnetic field radiated by the part of the component used to perform the calculation, etc., may be mentioned. These attacks are based on the fact that, during the execution of an algorithm, the manipulation of a bit, ie its use by a particular instruction, leaves a particular imprint on the physical quantity considered, according to the value of this bit and / or according to the instruction.

Il existe deux familles d'implémentations des algorithmes d'exponentiation permettant d'évaluer la valeur de y = x"d mod N: les implémentations dites de droite à gauche et les implémentations dites de gauche à droite.  There are two families of implementations of exponentiation algorithms for evaluating the value of y = x "d mod N: so-called right-to-left implementations and so-called left-to-right implementations.

Dans les implémentations de gauche à droite, on balaye les bits de l'exposant depuis le bit de poids le plus fort jusqu'au bit de poids le plus faible. Dans cette deuxième famille d'algorithmes d'exponentiation, est notamment connu l'algorithme SAM (pour Square And Multiply ou élever au carré et multiplier) et ses variantes telles que les algorithmes à fenêtre glissante.  In the implementations from left to right, the bits of the exponent are scanned from the most significant bit to the least significant bit. In this second family of exponentiation algorithms, is notably known the SAM algorithm (for Square And Multiply or squaring and multiplying) and its variants such as sliding window algorithms.

Par rapport aux algorithmes dits de droite à gauche, les algorithmes de gauche à droite nécessitent moins de mémoire et permettent l'utilisation de puissances x'i précalculées pour accélérer le calcul de y. Tous les algorithmes de gauche à droite ont en commun l'utilisation d'un accumulateur (ou registre) qu'on actualise tout au long du calcul pour mémoriser la valeur de xAdm_>i mod N pour des valeurs décroissantes de i jusqu'à ce que l'accumulateur contienne la valeur finale y = xA dm_>o = xA d mod N. dk_>j est le mot constitué des bits de poids j à k de d.  Compared to so-called right-to-left algorithms, the left-to-right algorithms require less memory and allow the use of pre-computed x'i powers to speed up the calculation of y. All algorithms from left to right have in common the use of an accumulator (or register) that is updated throughout the calculation to store the value of xAdm_> i mod N for decreasing values of i until the accumulator contains the final value y = xA dm_> o = xA d mod N. dk_> j is the word consisting of the bits of weight j to k of d.

Le principe général de l'algorithme SAM est le suivant. On note d = (dm,.. . , do)2 = m=0 di.2A i, la représentation binaire de l'exposant d, avec di e {0, 1}, le bit de poids i de d. Pour chaque bit de d, l'algorithme SAM mémorise dans un accumulateur (registre RO) un résultat actualisé calculé à partir de la relation de récurrence xA dm_>i = ()eA dm->i+1)2 * xA di, avec xAdm_>m = xAdm, ce qui est résumé par l'algorithme ci- dessous: Entrée: x, d = (dm,... , do)2 Sortie: y = xAd mod N RO <- 1; R2 <- x, i <m tant que i 0, faire: RO <- ROxRO mod N si di = 1 alors RO <- ROxR2 mod N i <- i-1 fin tant que retourner RO RO <- x signifie que l'on mémorise dans le registre RO la valeur de x. ROxRO signifie que l'on réalise une mise au carré du contenu du registre R0. ROxR2 signifie qu'on réalise le produit du contenu du registre RO par le contenu du registre R2. Enfin, di_>j fait référence aux bits de rang j à i de d.  The general principle of the SAM algorithm is as follows. We denote d = (dm, ..., do) 2 = m = 0 di.2A i, the binary representation of the exponent d, with di e {0, 1}, the bit of weight i of d. For each bit of d, the SAM algorithm stores in an accumulator (register RO) an updated result calculated from the recurrence relation xA dm_> i = () eA dm-> i + 1) 2 * xA di, with xAdm_> m = xAdm, which is summarized by the algorithm below: Input: x, d = (dm, ..., do) 2 Output: y = xAd mod N RO <- 1; R2 <- x, i <m as i 0, do: RO <- ROxRO mod N if di = 1 then RO <- ROxR2 mod N i <- i-1 end as returning RO RO <- x means that l the value of x is stored in the register RO. ROxRO means that the contents of register R0 are squared. ROxR2 means that the product of the contents of the register RO is produced by the contents of the register R2. Finally, di_> j refers to bits of rank j to i of d.

Pour prévenir les attaques d'implémentation, il est connu qu'il faut rendre les algorithmes aléatoires. Dans le cas du cryptosystème RSA, on connaît actuellement deux types de contre-mesures pour rendre aléatoire le calcul de y = xAd mod N. Le premier type de contre-mesure consiste à rendre 25 aléatoire les données d'entrée de l'algorithme.  To prevent implementation attacks, it is known that random algorithms must be made. In the case of the RSA cryptosystem, two types of countermeasures are currently known for making the calculation of y = xAd mod N. random. The first type of countermeasure consists in rendering the input data of the algorithm random.

Un premier exemple de cette première contre-mesure consiste à rendre aléatoire la donnée x avant de réaliser l'exponentiation modulaire, en ajoutant à x un terme aléatoire et à faire les calculs modulo 2'k N, avant un modulo N final: x <- x + r1.N, avec r1 un nombre aléatoire de k- bits 10 et à faire les calculs modulo (2Ak).N, avant une réduction modulo N finale. Cette première contre-mesure, décrite par P. Kocher, présente l'avantage d'être indépendante de l'algorithme d'exponentiation.  A first example of this first countermeasure consists in rendering the data x random before carrying out the modular exponentiation, adding to x a random term and making the modulo 2'k N calculations, before a final modulo N: x < - x + r1.N, with r1 a random number of k-bits 10 and to do the modulo calculations (2Ak) .N, before a final modulo N reduction. This first countermeasure, described by P. Kocher, has the advantage of being independent of the exponentiation algorithm.

Un deuxième exemple de cette première contre-mesure consiste à rendre aléatoire l'exposant d avant de réaliser l'exponentiation modulaire, en lui ajoutant un terme aléatoire: d <- d + r2.ci)(N), r2 un nombre aléatoire de k-bits.  A second example of this first countermeasure consists in rendering the exponent d random before carrying out the modular exponentiation, adding to it a random term: d <- d + r2.ci) (N), r2 a random number of k-bits.

Le plus souvent, ces deux solutions sont combinées pour réaliser l'opération y = y mod N avec y = xA d mod(2k.N).  Most often, these two solutions are combined to perform the operation y = y mod N with y = xA d mod (2k.N).

Un troisième exemple de cette première contre-mesure utilisée seule par exemple lorsque x est le résultat d'un formatage probabiliste (par exemple à l'aide de la fonction PSS ou Probabilistic Signature Scheme), car dans ce cas, x est déjà masqué et on calcule directement y = x d mod N avec d = d + r2.cl)(N) avec r2 aléatoire.  A third example of this first countermeasure used alone for example when x is the result of a probabilistic formatting (for example using the PSS or Probabilistic Signature Scheme function), because in this case, x is already masked and we calculate directly y = xd mod N with d = d + r2.cl) (N) with random r2.

Malheureusement, une telle randomisation de l'exposant d est limitée à des implémentations particulières, appelées implémentations CRT, du cryptosystème RSA car la valeur de la constante d'Euler 4)(N) n'est généralement pas connue de l'algorithme d'exponentiation privé dans sa version standard (c'est-à-dire non CRT).  Unfortunately, such a randomization of the exponent d is limited to particular implementations, called CRT implementations, of the RSA cryptosystem because the value of the Euler constant 4) (N) is not generally known to the algorithm of private exponentiation in its standard version (that is, non-CRT).

La deuxième contre-mesure consiste à rendre l'algorithme d'exponentiation lui-même aléatoire. La meilleure mise en pratique de la 2ème contremesure est l'algorithme MIST de Walter. L'algorithme MIST génère de manière aléatoire une nouvelle chaîne d'addition pour l'exposant d pour réaliser xAd mod N. Pour minimiser le nombre de registres, la chaîne d'addition est réalisée à la volée par l'intermédiaire d'une adaptation d'un algorithme d'exponentiation basé sur des chaînes de divisions. Un autre exemple est une version améliorée d'un algorithme à fenêtre glissante (voir Kouichi Itoh, Jun Yajima, Masahiko Takenaka and Naoya Torii. DPA countermeasures by improving the window method CHES 2002, volume 2523 of Lecture Notes in computer Science, pages 303-317, Springer Verlag 2002). Comparé à la première contre-mesure, ceci permet de rendre aléatoire l'exponentiation sans avoir besoin de connaître 4(N) mais nécessite un algorithme de division sécurisé pour calculer les chaînes de divisions et cause des soucis de gestion des calculs non négligeables.  The second countermeasure is to make the exponentiation algorithm itself random. The best practice of the 2nd countermeasure is Walter's MIST algorithm. The MIST algorithm randomly generates a new addition string for the exponent d to realize xAd mod N. To minimize the number of registers, the addition chain is performed on the fly via an adaptation an exponentiation algorithm based on division strings. Another example is an improved version of a sliding window algorithm (see Kouichi Itoh, Jun Yajima, Masahiko Takenaka, and Naoya Torii.) CHES 2002, Volume 2523 of Lecture Notes in Computer Science, pages 303- 317, Springer Verlag 2002). Compared to the first countermeasure, this makes it possible to randomize the exponentiation without needing to know 4 (N) but requires a secure division algorithm to calculate the division strings and causes significant management problems.

L'invention propose un nouveau procédé pour rendre aléatoire l'exécution d'une exponentiation modulaire, dans le but de prévenir les attaques différentielles (DPA), présentant les avantages des deux contre-mesures connues comme dans la première contre-mesure, le procédé selon l'invention n'impose pas d'algorithme d'exponentiation particulier et s'applique à tout algorithme d'exponentiation, et comme dans la deuxième contre-mesure, dans l'invention, l'algorithme lui-même est rendu aléatoire, et non plus seulement les données qu'il manipule. Ainsi, l'algorithme n'a pas besoin de connaître 4(N) et / ou la clé publique e dans une exponentiation RSA (la clé e est souvent indisponible à l'algorithme de signature ou de déchiffrement).  The invention proposes a novel method for randomizing the execution of a modular exponentiation, with the aim of preventing differential attacks (DPA), having the advantages of the two known countermeasures as in the first countermeasure, the method according to the invention does not impose any particular exponentiation algorithm and applies to any exponentiation algorithm, and as in the second countermeasure, in the invention, the algorithm itself is made random, and not just the data he manipulates. Thus, the algorithm does not need to know 4 (N) and / or the public key e in an RSA exponentiation (the key e is often unavailable to the signature or decryption algorithm).

Le procédé selon l'invention introduit le concept de exponentiation autoaléatoire, signifiant que l'exposant d est utilisé lui-même comme une source additionnelle d'aléatoirité dans le processus d'exponentiation.  The method according to the invention introduces the concept of auto-random exponentiation, meaning that the exponent d is itself used as an additional source of randomness in the exponentiation process.

Ainsi, l'invention concerne un procédé cryptographique au cours duquel on réalise une exponentiation modulaire de type xAd, avec d un exposant entier de m+l bits, en balayant les bits de d de gauche à droite dans une boucle indicée par i décrémenté de m à 0 par pas de 1 et en calculant et en mémorisant dans un accumulateur, à chaque tour de rang i, un résultat partiel actualisé égal à xAb(i), b(i) étant les m-i+l bits de poids les plus forts de l'exposant d.  Thus, the invention relates to a cryptographic method in which a modular exponentiation of type xAd, with an integer exponent of m + 1 bits, is carried out by scanning the bits of d from left to right in a loop indexed by i decremented by m to 0 in steps of 1 and calculating and memorizing in an accumulator, at each turn of rank i, an updated partial result equal to xAb (i), b (i) being the m-i + 1 bits of weight the stronger of the exhibitor d.

Le procédé selon l'invention est caractérisé en ce que: - à la fin d'un tour de rang i(j) (i = i(0)) choisi 10 aléatoirement, on réalise une étape El de randomisation au cours de laquelle: El: on soustrait un nombre z (z= b(i(j)), z = b(i(j)) .2i, z = u) aléatoire à une partie des bits de d non encore utilisés (di_1_>0) dans le procédé - puis, après avoir utilisé les bits de d modifiés par l'étape de randomisation El, on réalise une étape de consolidation E2 au cours de laquelle: E2 on mémorise (RO <- R1xRO) dans l'accumulateur (RO) le résultat de la multiplication du contenu de 20 l'accumulateur (xAb(i)) par un nombre fonction de x'z mémorisé dans un registre (R1).  The method according to the invention is characterized in that: - at the end of a randomly selected turn of rank i (j) (i = i (0)), a randomization step E 1 is carried out during which: El: subtract a number z (z = b (i (j)), z = b (i (j)) .2i, z = u) random at some of the bits of d not yet used (di_1_> 0) in the method - then, after having used the bits of d modified by the randomization step E1, a consolidation step E2 is carried out during which: E2 is stored (RO <- R1xRO) in the accumulator (RO) the result of multiplying the contents of the accumulator (xAb (i)) by a function number of x'z stored in a register (R1).

D'un point de vue pratique, au cours de l'étape El, le nombre z est soustrait au contenu d'un registre dans lequel est mémorisé initialement l'exposant d, et le résultat de la soustraction est mémorisé dans le même registre, puis on continue de balayer les bits de b.  From a practical point of view, during the step E1, the number z is subtracted from the contents of a register in which the exponent d is initially stored, and the result of the subtraction is stored in the same register, then we continue to scan the bits of b.

Pour que le résultat de l'exponentiation xAd mod N soit correct à la fin du procédé, l'étape de randomisation El, ne doit pas modifier les bits de d déjà utilisés dans le calcul (on rappelle que le procédé utilise un algorithme de gauche à droite). L'index i(j) auquel on réalise la randomisation El, choisi aléatoirement, doit donc être choisi tel que les m-i (j) +l bits de poids les plus forts du registre contenant initialement l'exposant d restent inchangés lors de l'étape El. On appellera par la suite cette condition une condition de "consistance".  For the result of the exponentiation xAd mod N to be correct at the end of the process, the randomization step El, must not modify the bits of d already used in the computation (remember that the process uses a left algorithm to the right). The index i (j) to which the randomization El, randomly chosen, is to be chosen must be chosen such that the mid (j) + 1 most significant bits of the register initially containing the exponent d remain unchanged at the time. Step El. This condition will be called a condition of "consistency".

L'idée essentielle de l'invention st ainsi d'utiliser un découpage du calcul de xAd mod N de la forme: xAd = xA(d-z)*xAz (décrit dans la demande de brevet français n 02 04117 (n à confirmer) avec z un nombre aléatoire utilisé comme moyen de masquage de l'exposant d. On choisit de préférence des valeurs de z appropriées telles que xAz puisse être obtenu facilement à partir de x'b déjà calculé par ailleurs au cours du procédé. A noter qu'un choix totalement aléatoire de z entraîne un quasi doublement du temps de calcul.  The essential idea of the invention is thus to use a division of the calculation of xAd mod N of the form: xAd = xA (dz) * xAz (described in the French patent application No. 02 04117 (n to be confirmed) with z is a random number used as a means of masking the exponent d. Preferably, appropriate values of z are chosen such that xAz can easily be obtained from x'b already calculated elsewhere during the process. a totally random choice of z results in a near doubling of the computation time.

Le procédé selon l'invention s'applique indépendamment de l'algorithme d'exponentiation de gauche à droite. Par ailleurs, le rang i(j) auquel on réalise l'étape El est choisi aléatoire donc le procédé lui-même est aléatoire, et non pas seulement les données qu'il manipule.  The method according to the invention applies independently of the exponentiation algorithm from left to right. On the other hand, the rank i (j) at which step E 1 is performed is random, so the process itself is random, and not only the data it manipulates.

Le procédé selon l'invention est également efficace en termes de place (il ne nécessite qu'un seul registre de calcul supplémentaire) et en terme de temps de calcul, comme on le verra mieux par la suite dans l'exemple de l'algorithme SAM.  The method according to the invention is also effective in terms of space (it requires only one additional calculation register) and in terms of calculation time, as will be seen later in the example of the algorithm SAT.

Le procédé selon l'invention est encore facile à mettre en oeuvre quel que soit l'algorithme auquel il est appliqué : il ne repose sur aucune propriété de groupe et sa mise en oeuvre ne nécessite pas de connaître au préalable l'ordre du groupe dans lequel l'exponentiation est réalisée.  The method according to the invention is still easy to implement whatever the algorithm to which it is applied: it does not rely on any group property and its implementation does not require to know in advance the order of the group in which exponentiation is performed.

Enfin, le procédé selon l'invention peut être utilisé conjointement avec d'autres mesures de protection des algorithmes, comme par exemple les contre mesures dévoilées par P. Kocher et rappelées précédemment.  Finally, the method according to the invention can be used in conjunction with other protection measures of the algorithms, such as the counter measures disclosed by P. Kocher and recalled previously.

L'étape El de randomisation peut être réalisée une seule fois au cours du procédé. L'étape El peut également être réalisée plusieurs fois, à la fin de différents tours de rang i(j) (c'est-à-dire au rang i = i (0) , puis au rang i = i (1) , ..., puis enfin au rang i = i (f)) choisis aléatoirement entre 0 et m. L'idée est ici d'améliorer encore la sécurité du procédé en utilisant la relation xAd = xA(d-zl-z2-_-zf)xxAzlxxAz2x xxAzf = xA(((d-zl)-z2)-...-zf)x((xAzl)xxAz2)x... xxAzf On peut choisir au début du procédé le ou les rangs i (j) aléatoires auxquels on réalise une randomisation El. Par exemple, au début du procédé, on détermine un ensemble prédéfini {i (0) , i (1) , ..., i (f) } de f+l (f étant aléatoire ou non) valeurs de l'index i pour lesquelles on souhaite réaliser une randomisation El. Dans ce cas, à chaque tour, on décide de réaliser ou non une randomisation El selon que l'index courant i fait partie ou non de l'ensemble prédéfini.  The randomization step E 1 can be carried out once during the process. Step E1 can also be performed several times, at the end of different turns of rank i (j) (that is to say at rank i = i (0), then at rank i = i (1), ..., then finally at the rank i = i (f)) randomly selected between 0 and m. The idea here is to further improve the safety of the process by using the relation xAd = xA (d-z1-z2 -_-zf) xxAz1xxAz2x xxAzf = xA (((d-z1) -z2) -...- zf) x ((xAzl) xxAz2) x ... xxAzf One can choose at the beginning of the process the random row or ranks i (j) to which one carries out a randomization El. For example, at the beginning of the process, one determines a predefined set {i (0), i (1), ..., i (f)} of f + 1 (f being random or not) values of the index i for which it is desired to carry out a randomization El. In this case, at each turn, it is decided whether or not to perform a randomization El according to whether the current index i is part of the predefined set or not.

On peut aussi choisir aléatoirement au début de chaque tour i de réaliser ou non l'étape El de randomisation. Dans ce cas, on utilise par exemple une variable booléenne p, tirée aléatoirement à la fin de chaque tour d'index i.  One can also choose randomly at the beginning of each turn i to perform or not the randomization step E1. In this case, we use for example a boolean variable p, randomly drawn at the end of each index round i.

Différents modes de réalisation de l'invention vont maintenant être décrits, qui diffèrent l'un de l'autre essentiellement par le mode de réalisation de l'étape El, et notamment par le choix de z et par le choix de la partie de d à laquelle on soustrait z. Selon un premier mode de réalisation, on choisit de réaliser l'étape de consolidation une seule fois à la fin du procédé. Ceci impose de soustraire z systématiquement aux bits de poids les plus faibles de l'exposant d, de sorte à obtenir un résultat correct à la fin du procédé.  Various embodiments of the invention will now be described, which differ from each other essentially by the embodiment of step E1, and in particular by the choice of z and by the choice of the part of d. subtracted from z. According to a first embodiment, it is chosen to carry out the consolidation step once at the end of the process. This requires systematically subtracting the least significant bits of the exponent d, so as to obtain a correct result at the end of the process.

Selon une première variante de ce mode de réalisation, on choisit z = b (i (j)) = dm_>i (j) pour un nombre aléatoire i(j) choisi et, au cours de l'étape de randomisation El, on soustrait b (i (j)) à d, c'est-à-dire aux bits de poids les plus faibles de d.  According to a first variant of this embodiment, z = b (i (j)) = dm_> i (j) is chosen for a random number i (j) chosen and, during the randomization step E 1, subtract b (i (j)) to d, i.e., the least significant bits of d.

Le choix z = b(i(j)) est particulièrement avantageux puisque xAb (i (j)) = x'dm_>i (j) est déjà disponible dans l'accumulateur à la fin du tour i(j) et n'a donc pas besoin d'être calculé. La variable i(j) est choisie telle que les bits de poids i(j) à m du nombre d-b(i(j)) soient égaux aux bits de poids i(j) du nombre d, de sorte que les m-i(j)+l premiers tours du calcul de xAd sont identiques aux m-i(j)+l premiers tours du calcul de x'(db(i(j))) (condition de consistance). A la fin du tour i(j), on calcule d-z = d-b(i(j)) et on mémorise le contenu de l'accumulateur xAb dans le registre (El).  The choice z = b (i (j)) is particularly advantageous since xAb (i (j)) = x'dm_> i (j) is already available in the accumulator at the end of the turn i (j) and n ' therefore does not need to be calculated. The variable i (j) is chosen such that the bits of weight i (j) to m of the number db (i (j)) are equal to the bits of weight i (j) of the number d, so that the mi (j) ) + l the first rounds of the xAd calculation are identical to the first mi (j) + l rounds of the x '(db (i (j))) computation (consistency condition). At the end of the turn i (j), one calculates d-z = d-b (i (j)) and one memorizes the contents of the accumulator xAb in the register (El).

Dans un exemple particulier, une variable booléenne p est utilisée pour déterminer, à la fin de chaque tour d'index i, si on réalise ou non une randomisation. Si p prend une valeur active, alors on réalise l'étape El: on remplace le nombre d par le nombre d-b(i(j)) et on mémorise xAb(i(j)).  In a particular example, a boolean variable p is used to determine, at the end of each index round i, whether a randomization is performed or not. If p takes an active value, then step E1 is carried out: the number d is replaced by the number d-b (i (j)) and xAb (i (j)) is stored.

Comme dans l'algorithme de gauche à droite classique, l'accumulateur RO est utilisé pour conserver la valeur de x'dm_>i, à chaque tour d'index i. On utilise le registre R1 pour conserver le produit jljx^ dm->i(j) Le tout appliqué à l'algorithme SAM connu, on obtient le l'algorithme I suivant: Entrée. x, d = (dm,... , do)2 Sortie: y = x'd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m tant que i 0, faire: RO <- ROxRO mod N si di = 1 alors RO <ROxR2 mod N p <- R{0, 1} si p = 1) ET di_1_>0 alors d<- d - dm->i R1 <RlxRO mod N fin si i <- i-i fin tant que RO <- ROxRl mod N retourner RO p <- R{0, i} signifie que l'on choisit la valeur de p aléatoirement dans l'ensemble {0, i}. p est ainsi une variable booléenne aléatoire.  As in the classical left-to-right algorithm, the RO accumulator is used to keep the value of x'dm_> i at each index round i. We use the register R1 to keep the product jljx ^ dm-> i (j) All applied to the known SAM algorithm, we obtain the following algorithm I: Input. x, d = (dm, ..., do) 2 Output: y = x'd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m as long as i 0, do: RO <- ROxRO mod N if di = 1 then RO <ROxR2 mod N p <- R {0, 1} if p = 1) AND di_1_> 0 then d <- d - dm-> i R1 <RlxRO mod N fin if i <- ii end as long as RO <- ROxRl mod N return RO p <- R {0, i} means that we choose the value of p randomly in the set {0, i}. p is thus a random Boolean variable.

L'étape de randomisation El (d <- d - dm_>i(j) ; R1 <-R1xRO mod N) est réalisée uniquement si p = 1 (c'est-à- 20 dire si une randomisation doit être réalisée) et si di(j)-1->0 >_ dm-> i (j) La condition di(j)_I_>0 ? dm->i (j) signifie que les bits de poids 0 à i-1 de d sont supérieurs à b(i(j)), b(i(j)) étant égal aux bits de poids i(j) à m de d. Ceci permet de garantir que les m-i+l bits de poids les plus forts de d-b(i(j)) sont identiques aux m- i+l bits de poids forts de d, et donc que les m-i+l premiers tours du calcul de xAd sont identiques aux m-i+l premiers tours du calcul de xA(d- b(i(j))).  The randomization step E1 (d <- d - dm -> i (j); R1 <- R1xRO mod N) is carried out only if p = 1 (that is to say if randomization is to be carried out) and if di (j) -1-> 0> _ dm-> i (j) The condition di (j) _I_> 0? dm-> i (j) means that the bits of weight 0 to i-1 of d are greater than b (i (j)), b (i (j)) being equal to the bits of weight i (j) to m of d. This makes it possible to guarantee that the m-i + 1 most significant bits of db (i (j)) are identical to the m-i + l most significant bits of d, and therefore that the first m-i + 1 The rounds of the xAd calculation are identical to the first m-i + l rounds of the xA calculation (d- b (i (j))).

La condition de "consistance" (di (j) -1->0 ? d>) implique que seulement les bits de poids faibles de l'exposant d sont rendus aléatoires. De plus, on remarque que l'étape de randomisation d <- d - dm->i (j) modifie uniquement les (m-i(j)+l) bits les moins significatifs de d.  The condition of "consistency" (di (j) -1-> 0? D>) implies that only the least significant bits of exponent d are randomized. Moreover, we note that the randomization step d <- d - dm-> i (j) only modifies the (m-i (j) + l) least significant bits of d.

A noter que, dans l'algorithme I, comme à l'itération i = i(j) l'étape de mise à jour d <- d - dm_>i ne modifie pas les (m-i+l) bits les plus significatifs de d, cette étape peut être remplacée par l'étape équivalente: di-1->0 <- di-1->0 - dm->i.  Note that, in the algorithm I, as at the iteration i = i (j) the update step d <- d - dm_> i does not modify the (m-i + l) most Significantly, this step can be replaced by the equivalent step: di-1-> 0 <- di-1-> 0 - dm-> i.

Selon une deuxième variante du premier mode de réalisation, on choisit z égal g.b(i), avec g un nombre aléatoire tel que di(j)_I_>0 ? g É dm->i (j) É On utilise dans ce cas la relation xAd = xA(d-z).xAz = x dg.b(i)). (xAb(i))g, et, d'un point de vue pratique, pour réaliser une randomisation El à la fin du tour d'index i(j): - on calcule z = g.b(i) et on soustrait le résultat à l'exposant d, - le registre R1 est mis à jour en multipliant son contenu par le contenu de l'accumulateur (xAb(i)) exposé à la puissance g. Ce qui concrètement peut être réalisé par l'instruction Rl <RlxRO'g mod N. On choisit de préférence g = 21, T étant un nombre entier aléatoire. Ceci simplifie considérablement les calculs car le calcul de g.b(i) = g.dm_>i(7) revient à un simple décalage de bits et l'évaluation de (x 'b (i)) 'g mod N revient à réaliser le calcul de i carrés.  According to a second variant of the first embodiment, z is chosen equal to g.b (i), with g a random number such that di (j) _I_> 0? In this case, we use the relation xAd = xA (d-z) .xAz = x dg.b (i)). (xAb (i)) g, and, from a practical point of view, to perform a randomization El at the end of the index round i (j): - we calculate z = gb (i) and subtract the result to the exponent d, the register R1 is updated by multiplying its content by the content of the accumulator (xAb (i)) exposed to the power g. What concretely can be achieved by the instruction R1 <R1xRO'g mod N. We choose preferably g = 21, where T is a random integer. This considerably simplifies the computations since the computation of gb (i) = g.dm_> i (7) amounts to a simple bit shift and the evaluation of (x 'b (i))' g mod N amounts to realizing the calculating i squares.

Puisque multiplier par 21 revient à un décalage de bits, l'instruction d <- d - 2ti.dm_>i qui calcule d-g.b(i) peut être remplacée par dm_>1 <- dm>t - dm->i ou mieux, par l'instruction équivalente di_1_>T <- di-1->1 dm->i De plus, comme pour les autres modes de réalisation, on doit vérifier que à l'itération i=i (j) , di-1->0 ? 21É dm->i Cette condition de consistance peut être remplacée par un test équivalent mais plus efficace: di_1_>T dm-iÉ De préférence, on choisit t aléatoire dans l'ensemble {0, T}. La borne T est choisie comme le meilleur compromis entre la randomisation des bits les plus significatifs de d et l'efficacité (en terme de temps de calcul notamment) du calcul des i carrés.  Since multiplying by 21 returns to a bit shift, the instruction d <- d - 2ti.dm_> i which calculates dg.b (i) can be replaced by dm_> 1 <- dm> t - dm -> i or moreover, by the equivalent instruction di_1_> T <- di-1-> 1 dm-> i Moreover, as for the other embodiments, it must be verified that at the iteration i = i (j), di- 1-> 0? This condition of consistency can be replaced by an equivalent but more effective test: di_1_> T dm-iE Preferably, we choose t random in the set {0, T}. The terminal T is chosen as the best compromise between the randomization of the most significant bits of d and the efficiency (in terms of computation time in particular) of the calculation of the i squares.

Dans l'exemple particulier de l'algorithme SAM, on obtient finalement l'algorithme I' suivant. Entrée: x, d = (dm,... , do)2 Sortie: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m tant que i 0, faire: RO <- ROxRO mod N si di = 1 alors RO <- ROxR2 mod N p <- R{0, 1} ; T <- R{0, ..., T} si p = 1) ET (di_1_*T dm_i)) alors ± di-1->T - dm->i R3 <- RO tant que (T > 0) faire R3 <- R3A2 mod N T <- T-1 fin tant que R1 <- R1xR3 mod N fin si i <i-1 fin tant que RO <- ROxRl mod N retourner RO Un avantage de l'algorithme I' est qu'on randomise en partie la moitié supérieure de d et qu'on ajoute en conséquence de l'entropie (c'est-à-dire de l'aléatoirité). Par contre, un registre supplémentaire R3 est nécessaire pour calculer ROA2T.  In the particular example of the SAM algorithm, the following algorithm I 'is finally obtained. Input: x, d = (dm, ..., do) 2 Output: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m as long as i 0, do: RO <- ROxRO mod N if di = 1 then RO <- ROxR2 mod N p <- R {0, 1}; T <- R {0, ..., T} if p = 1) AND (di_1_ * T dm_i)) then ± di-1-> T - dm-> i R3 <- RO as long as (T> 0) do R3 <- R3A2 mod NT <- T-1 end as long as R1 <- R1xR3 mod N end if i <i-1 end as long as RO <- ROxRl mod N return RO An advantage of the algorithm I 'is that Partly, the upper half of d is randomized and entropy (that is, randomness) is added accordingly. On the other hand, an additional register R3 is necessary to calculate ROA2T.

Les algorithmes I et I' peuvent être suffisants pour protéger les exposants dans certains cas. Par exemple, en raison de sa construction, le cryptosystème RSA dévoile toujours la moitié la plus significative de l'exposant d privé si l'exposant public correspondant est petit. Rendre aléatoire les bits de poids forts de d 10 20 n'apporterait donc aucune protection pour un tel algorithme.  The I and I 'algorithms may be sufficient to protect the exponents in some cases. For example, because of its construction, the RSA cryptosystem still reveals the most significant half of the private exponent if the corresponding public exponent is small. Randomizing the high bits of d 10 would therefore not provide any protection for such an algorithm.

Toutefois, pour d'autres algorithmes et dans d'autres situations, rendre aléatoire tous les bits de d apporterait une sécurité supplémentaire.  However, for other algorithms and in other situations, randomizing all bits of d would provide additional security.

Pour cela, on propose, dans un deuxième mode de réalisation, de choisir z = b (i (j)) = dm->i(j) pour un nombre aléatoire i(j) et, au cours de l'étape El, on soustrait b(i) non plus à d, mais à une partie des bits de d correspondant aux bits de d de poids i(j)-c(j) à i (j) -1, c(j) étant un nombre entier tel que i(j) c(j) 0. Ceci peut être exprimé par l'instruction suivante: dm->i(j)-c(j) <- dm->i(j)-c(j) - dm->i(j) Préférentiellement, comme lors de l'étape El d'une randomisation au rang i (j) , on modifie les bits de poids i(j) - c(j) à i(j) - 1 de d et on choisit de ne réaliser qu'une seule randomisation à la fois, et on choisit de réaliser une étape de consolidation à la fin du rang utilisant le dernier bit de d modifié lors de l'étape de randomisation El précédente (et non plus à la fin du procédé), c'est à dire après l'évaluation du résultat partiel x' (dm->i (j) -c (j)) mod N. Ceci revient à imposer la condition i(j+l) S i(j) - c(j), i(j+l) étant l'index de la randomisation suivante. Ceci permet de ne pas utiliser de registres supplémentaires pour mémoriser les bits de l'exposant qui ont été modifiés lors d'une randomisation précédente. Egalement, on choisit i(j) - c(j) < 0, de sorte que i(j) - c(j) puisse être utilisé pour définir le rang d'un bit de d pour le calcul de xA (dm->i (j) -c (j)) mod N. Ces deux conditions peuvent être concrétisées par l'utilisation d'un sémaphore booléen c qui indique si une mise à jour est autorisée ou pas 6 a une valeur inactive tant que i i(j) - c(j) et est activée lorsque i< i(j) - c(j). Elle devient de plus inutilisable dès que i(j) - c(j) O. Les (m-i (j) +l) bits de poids les plus forts de d restent inchangés lors de l'étape de randomisation si (condition de consistance) . di(j1-l->i(j)- c(j) dm->i(j) (i(j) - 1) (i(j) - c(j) ) m - i(j) q c(j) m - i(j) + 1 Selon une première variante du deuxième mode de réalisation, on choisit c(j) égal à m-i(j)+l. Avec la condition i(j) c(j) ? 0, la condition c(j) m - i(j) + 1 est vérifiée si 2.i(j) _> m+l.  For this purpose, it is proposed, in a second embodiment, to choose z = b (i (j)) = dm-> i (j) for a random number i (j) and, during step E1, subtracting b (i) no longer from d, but from a part of the bits of d corresponding to the bits of d of weight i (j) -c (j) to i (j) -1, where c (j) being a number integer such that i (j) c (j) 0. This can be expressed by the following statement: dm-> i (j) -c (j) <- dm-> i (j) -c (j) - dm-> i (j) Preferentially, as in step E1 of a randomization at rank i (j), the bits of weight i (j) - c (j) to i (j) - 1 of d and we choose to perform only one randomization at a time, and we choose to perform a consolidation step at the end of the rank using the last bit of modified d in the previous randomization step El (and no longer at the end of the process), ie after the evaluation of the partial result x '(dm-> i (j) -c (j)) mod N. This amounts to imposing the condition i (j + 1) S i (j) - c (j), where i (j + l) being index of the next randomization. This makes it possible not to use additional registers to memorize the bits of the exponent that have been modified during a previous randomization. Also, we choose i (j) - c (j) <0, so that i (j) - c (j) can be used to define the rank of a bit of d for the calculation of xA (dm-> i (j) -c (j)) mod N. These two conditions can be concretized by the use of a Boolean semaphore c which indicates whether an update is allowed or not 6 has an inactive value as long as ii (j ) - c (j) and is activated when i <i (j) - c (j). It becomes more unusable as soon as i (j) - c (j) O. The (mi (j) + l) most significant bits of d remain unchanged during the randomization step if (consistency condition) . di (j1-l-> i (j) - c (j) dm-> i (j) (i (j) - 1) (i (j) - c (j)) m - i (j) qc ( j) m - i (j) + 1 According to a first variant of the second embodiment, one chooses c (j) equal to mi (j) + 1. With the condition i (j) c (j)? condition c (j) m - i (j) + 1 is satisfied if 2.i (j) _> m + l.

L'algorithme SAM modifié selon cette variante peut alors s'écrire (algorithme II) . Entrée. x, d = (dm,... , d0)2 Sortie: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m; c <- -1; a <- 1 tant que i 0, faire: RO <ROxRO mod N si di = 1 alors RO <- ROxR2 mod N fin si si (2i ? m+l) ET (a = 1) alors c <- m-i+l sinon a = 0 fin si p <- R{0, 1} s <- p ET (di-1 -> i-c dm->i) ET a si s = 1 alors R1 <- RO; a <- 0 di-1 -> i-c <- di-1 -> i- c dm -> i fin si si c = 0 alors RO <- ROxRl mod N; 6 <- 1 fin si c <- c- 1; i <- i-1 fin tant que retourner RO On notera que l'algorithme I correspond à l'algorithme II 25 dans le cas où c(j) = i(j) pour tout j. On notera également que dans l'algorithme II, la condition de consistance (di(j)-1+c(j) dm-) est satisfaite durant la première partie de l'algorithme, en considérant de manière approximative que di(j)-1__>i(j)-c(j) et dm->i(j) sont des nombres aléatoires de (m-i(j)+l) bits. On notera, dans cet algorithme, que tous les bits de l'exposant sont randomisés.  The modified SAM algorithm according to this variant can then be written (algorithm II). Entrance. x, d = (dm, ..., d0) 2 Output: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m; c <-1; a <- 1 while i 0, do: RO <ROxRO mod N if di = 1 then RO <- ROxR2 mod N end if if (2i? m + l) AND (a = 1) then c <- m-i + l otherwise a = 0 end if p <- R {0, 1} s <- p AND (di-1 -> ic dm-> i) AND if s = 1 then R1 <- RO; a <- 0 di-1 -> i-c <- di-1 -> i- c dm -> i end if if c = 0 then RO <- ROxRl mod N; 6 <- 1 end if c <- c- 1; It will be noted that algorithm I corresponds to algorithm II in the case where c (j) = i (j) for all j. It will also be noted that in algorithm II, the consistency condition (di (j) -1 + c (j) dm-) is satisfied during the first part of the algorithm, considering approximately that di (j) __ (j) -c (j) and dm-> i (j) are random numbers of (mi (j) + l) bits. It will be noted in this algorithm that all the bits of the exponent are randomized.

10 15 20 Selon une deuxième variante du deuxième mode de réalisation, on choisit c(j) aléatoire et compris entre i(j) et m-i(j)+l.  According to a second variant of the second embodiment, one chooses c (j) random and between i (j) and m-i (j) + 1.

On a vu précédemment que la condition c(j) m - i(j) + 1 doit être vérifiée. En posant c(j) = m - i(j) + 1 + v(j), on doit donc vérifier v(j) O. Par ailleurs, avec la condition i(j) c(j) >- 0, il vient 2.i(j) m+l+v(j). Donc la plus grande valeur possible pour v(j) est 2.i(j)-m-1 et donc, comme v(j) >_0, le paramètre c(j) = m- i(j)+1+v(j) peut prendre toute valeur dans l'ensemble {mi(j)+l, ..., i(j)} . On peut alors généraliser l'algorithme II en choisissant c(j) aléatoire dans l'ensemble {m-i(j)+l, ..., i(j)}.  We have seen previously that the condition c (j) m - i (j) + 1 must be verified. By putting c (j) = m - i (j) + 1 + v (j), we must therefore check v (j) O. Moreover, with the condition i (j) c (j)> - 0, comes 2.i (j) m + l + v (j). So the greatest possible value for v (j) is 2.i (j) -m-1 and so, like v (j)> _0, the parameter c (j) = m- i (j) + 1 + v (j) can take any value in the set {mi (j) + l, ..., i (j)}. We can then generalize algorithm II by choosing c (j) random in the set {m-i (j) + l, ..., i (j)}.

Dans l'exemple particulier de l'algorithme II cela revient à remplacer l'instruction: si (2i >- m+l) ET (a = 1) alors c <- m-i+l par l'instruction: si (2i >_ m+1) ET (a = 1) alors c <- R{m-i+l, i} ce qui donne l'algorithme III suivant: Entrée: x, d = (dm,... , do)2 Sortie: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m; c <- -1; a <- 1 tant que i 0, faire: RO <- ROxRO mod N si di = 1 alors RO <- ROxR2 mod N fin si si (2i >_ m+l) ET (a = 1) alors c <- R{m-i+l, i} sinon a = 0 fin si p <- R{O, 1} E <- p ET (di-1 -> i-c dm->i) ET a si E = 1 alors R1 <- RO; a <- 0 di-1 -> i-c <- di-1 -> i-c - dm -> i fin si si c = 0 alors RO <- ROxRl mod N; 6 <1 fin si c <- c-1; fin tant que retourner RO Une valeur plus grande pour v(j) augmente la probabilité de succès pour la condition de consistance (et donc pour le choix d'une randomisation). D'un autre côté, cela réduit également les valeurs possibles de l'indexe i vérifiant la condition 2.i(j) m+l+v(j).  In the particular example of the algorithm II it amounts to replacing the instruction: if (2i> - m + l) AND (a = 1) then c <- m-i + 1 by the instruction: if (2i > _ m + 1) AND (a = 1) then c <- R {m-i + l, i} which gives the following algorithm III: Input: x, d = (dm, ..., do) 2 Output: y = xAd mod N RO <- 1; R1 <- 1; R2 <- x; i <- m; c <-1; a <- 1 while i 0, do: RO <- ROxRO mod N if di = 1 then RO <- ROxR2 mod N end if if (2i> _ m + l) AND (a = 1) then c <- R {m-i + l, i} else a = 0 end if p <- R {O, 1} E <- p AND (di-1 -> ic dm-> i) AND if E = 1 then R1 < - RO; a <- 0 di-1 -> i-c <- di-1 -> i-c - dm -> i end if if c = 0 then RO <- ROxRl mod N; 6 <1 end if c <- c-1; end as returning RO A larger value for v (j) increases the probability of success for the consistency condition (and therefore for choosing a randomization). On the other hand, this also reduces the possible values of the indexe i satisfying the condition 2.i (j) m + 1 + v (j).

La fréquence d'occurrence de la valeur p = 0 de la variable booléenne p est un paramètre du procédé permettant de choisir le meilleur compromis entre 10 15 20 performance et sécurité, en fonction de l'application envisagée: plus on réalise d'étapes de randomisation, plus on pénalise le temps de calcul global; inversement, moins on réalise d'étapes de randomisation, plus on facilite les attaques par recherche exhaustive.  The frequency of occurrence of the p = 0 value of the boolean variable p is a parameter of the method making it possible to choose the best compromise between performance and security, depending on the application envisaged: the more steps are taken to randomization, the more the global computation time is penalized; conversely, the less randomization steps are performed, the more the attacks by exhaustive search are facilitated.

Un bon moyen pour minimiser le coût des opérations additionnelles consiste à modifier légèrement le générateur de nombres aléatoires produisant le nombre p de sorte que, lorsque le poids de Hamming de d-z (z peut avoir différentes valeurs en fonction de b(i), selon le mode de réalisation envisagé) est plus faible que le poids de Hamming de d, p a une plus forte probabilité de valoir 1, et inversement. Avec cette astuce, l'algorithme va tendre à sélectionner le cas ayant le plus faible poids de Hamming, c'est-à-dire la branche la plus rapide.  A good way to minimize the cost of the additional operations is to slightly modify the random number generator producing the number p so that, when the Hamming weight of dz (z can have different values as a function of b (i), according to the envisaged embodiment) is lower than the Hamming weight of d, pa has a higher probability of being 1, and vice versa. With this trick, the algorithm will tend to select the case with the lowest weight of Hamming, that is to say the fastest branch.

On note seulement que cet algorithme ne peut pas toujours sélectionner la branche la plus rapide, sinon, il deviendrait déterministe et donc facilement attaquable.  We only note that this algorithm can not always select the fastest branch, otherwise it will become deterministic and therefore easily attackable.

Selon un troisième mode de réalisation de l'invention, on choisit au début du procédé un nombre u aléatoire de v bits et on mémorise x'u dans le registre Rl. De préférence, le nombre u est modifié plusieurs fois au cours du procédé, pour augmenter le facteur aléatoire dans le procédé.  According to a third embodiment of the invention, a random number of v bits is selected at the beginning of the method and x'u is stored in the register R1. Preferably, the number u is changed several times during the process to increase the random factor in the process.

Puis, au cours du calcul, pour un rang i (j) donné, on se demande, pour un paquet w de v bits de d tel que w>u, si le calcul de xAw est plus coûteux (en terme de temps de calcul) que celui de xA(w-u)*xAu.  Then, during the computation, for a given rank i (j), one wonders, for a packet w of v bits of d such that w> u, if the computation of xAw is more expensive (in term of computation time ) that of xA (wu) * xAu.

Pour répondre à cette question, il suffit de déterminer si H(w > H(w-u) + 1. H (w) est le poids de Hamming de w, il est représentatif du coût de l'opération x'w. H(w-u) est le poids de Hamming de x'(w-u), représentatif de x'(w-u). Le terme " + 1" est représentatif du coût de la multiplication de x'(w-u) par x'u (x'u étant mémorisé par ailleurs).  To answer this question, it is sufficient to determine if H (w> H (wu) + 1. H (w) is the Hamming weight of w, it is representative of the cost of the operation x'w. ) is the Hamming weight of x '(wu), representative of x' (wu) The term "+ 1" is representative of the cost of multiplying x '(wu) by x'u (x'u being memorized otherwise).

Si le calcul de x'w est moins coûteux que le calcul de x w-u)*xAu, alors on continue le procédé. Sinon, si le calcul de xAw est plus coûteux que le calcul de xA(wu)*x'u, alors on remplace le paquet w de bits de d par le nombre w-u. L'étape de consolidation (ici, une multiplication par xAu, qui ce traduit par l'opération RO <- ROxRl mod N) sera réalisée lorsque tous les bits de d modifiés auront été utilisés.  If the computation of x'w is less expensive than the computation of x w-u) * xAu, then the process is continued. Otherwise, if the calculation of xAw is more expensive than the calculation of xA (wu) * x'u, then we replace the packet w of bits of d by the number w-u. The consolidation step (here, a multiplication by xAu, which translates by the operation RO <- ROxRl mod N) will be performed when all the bits of modified d have been used.

Par rapport aux deux précédents modes de réalisation décrits, ce troisième mode de réalisation présente l'avantage d'être plus rapide, puisque, poureffectuer une randomisation, on choisit chaque fois le chemin le plus rapide (le moins coûteux). Ainsi, on montre expérimentalement que la complexité de ce procédé est d'environ 1.4. La complexité est le nombre moyen de multiplications de contenus de registres réalisées pour chaque bit de l'exposant d. La complexité d'un algorithme SAM non protégé est de 1.5; la complexité des procédés selon le premier ou le deuxième modes de réalisation de l'invention est quant à elle légèrement supérieure à 1.5.  Compared with the two previous embodiments described, this third embodiment has the advantage of being faster, since, to perform a randomization, we choose each time the fastest path (the least expensive). Thus, it is shown experimentally that the complexity of this process is about 1.4. Complexity is the average number of register contents multiplied for each bit of exponent d. The complexity of an unprotected SAM algorithm is 1.5; the complexity of the processes according to the first or second embodiments of the invention is in turn slightly greater than 1.5.

Par ailleurs, dans ce troisième mode de réalisation, la source d'aléatoirité (le nombre u) est extérieure au procédé. Enfin, les ressources (notamment le nombre de registres) utilisées sont les mêmes.  Moreover, in this third embodiment, the source of randomness (the number u) is external to the process. Finally, the resources (including the number of registers) used are the same.

15 20 25 30 Ce troisième mode de réalisation peut être concrétisé par l'algorithme IV suivant: Entrée. x, d = (dm,... , do)2 Paramètres: v, k Sortie: y = xAd mod N RO <- 1; R2 <- x; i <- m; L = {} tant que i 0, faire RO <- ROxRO mod N si di = 1 alors RO <- ROxR2 mod N fin si si i = m mod((m+l)/k)) alors a <- 1 fin si si a = 1 et L = {} alors (modification du nombre u en cours de procédé) a <- 0; u <- R{0, 2v-1} ; R1 = xAu mod N fin si w <- di->i-v+l h <- H (w) si w u alors A <- w-u; hp <- 1 + H(A) sinon hp <- v+2 fin si p <- R{0, 1} si [(a=0)n(i-v+l>_0)] A [ (h>ha) OU ((p=1) ET (h=ho)) ] alors (on choisit de réaliser x"(w-u)) di->i-v+1 <- A; L <- L u {i-v+l} fin si si (i E L) alors RO <- ROxRl mod N L <- L \{i} fin si i <- i-1 fin tant que retourner RO Dans cet exemple, l'ensemble L contient la liste des indices pour lesquels une étape de consolidation doit être réalisée. L'instruction "si di = 1 alors RO <- ROxR2 mod N fin si" est l'instruction classique d'un algorithme 5 SAM, réalisée pour chaque valeur de i.  This third embodiment can be embodied by the following algorithm IV: Input. x, d = (dm, ..., do) 2 Parameters: v, k Output: y = xAd mod N RO <- 1; R2 <- x; i <- m; L = {} as long as i 0, make RO <- ROxRO mod N if di = 1 then RO <- ROxR2 mod N end if if i = m mod ((m + l) / k)) then a <- 1 end if if a = 1 and L = {} then (modification of the number u during the process) a <- 0; u <- R {0, 2v-1}; R1 = xAu mod N fin if w <- di-> i-v + l h <- H (w) if w u then A <- w-u; hp <- 1 + H (A) else hp <- v + 2 end if p <- R {0, 1} if [(a = 0) n (i-v + l> _0)] A [(h> ha) OR ((p = 1) AND (h = ho))] then (one chooses to realize x "(wu)) di-> i-v + 1 <- A; L <- L u {i-v + l} end if si (i EL) then RO <- ROxRl mod NL <- L \ {i} end if i <- i-1 end as return RO In this example, set L contains the list of indices for which a consolidation step must be performed The instruction "if di = 1 then RO <- ROxR2 mod N end si" is the classical instruction of a SAM algorithm, performed for each value of i.

L'exposant d est ici découpé en k blocs, de taille identique si m+l est divisible par k ou de taille identique à une unité près sinon.  The exponent d is here cut into k blocks, of identical size if m + 1 is divisible by k or of identical size to a unit if not.

A chaque début de bloc (c'est à dire pour i = m mod((1+1)/k)), on met la variable a à 1. Ensuite, quand a vaut 1, il faut attendre que l'ensemble L soit vide avant d'effectuer une nouvelle étape de randomisation. A chaque étape de consolidation, on enlève un indice i(j) correspondant de l'ensemble L (instruction L <- L \{i}).  At each beginning of the block (that is to say for i = m mod ((1 + 1) / k)), we put the variable a to 1. Then, when a is worth 1, we must wait for the set L be empty before performing a new randomization step. At each consolidation stage, a corresponding index i (j) of the set L (instruction L <- L \ {i}) is removed.

Lorsque l'ensemble L est vidé, une nouvelle valeur de u peut être choisie et xAu est calculé par un algorithme SAM classique utilisant les registres Rl et R2.  When the set L is emptied, a new value of u can be chosen and xAu is calculated by a conventional SAM algorithm using registers R1 and R2.

Au milieu de chaque bloc (a = 0), on réalise une ou plusieurs étapes de randomisation, lorsque h>hA ou (p=1 et h = hA), et on mémorise à chaque fois (instruction L <- L U {i-v+l}) l'indice i(j)-v+l auquel on devra effectuer une étape de consolidation. Il faut donc que iv+l soit un indice de consolidation valable, c'est-à-dire que i-v+1 >_0 (condition de consistance). A chaque étape de randomisation, si h > hA, on choisit de réaliser l'opération xA(w-u)*xAu, moins coûteuse, et on modifie les bits de d en conséquence (di->i-v+1 <- A). Si h < hA, on choisit de réaliser xAw, moins coûteuse, et on ne modifie pas d. Si h = hA, on choisit aléatoirement (p = 0 ou 1 aléatoire) de réaliser x w-u)*xAu ou x'w.  In the middle of each block (a = 0), one or more randomization steps are performed, when h> hA or (p = 1 and h = hA), and are stored each time (instruction L <- LU {i- v + l}) the index i (j) -v + 1 to which we will have to carry out a consolidation step. It is therefore necessary that iv + 1 be a valid consolidation index, that is i-v + 1> _0 (consistency condition). At each randomization step, if h> hA, we choose to perform the operation xA (wu) * xAu, which is less expensive, and we modify the bits of d accordingly (di-> i-v + 1 <- A) . If h <hA, we choose to make xAw, less expensive, and we do not modify d. If h = hA, one chooses randomly (p = 0 or 1 random) to realize x w-u) * xAu or x'w.

A titre indicatif, on donne le nombre moyen de multiplications modulaires nécessaires pour réaliser une exponentiation de longueur 1024 avec l'algorithme SAM, protégé ou non: É SAM sans protection: 1536 multiplication É SAM protégé en ajoutant un multiple de c(n) (r.IV(n) avec r de 64 bits) ajouté à l'exposant d (art antérieur) : 1536 + 96 multiplications É SAM protégé selon l'algorithme II ou III. 1536 + 10 10 multiplications É SAM protégé selon l'algorithme I' 1536+512 multiplications. p, p étant la valeur moyenne de p É SAM protégé selon l'algorithme IV 1443 multiplications On constate par ces exemples qu'un algorithme protégé selon l'invention est très efficace, en terme de multiplications réalisées (et donc de temps de calcul).  As an indication, we give the average number of modular multiplications necessary to carry out an exponentiation of length 1024 with the SAM algorithm, protected or not: É SAM without protection: 1536 multiplication É SAM protected by adding a multiple of c (n) ( r.IV (n) with r of 64 bits) added to the exponent d (prior art): 1536 + 96 SAM multiplications protected according to algorithm II or III. 1536 + 10 10 SAM multiplications protected according to the algorithm I '1536 + 512 multiplications. p, p being the average value of p SAM protected by the algorithm IV 1443 multiplications It is found by these examples that a protected algorithm according to the invention is very efficient, in terms of multiplications (and therefore computing time) .

Claims (21)

REVENDICATIONS 1. Procédé cryptographique dans un composant électronique au cours duquel on réalise une exponentiation modulaire de type x^d, avec d un exposant entier de m+1 bits, en balayant les bits de d de gauche à droite dans une boucle indicée par i variant de m à 0 et en calculant et en mémorisant dans un accumulateur (RO), à chaque tour de rang i, un résultat partiel actualisé égal à x^b(i), b(i) étant les m-i+1 bits de poids les plus forts de l'exposant d (b(i) = dm_,i), le procédé étant caractérisé en ce que, à la fin d'un tour de rang i(j) (i = i(0)) choisi aléatoirement, on réalise une étape El de randomisation au cours de laquelle: E1 on soustrait un nombre z (z= b(i(j)), z = b (i (j)) . 2i, z = u) aléatoire à une partie des bits de d non encore utilisés (di-1->o) dans le procédé puis, après avoir utilisé les bits de d modifiés par l'étape de randomisation El, on réalise une étape de consolidation E2 au cours de laquelle: E2: on mémorise (RO <- R1xRO) dans l'accumulateur (RO) le résultat de la multiplication du contenu de l'accumulateur (x^b(i) ) par un nombre fonction de x^z mémorisé dans un registre (R1).  A cryptographic method in an electronic component in which a modular exponentiation of type x ^ d, with an integer exponent of m + 1 bits, is carried out by scanning the bits of d from left to right in a loop indexed by i varying from m to 0 and calculating and storing in an accumulator (RO), at each turn of rank i, an updated partial result equal to x ^ b (i), b (i) being the m-i + 1 bits of the strongest weight of the exponent d (b (i) = dm_, i), the method being characterized in that, at the end of a turn of rank i (j) (i = i (0)) chosen randomly, a randomization step E1 is carried out in which: E1 subtracts a number z (z = b (i (j)), z = b (i (j)); 2i, z = u) random at a part of the bits of d not yet used (di-1-> o) in the process then, after having used the bits of d modified by the randomization step E1, a consolidation step E2 is carried out during which: E2 : we memorize (RO <- R1xRO) d in the accumulator (RO) the result of the multiplication of the contents of the accumulator (x ^ b (i)) by a function number of x ^ z stored in a register (R1). 2. Procédé selon la revendication précédente, dans lequel l'étape El est répétée une ou plusieurs fois, à la fin de différents tours de rang i(j) (i = i(0), i = i(1), ...) choisis aléatoirement entre 0 et m.  2. Method according to the preceding claim, wherein step El is repeated one or more times, at the end of different rounds of rank i (j) (i = i (0), i = i (1), .. .) randomly selected between 0 and m. 2864390 26  2864390 26 3. Procédé selon la revendication précédente, dans lequel, à chaque tour i, on décide aléatoirement (p=1) si on réalise l'étape El ou pas.3. Method according to the preceding claim, wherein, at each turn i, it is decided randomly (p = 1) if step E1 is performed or not. 4. Procédé cryptographique selon l'une des revendications 1 à 3, dans lequel le nombre z (z= b(i(j)), z = b(i(j)).2'r) est fonction de l'exposant d, dans lequel, lors de l'étape de randomisation, on mémorise (R1 <- ROxRl) également dans un registre (R1) le résultat de la multiplication du contenu de l'accumulateur (x^b(i)) par le contenu du dit registre (R1).  4. Cryptographic method according to one of claims 1 to 3, wherein the number z (z = b (i (j)), z = b (i (j)). 2'r) is a function of the exponent d, in which, during the randomization step, the result of the multiplication of the content of the accumulator (x ^ b (i)) by the content is stored (R1 <- ROxRl) also in a register (R1). of said register (R1). 5. Procédé selon la revendication 4, dans lequel l'étape de consolidation E2 est réalisée après le dernier tour de rang i égal à 0.  5. Method according to claim 4, wherein the consolidation step E2 is performed after the last round of rank i equal to 0. 6. Procédé selon la revendication précédente, au cours duquel, lors de l'étape El, on soustrait à d le nombre b(i).  6. Method according to the preceding claim, during which, in step El, subtracting the number b (i) from d. 7. Procédé selon la revendication 6, au cours duquel, pour calculer y = x^d mod N, on réalise les étapes 20 suivantes: A: initialisation des registres RO, R1, R2 et d'une variable de boucle i: RO <- 1; R1 <- 1 R2 <x i <- m B: tant que i >_ 0, répéter les étapes suivantes: a: multiplication du contenu du registre RO par lui-même modulo N et mémorisation du résultat dans le registre RO RO <- ROxRO mod N b: si di = 1 alors multiplication du contenu du registre RO par le contenu du registre R2 modulo N et mémorisation du résultat dans RO si di = 1 alors RO <- ROxR2 mod N c. choix aléatoire d'une valeur de la variable p parmi deux valeurs, 0 et 1 p <- R{0, 1} 30 d: si ((p = 1) ET di-l_>o dm-i alors aa: soustraction des bits de rangs i à m de la variable d à la variable d et mémorisation dans la variable d d d - dm_>i bb: multiplication du contenu du registre R1 par le contenu du registre RO modulo N et mémorisation du résultat dans R1 R1 <- RlxRO mod N fin si e: décrémentation de la variable i: i < i-1 fin tant que C: multiplication du contenu du registre RO par le contenu du registre R1 modulo N et mémorisation du résultat dans RO RO <- ROxR1 mod N 15 D: retourner RO  7. The method according to claim 6, in which, to calculate y = x ^ d mod N, the following steps are carried out: A: initialization of the registers RO, R1, R2 and of a loop variable i: RO < - 1; R1 <- 1 R2 <xi <- m B: while i> _ 0, repeat the following steps: a: multiplication of the contents of the register RO by itself modulo N and storage of the result in the register RO RO <- ROxRO mod N b: if di = 1 then multiplication of the content of the register RO by the contents of the register R2 modulo N and storage of the result in RO if di = 1 then RO <- ROxR2 mod N c. random choice of a value of the variable p among two values, 0 and 1 p <- R {0, 1} 30 d: if ((p = 1) AND di-l_> o dm-i then aa: subtraction of bits of ranks i to m of the variable d to the variable d and storage in the variable ddd - dm_> i bb: multiplication of the contents of the register R1 by the contents of the register RO modulo N and storage of the result in R1 R1 <- RlxRO mod N end if e: decrementation of the variable i: i <i-1 end as long as C: multiplication of the contents of the register RO by the contents of the register R1 modulo N and storage of the result in RO RO <- ROxR1 mod N 15 D : return RO 8. Procédé selon la revendication 5, au cours duquel l'étape El est modifiée comme suit: E1. on soustrait à d un nombre égal à g.b(i), g étant un nombre entier positif; on élève le résultat partiel actuel (x^b(i)) à la puissance g et on mémorise le résultat dans le registre (R1) .The method of claim 5, wherein step E1 is modified as follows: E1. subtracting from a number equal to g.b (i), g being a positive integer; the current partial result (x ^ b (i)) is raised to the power g and the result is stored in the register (R1). 9. Procédé selon la revendication précédente, dans lequel g est égal à 21, ti étant un nombre aléatoire choisi entre 0 et T.  9. Method according to the preceding claim, wherein g is equal to 21, ti being a random number selected from 0 and T. 10. Procédé selon la revendication précédente, dans lequel, pour calculer y = x^d mod N, on réalise: A: initialisation des registres RO, R1, R2 et d'une variable de boucle i: RO <- 1; R1 <- 1; R2 <- x i <- m B: tant que i ? 0, faire: a: multiplication du contenu du registre RO par lui-même modulo N et mémorisation du résultat dans le registre RO RO <- ROxRO mod N b: si di = 1 alors multiplication du contenu du registre RO par 35 le contenu du registre R2 modulo N et mémorisation du résultat dans RO si di = 1 alors RO <- ROxR2 mod N 10 15 25 c: choix aléatoire d'une valeur de la variable p parmi deux valeurs, 0 et 1: p <- R{0, 1} ; d: choix aléatoire d'une valeur de la variable t parmi les valeurs 0, .. , T: ti <- R{O, T} e: si ((p = 1) ET (di-1_ti dm-i)) alors aa: soustraction des bits de rangs i à m de la variable d aux bits de rangs t à i-1 de la variable d et mémorisation dans les bits de rangs t à i-1 de la variable la variable d di-1-ti _ dm->i bb: mémorisation du registre RO dans le registre R3: R3 <RO cc: tant que (t > 0), élever au carré modulo N le contenu du registre R3, mémoriser loe résultat dans R3 et décrémenter la variable ti tant que (t > 0) faire R3 <- R3 '2 mod N; t <- t-1 fin tant que dd: multiplication du contenu du registre R1 par le contenu du registre R3 modulo N et mémorisation du résultat dans le registre R1 R1 <- R1xR3 mod N fin si f: décrémenter la variable i i <- i-1 fin tant que C: multiplication du contenu du registre RO par le contenu du registre R1 modulo N et mémorisation du résultat dans le registre RO RO <- ROxRl mod N D: retourner RO10. Method according to the preceding claim, wherein, to calculate y = x ^ d mod N, one carries out: A: initialization of the registers RO, R1, R2 and a loop variable i: RO <- 1; R1 <- 1; R2 <- x i <- m B: as long as i? 0, do: a: multiplication of the contents of the register RO by itself modulo N and storage of the result in the register RO RO <- ROxRO mod N b: if di = 1 then multiplication of the contents of the register RO by 35 the contents of the register R2 modulo N and storing the result in RO if di = 1 then RO <- ROxR2 mod N 10 15 25 c: random choice of a value of the variable p among two values, 0 and 1: p <- R {0 , 1}; d: random choice of a value of the variable t among the values 0, .., T: ti <- R {O, T} e: if ((p = 1) AND (di-1_ti dm-i)) then aa: subtraction of the bits of ranks i to m from the variable d to the bits of ranks t to i-1 of the variable d and storage in the bits of ranks t to i-1 of the variable the variable d di-1- ti _ dm-> i bb: storage of the register RO in the register R3: R3 <RO cc: as long as (t> 0), squaring modulo N the contents of the register R3, memorize the result in R3 and decrement the variable ti as long as (t> 0) make R3 <- R3 '2 mod N; t <- t-1 end as dd: multiplication of the contents of the register R1 by the contents of the register R3 modulo N and storage of the result in the register R1 R1 <- R1xR3 mod N end if f: decrement the variable ii <- i -1 end as C: multiplication of the contents of the register RO by the contents of the register R1 modulo N and storage of the result in the register RO RO <- ROxRl mod ND: return RO 11. Procédé selon l'une des revendications 1 à 4, dans lequel l'étape de consolidation E2 est réalisée à la fin du rang utilisant le dernier bit de d modifié lors de l'étape El.11. Method according to one of claims 1 to 4, wherein the consolidation step E2 is performed at the end of the rank using the last bit of d modified in step El. 12. Procédé selon la revendication 11, au cours duquel, lors de l'étape El, on soustrait le nombre b(i) aux bits de d de rang i (j) - c(j) à i (j) -1, c(j) étant un nombre entier et on mémorise le contenu de l'accumulateur (x^b(i(j)) dans le registre (R1).  12. The method according to claim 11, during which step E1 subtracts the number b (i) from the bits of d of rank i (j) -c (j) to i (j) -1. c (j) being an integer and storing the contents of the accumulator (x ^ b (i (j)) in the register (R1). 13. Procédé selon la revendication précédente, au cours duquel, lors du tour de rang i(j+1), on choisit 5 aléatoirement de réaliser l'étape El uniquement si i(j+l) i(j)-c(j). (a = 1 sémaphore libre).  13. Method according to the preceding claim, in which, during the turn of rank i (j + 1), one selects randomly to perform the step El only if i (j + 1) i (j) -c (j ). (a = 1 free semaphore). 14. Procédé selon la revendication 12 ou 13, dans lequel c(j) est égal à m-i(j)+1.  The method of claim 12 or 13, wherein c (j) is equal to m-i (j) +1. 15. Procédé selon la revendication précédente, au cours 10 duquel, pour calculer Y = x^d mod N, on réalise les étapes suivantes: A: initialisation des registres RO, Ri, R2 et des variables i, c, a: RO <- 1; R1 <- 1; R2 <x; i <- m; c <- -1; a <- 1 15 B tant que i >_ 0, faire: a: multiplication du contenu du registre RO par lui-même modulo N et mémorisation du résultat dans le registre RO RO <- ROxRO mod N b: si di = 1 alors multiplication du contenu du registre R2 par 20 le contenu du registre RO modulo N et mémorisation du résultat dans le registre RO si di = 1 alors RO <- ROxR2 mod N fin si c si (2i >- m+l) ET (a = 1) alors mise à jour de la variable c, sinon mise à zéro de la variable a si (2i > _ m+l) ET (a = 1) alors c <- m-i+1 sinon a = 0 fin si d. choix aléatoire d'une valeur de la variable P parmi deux valeurs, 0 et 1: p <- R{O, 1} e: mise à jour de la variable E E <- p ET (di-i -> i-c dm->i) ET a f: si e = 1 alors mémorisation du registre RO dans le registre R1, mise à zéro de la variable a, soustraction des bits de rangs i à m de la variable d aux bits de rangs i-c à i-1 de la variable d et mémorisation du résultat dans les bits de rangs i-c à i-1 de la variable d 35 si e = 1 alors R1 <- RO; 6 <0 i-c i-c - dm -> i fin si g: si c = 0 alors multiplication du contenu du registre R1 par le contenu du registre RO modulo N et mémorisation du résultat dans le registre RO; mise à 1 de la variable a si c = 0 alors RO <- ROxRl mod N; a <- 1 10 fin si h: décrémentation des variables c et i c <- c-1; i <- i-1 fin tant que C retourner RO  15. Method according to the preceding claim, in which, to calculate Y = x ^ d mod N, the following steps are performed: A: initialization of the registers RO, Ri, R2 and variables i, c, a: RO < - 1; R1 <- 1; R2 <x; i <- m; c <-1; a <- 1 15 B as i> _ 0, do: a: multiplication of the contents of the register RO by itself modulo N and storage of the result in the register RO RO <- ROxRO mod N b: if di = 1 then multiplying the content of the register R2 by 20 the content of the register RO modulo N and storing the result in the register RO if di = 1 then RO <- ROxR2 mod N end if c if (2i> - m + 1) AND (a = 1) then update the variable c, otherwise set to zero of the variable a if (2i> _ m + l) AND (a = 1) then c <- m-i + 1 otherwise a = 0 end if d . random choice of a value of the variable P among two values, 0 and 1: p <- R {O, 1} e: update of the variable EE <- p AND (di-i -> ic dm-> i) AND af: if e = 1 then storage of the register RO in the register R1, setting the variable a to zero, subtraction of the bits of ranks i to m from the variable d to the bits of ranks ic to i-1 of the variable d and storing the result in the bits of ranks ic to i-1 of the variable d 35 if e = 1 then R1 <- RO; 6 <0 i-c i-c - dm -> i end if g: if c = 0 then multiplication of the contents of the register R1 by the contents of the register RO modulo N and storage of the result in the register RO; set 1 of the variable a if c = 0 then RO <- ROxRl mod N; a <- 1 10 end if h: decrementation of the variables c and i c <- c-1; i <- i-1 end as long as C return RO 16. Procédé selon la revendication 12 ou 13, dans lequel c(j) est choisi aléatoirement entre i(j) et m-i(j)+1.The method of claim 12 or 13, wherein c (j) is randomly selected from i (j) and m-i (j) +1. 17. Procédé selon la revendication précédente, au cours duquel, pour calculer y = x^d mod N, on réalise: A: initialisation des registres RO, R1, R2 et des variables de boucle 20 c, a: RO <- 1; R1 <- 1; R2 <- x; i <m; c <- -1; 6 <- 1 B: tant que i 0, faire: a: multiplication du contenu du registre RO par lui-même modulo N 25 et mémorisation du résultat dans le registre RO RO <- ROxRO mod N b: si di = 1 alors multiplication du contenu du registre R2 par le contenu du registre RO modulo N et mémorisation du résultat dans le registre RO si di = 1 alors RO <- ROxR2 mod N c: si (2i >- m+1) ET (a = 1) alors choix d'une valeur de c aléatoirement parmi les entiers compris entre m-i+l et i, sinon mise à zéro de la variable a si (2i >_ m+1) ET (a = 1) alors c <- R{m-i+1, ..., i} sinon 6 = 0 d: mise à jour de la variable c E <- p ET (di-1 -> i-c dm-> i) ET a e: si s = 1 alors mémorisation de RO dans R1, mise à zéro de a, soustraction des bits de rangs i à m de la variable d aux bits de rangs i- c à i-1 de la variable d et mémorisation du résultat dans les bits de rangs i-c à i-1 de la variable d si e = 1 alors Ri <- RO; 6 <- 0 di-1 -> i-c <- di-1 -> i-c dm -> i fin si f: si c = 0 alors multiplication du contenu du registre R1 par le 10 contenu du registre RO modulo N, mémorisation du résultat dans le registre RO, et mise à 1 de la variable a si c = 0 alors RO <- ROxRl mod N; a <- 1 fin si g: décrémentation des variables c, i c <- c-1; i <i-i fin tant que C: retourner RO  17. Method according to the preceding claim, wherein, to calculate y = x ^ d mod N, one carries out: A: initialization of the registers RO, R1, R2 and loop variables c, a: RO <- 1; R1 <- 1; R2 <- x; i <m; c <-1; 6 <- 1 B: while i 0, do: a: multiplication of the contents of the register RO by itself modulo N 25 and storage of the result in the register RO RO <- ROxRO mod N b: if di = 1 then multiplication of the contents of the register R2 by the contents of the register RO modulo N and storage of the result in the register RO if di = 1 then RO <- ROxR2 mod N c: if (2i> - m + 1) AND (a = 1) then choosing a value of c randomly from among the integers between m-i + 1 and i, otherwise setting to zero the variable a if (2i> _ m + 1) AND (a = 1) then c <- R { m-i + 1, ..., i} else 6 = 0 d: update of the variable c E <- p AND (di-1 -> ic dm-> i) ANDe: if s = 1 then storing of RO in R1, zeroing of a, subtraction of bits of ranks i to m from variable d to bits of ranks i-c to i-1 of variable d and storing the result in bits of ranks ic to i-1 of the variable d if e = 1 then Ri <- RO; 6 <- 0 di-1 -> ic <- di-1 -> ic dm -> end if f: if c = 0 then multiplication of the contents of the register R1 by the contents of the register RO modulo N, storage of the result in the register RO, and set to 1 of the variable a if c = 0 then RO <- ROxRl mod N; a <- 1 end if g: decrementation of the variables c, i c <- c-1; i <i-i end as C: return RO 18. Procédé selon l'une des revendications 1 à 2, dans 20 lequel le nombre z est un nombre u (z = u) de v bits choisi aléatoirement et indépendant de l'exposant d.18. Method according to one of claims 1 to 2, wherein the number z is a number u (z = u) of v bits randomly selected and independent of the exponent d. 19. Procédé selon la revendication précédente, dans lequel, au cours de l'étape El, le nombre u est soustrait à un paquet w de v bits de d.  19. The method according to the preceding claim, wherein, during step El, the number u is subtracted from a packet w of v bits of d. 20. Procédé selon la revendication précédente, au cours duquel: É si H(w-u) + 1 < H(w), on choisit de réaliser une étape El de randomisation, É si H(w-u) + 1 > H(w), on choisit de ne pas réaliser 30 d'étape El, É si H(w-1) + 1 = H(w), on choisit aléatoirement de réaliser ou non une étape El de randomisation.  20. Method according to the preceding claim, in which: E if H (wu) + 1 <H (w), it is chosen to perform a randomization step E, E if H (wu) + 1> H (w), it is chosen not to carry out a step E1, E if H (w-1) + 1 = H (w), one randomly chooses to perform or not a randomization step E1. 21. Procédé selon la revendication précédente, au cours duquel, v, k étant des paramètres et x, d des données 35 d'entrée, pour calculer y = x^d mod N, on réalise: 10 20 25 30 A: initialisation des registres RO, R2, de la variable de boucle i et de l'ensemble L: RO <- 1; R2 <- x; i <- m; L = { } B tant que i >_ 0, faire a: multiplication du contenu du registre RO par lui-même modulo N et mémorisation du résultat dans le registre RO RO <ROxRO mod N b: si di = 1 alors multiplication du contenu du registre R2 par le contenu du registre RO modulo N et mémorisation du résultat dans le registre RO si di = 1 alors RO <- ROxR2 mod N fin si c: si i = m mod((m+1)/k)) alors mise à 1 de la variable a si i = m mod((m+l) /k)) alors a <- 1 fin si d: si a = 1 et L = {} alors mise à zéro de la variable s, choix aléatoire de la variable u dans l'ensemble {0, 2v-1}, élévation de la donnée x à la puissance u modulo N et mémorisation du résultat dans le registre R1 si a = 1 et L = {} alors s <- 0; u <- R{0, .. ., 2v-1} ; R1 = x^u mod N fin si e: mémorisation des bits de rangs i-v+l à i de la variable d dans la variable w w <- di->i-v+1 f: mémorisation du poids de Hamming de la variable w dans la variable h h <- H(w) g: si w ? u alors soustraction de u à la variable w et mémorisation dans la variable p, mémorisation du poids de Hamming de la variable p incrémenté de 1 dans la variable hA, sinon mémorisation de la variable v incrémentée de 2 dans la variable hA si w >_ u alors <- w-u; h8 <- 1 + H(A) sinon h0 <- v+2 fin si h: choix aléatoire de la variable u dans l'ensemble {0, 1), p <- R{0, 1} i si [(a=O)n(i-v+1>-0)] n [(h>hp)OU((p=1)ET(h=hp))] alors mémorisation de p dans les bits de rangs i-v+l à i de la variable d, ajout de la 40 valeur i-v+l à l'ensemble L si [(a=O)n(i-v+1>_0)] n [(h>hp)OU((p=1)ET(h=hp))] alors di->i-v+l <- ; L <- L u { i-v+1} 33 fin si j: si (i L) alors multiplication du contenu du registre R1 par le contenu du registre RO modulo N, mémorisation du résultat dans le registre RO, enlèvement de la valeur i à l'ensemble L si (i e L) alors RO <- ROxRl mod N L <- L \{i} fin si k: décrémentation de la variable i i <- 1-1 fin tant que C: retourner RO  21. The method according to the preceding claim, in which, v, k being parameters and x, d input data, for calculating y = x ^ d mod N, the following is carried out: registers RO, R2, of the loop variable i and of the set L: RO <- 1; R2 <- x; i <- m; L = {} B as long as i> _ 0, do a: multiplication of the contents of the register RO by itself modulo N and storage of the result in the register RO RO <ROxRO mod N b: if di = 1 then multiplication of the content of the register R2 by the contents of the register RO modulo N and storage of the result in the register RO if di = 1 then RO <- ROxR2 mod N fin if c: if i = m mod ((m + 1) / k)) then set 1 of the variable a if i = m mod ((m + 1) / k)) then a <- 1 end if d: if a = 1 and L = {} then set to zero of the variable s, choice random of the variable u in the set {0, 2v-1}, elevation of the data x to the power u modulo N and storage of the result in the register R1 if a = 1 and L = {} then s <- 0 ; u <- R {0, ..., 2v-1}; R1 = x ^ u mod N end if e: memorization of the bits of ranks i-v + l to i of the variable d in the variable ww <- di-> i-v + 1 f: storage of the Hamming weight of the variable w in the variable hh <- H (w) g: if w? u then subtraction of u to the variable w and storage in the variable p, storage of the Hamming weight of the variable p incremented by 1 in the variable hA, otherwise storage of the variable v incremented by 2 in the variable hA if w> _ u then <- wu; h8 <- 1 + H (A) else h0 <- v + 2 end if h: random choice of the variable u in the set {0, 1), p <- R {0, 1} i if [(a = O) n (i-v + 1> -0)] n [(h> hp) OR ((p = 1) AND (h = hp))] then storage of p in the bits of ranks i-v + 1 to i of the variable d, adding the value i-v + 1 to the set L if [(a = 0) n (i-v + 1> _0)] n [(h> hp) OR ( (p = 1) AND (h = hp))] then di-> i-v + 1 <-; L <- L u {i-v + 1} 33 end if j: if (i L) then multiplication of the contents of the register R1 by the contents of the register RO modulo N, storage of the result in the register RO, removal of the value i to the set L if (ie L) then RO <- ROxRl mod NL <- L \ {i} end if k: decrementation of the variable ii <- 1-1 end as C: return RO
FR0314959A 2003-12-19 2003-12-19 CRYPTOGRAPHIC METHOD OF MODULAR EXPONENTIATION PROTECTED AGAINST DPA ATTACKS. Expired - Fee Related FR2864390B1 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
FR0314959A FR2864390B1 (en) 2003-12-19 2003-12-19 CRYPTOGRAPHIC METHOD OF MODULAR EXPONENTIATION PROTECTED AGAINST DPA ATTACKS.
PCT/EP2004/053472 WO2005069122A2 (en) 2003-12-19 2004-12-14 Method for modular exponentiation, protected against dpa-type attacks
EP04804829A EP1695204A2 (en) 2003-12-19 2004-12-14 Cryptographic method for modular exponentiation, protected against DPA-type attacks
CN 200480041877 CN1918543A (en) 2003-12-19 2004-12-14 Cryptographic method for modular exponentiation, protected against dpa-type attacks

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
FR0314959A FR2864390B1 (en) 2003-12-19 2003-12-19 CRYPTOGRAPHIC METHOD OF MODULAR EXPONENTIATION PROTECTED AGAINST DPA ATTACKS.

Publications (2)

Publication Number Publication Date
FR2864390A1 true FR2864390A1 (en) 2005-06-24
FR2864390B1 FR2864390B1 (en) 2006-03-31

Family

ID=34630319

Family Applications (1)

Application Number Title Priority Date Filing Date
FR0314959A Expired - Fee Related FR2864390B1 (en) 2003-12-19 2003-12-19 CRYPTOGRAPHIC METHOD OF MODULAR EXPONENTIATION PROTECTED AGAINST DPA ATTACKS.

Country Status (4)

Country Link
EP (1) EP1695204A2 (en)
CN (1) CN1918543A (en)
FR (1) FR2864390B1 (en)
WO (1) WO2005069122A2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007006810A1 (en) * 2005-07-13 2007-01-18 Gemplus Cryptographic method for securely implementing an exponentiation and related component

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5482048B2 (en) * 2009-09-18 2014-04-23 ソニー株式会社 Integrated circuits and electronic equipment
FR2972064B1 (en) * 2011-02-25 2013-03-15 Inside Secure CRYPTOGRAPHY METHOD COMPRISING AN EXPONENTIATION OPERATION

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001031436A1 (en) * 1999-10-28 2001-05-03 Bull Cp8 Security method for a cryptographic electronic assembly based on modular exponentiation against analytical attacks
FR2829646A1 (en) * 2001-09-07 2003-03-14 Gemplus Card Int Cryptography method, especially for use with a smart card, provides protection against side channel attacks by use of various exponentiation algorithms that serve to protect the exponentiation factor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001031436A1 (en) * 1999-10-28 2001-05-03 Bull Cp8 Security method for a cryptographic electronic assembly based on modular exponentiation against analytical attacks
FR2829646A1 (en) * 2001-09-07 2003-03-14 Gemplus Card Int Cryptography method, especially for use with a smart card, provides protection against side channel attacks by use of various exponentiation algorithms that serve to protect the exponentiation factor

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CHEVALLIER-MAMES B: "Self-randomized exponentiation algorithms", TOPICS IN CRYPTOLOGY - CT-RSA 2004. PROCEEDINGS. SPRINGER-VERLAG, LECTURE NOTES IN COMPUTER SCIENCE, vol. 2964, 27 February 2004 (2004-02-27), BERLIN, GERMANY, pages 236 - 249, XP002297836, ISBN: 3-540-20996-4 *
ITOH K ET AL: "DPA COUNTERMEASURES BY IMPROVING THE WINDOW METHOD", CRYPTOGRAPHIC HARDWARE AND EMBEDDED SYSTEMS. INTERNATIONAL WORKSHOP, XX, XX, 13 August 2002 (2002-08-13), pages 303 - 317, XP001160529 *
JOYE M: "Recovering lost efficiency of exponentiation algorithms on smart cards", ELECTRONICS LETTERS, IEE STEVENAGE, GB, vol. 38, no. 19, 12 September 2002 (2002-09-12), pages 1095 - 1097, XP006019065, ISSN: 0013-5194 *
WALTER C D: "MIST: AN EFFICIENT, RANDOMIZED EXPONENTIATION ALGORITHM FOR RESISTING POWER ANALYSIS", LECTURE NOTES IN COMPUTER SCIENCE, SPRINGER VERLAG, NEW YORK, NY, US, vol. 2271, 18 February 2002 (2002-02-18), pages 53 - 66, XP008004946, ISSN: 0302-9743 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007006810A1 (en) * 2005-07-13 2007-01-18 Gemplus Cryptographic method for securely implementing an exponentiation and related component
FR2888690A1 (en) * 2005-07-13 2007-01-19 Gemplus Sa CRYPTOGRAPHIC PROCESS FOR THE SECURE IMPLEMENTATION OF AN EXPONENTIATION AND ASSOCIATED COMPONENT

Also Published As

Publication number Publication date
CN1918543A (en) 2007-02-21
WO2005069122A3 (en) 2006-06-01
WO2005069122A2 (en) 2005-07-28
EP1695204A2 (en) 2006-08-30
FR2864390B1 (en) 2006-03-31

Similar Documents

Publication Publication Date Title
EP2946284B1 (en) Cryptography method comprising an operation of multiplication by a scalar or an exponentiation
EP1757009B1 (en) Method and device for carrying out a cryptographic calculation
EP1358732B2 (en) Secure encryption method and component using same
EP1969459A1 (en) Cryptographic method comprising a modular exponentiation secured against hidden-channel attacks, cryptoprocessor for implementing the method and associated chip card
FR2789535A1 (en) METHOD FOR SECURING AN ELECTRONIC SECRET KEY CRYPTOGRAPHY ASSEMBLY AGAINST PHYSICAL ANALYSIS ATTACKS
FR2791497A1 (en) COUNTERMEASURE METHODS IN AN ELECTRONIC COMPONENT USING AN ELLIPTICAL CURVE TYPE CURRENT CRYSTOGRAPHY ALGORITHM
WO2009003740A1 (en) Montgomξry-based modular exponentiation secured against hidden channel attacks
WO2001093014A1 (en) Countermeasure method in an electronic component using a public key encryption algorithm on elliptic curve
EP1381936B1 (en) Countermeasure method in an electronic component using a public key cryptographic algorithm on an elliptic curve
WO2000059157A1 (en) Countermeasure method in an electric component implementing an elliptical curve type public key cryptography algorithm
CA2712180A1 (en) Countermeasure method and devices for asymmetrical cryptography with signature diagram
FR2888690A1 (en) CRYPTOGRAPHIC PROCESS FOR THE SECURE IMPLEMENTATION OF AN EXPONENTIATION AND ASSOCIATED COMPONENT
FR2884088A1 (en) METHOD AND CRYPTOGRAPHIC DEVICE FOR PROTECTING THE LOGIC OF PUBLIC KEYS AGAINST FAULT ATTACKS
EP1224765B1 (en) Countermeasure method in an electronic component which uses an rsa-type public key cryptographic algorithm
FR2864390A1 (en) Cryptographic process for e.g. message encryption and decryption, involves scanning bits of preset value from left to right in loop, and calculating and storing partial updated result equal to exponentiation in accumulator
EP1639451A2 (en) Method for countermeasuring by masking the accumulator in an electronic component while using a public key cryptographic algorithm
EP3840282A1 (en) Cryptographic processing method, associated electronic device and computer program
FR2942560A1 (en) Data processing method for securing Rivest Shamir Adleman cryptographic algorithms on chip card, involves testing relation between values by comparing values with neutral element of finite group based on internal rule of finite group
FR2976101A1 (en) METHOD FOR CRYPTOGRAPHIC DATA PROCESSING
WO2004111833A1 (en) Method for countermeasuring in an electronic component
EP3929726A1 (en) Cryptographic processing method, associated electronic device and computer program
US11973866B2 (en) Cryptographic processing method, related electronic device and computer program
EP4270855A1 (en) Protection against side-channel attacks using square masking
FR3094522A1 (en) Protection of an iterative calculation
FR2843507A1 (en) Modular exponentiation method for public key cryptography applications, especially for chip card implementation, whereby the method is suitable for parallel processor use and employs multiplier and multiplicand registers

Legal Events

Date Code Title Description
ST Notification of lapse

Effective date: 20081020