PROCEDE DE CALCUL D'UNE DONNEE DE CONTROLE DE CLE CRYPTOGRAPHIQUE METHOD FOR CALCULATING CRYPTOGRAPHIC KEY CONTROL DATA
L'invention concerne un procédé de calcul d'une donnée de contrôle pour algorithme cryptographique à clé secrète. Une telle donnée de contrôle est essentiellement utilisée dans le cadre de l'algorithme DES (de l'anglais Data Encryption Standard), elle est alors connue sous le terme anglais de « checksum » et consiste à attacher des valeurs spécifiques redondantes à la clé secrète. Le procédé selon l'invention est basé sur le calcul d'une donnée de contrôle à partir d'un message déterminé (connu et préférentiellement constant) . Dans la suite du texte, on utilisera le terme usuel de checksum pour désigner cette donnée de contrôle .The invention relates to a method for calculating control data for a secret key cryptographic algorithm. Such control data is essentially used within the framework of the DES (Data Encryption Standard) algorithm, it is then known by the English term of “checksum” and consists in attaching specific redundant values to the secret key. . The method according to the invention is based on the calculation of control data from a determined message (known and preferably constant). In the rest of the text, the usual term checksum will be used to denote this control datum.
La présente invention concerne plus spécifiquement l'algorithme DES qui est en effet le seul algorithme à clé secrète actuellement connu qui utilise un calcul de checksum, objet de l'invention.The present invention relates more specifically to the DES algorithm which is in fact the only secret key algorithm currently known which uses a checksum calculation, object of the invention.
Le DES est un des algorithmes cryptographiques à clé secrète les plus connus et les plus utilisés. Un tel algorithme est dit symétrique car il exploite une unique clé de 64 bits, secrète et réversible pour chiffrer et déchiffrer des données.DES is one of the best known and most used secret key cryptographic algorithms. Such an algorithm is said to be symmetrical because it uses a single 64-bit, secret and reversible key to encrypt and decrypt data.
Plus spécifiquement, le DES comporte une clé de 64 bits secrets dont 56 sont des bits de chiffrement (et déchiffrement) aléatoires et 8 sont des bits de checksum. En fonctionnement, le DES génère 16 sous-clés de 48 bits à partir des 56 bits aléatoires. Ainsi, dans chacun des 8 octets de la clé du DES, les 7 premiers sont aléatoires et utilisés pour calculer les sous- clés, et le dernier bit fait partie de la checksum. En général, les bits de cette checksum sont des bits de
parité, c'est à dire qu'ils sont calculés par une opération de « ou exclusif » sur les 7 premiers bits de chaque octet .More specifically, the DES includes a secret 64-bit key, 56 of which are random encryption (and decryption) bits and 8 are checksum bits. In operation, the DES generates 16 48-bit subkeys from the 56 random bits. Thus, in each of the 8 bytes of the DES key, the first 7 are random and used to calculate the subkeys, and the last bit is part of the checksum. In general, the bits of this checksum are bits of parity, ie they are calculated by an "or exclusive" operation on the first 7 bits of each byte.
La checksum est essentiellement utilisée pour protéger la clé du DES contre des attaques mémoires ou DFA (de l'Anglais Differential Fault Attack) qui consistent à modifier un par un les bits de la clé pour tenter de la déterminer. Par exemple, les bits à 1 sont forcés à 0, un par un, et le DES est utilisé avec ces modifications pour chiffrer le même message jusqu'à ce que tous les bits de la clé soient à zéro (le message chiffré est alors constant) . On remonte alors la chaîne des messages chiffrés et on peut ainsi parvenir à déterminer quels étaient les bits à 1 dans la clé initiale.The checksum is essentially used to protect the key of the DES against memory attacks or DFA (of the English Differential Fault Attack) which consist in modifying one by one the bits of the key to try to determine it. For example, bits at 1 are forced to 0, one by one, and DES is used with these modifications to encrypt the same message until all the bits of the key are at zero (the encrypted message is then constant ). We then go back up the chain of encrypted messages and we can thus succeed in determining which bits were 1 in the initial key.
La checksum permet d'éviter de telles attaques. On peut en effet recalculer régulièrement la checksum (composée classiquement des bits de parité) et détecter ainsi une modification d'un ou plusieurs des bits de la clé.The checksum makes it possible to avoid such attacks. It is indeed possible to regularly recalculate the checksum (conventionally composed of parity bits) and thus detect a modification of one or more of the bits of the key.
En revanche, la connaissance de la checksum peut laisser filtrer des informations sur les bits de chiffrement de la clé, en révélant si le nombre de bits à 1 est pair ou impair dans chaque octet . L'objectif de la présente invention est de résoudre cet inconvénient et de proposer un procédé de calcul d'une checksum qui ne divulgue aucune information sur les bits secrets de la clé.On the other hand, knowledge of the checksum can allow information to be filtered on the encryption bits of the key, by revealing whether the number of bits at 1 is even or odd in each byte. The objective of the present invention is to solve this drawback and to propose a method of calculating a checksum which does not disclose any information on the secret bits of the key.
A cette fin, le procédé propose de construire une checksum à partir d'un message déterminé, encodé à l'aide des seuls bits de chiffrement de la clé, et d' intégrer les bits de cette checksum aux bits de chiffrement de la clé pour reconstituer une clé complète. L'algorithme sera ensuite utilisé selon un
fonctionnement classique avec une clé composée des bits de chiffrement aléatoires et de cette checksum construite.To this end, the method proposes to construct a checksum from a determined message, encoded using only the encryption bits of the key, and to integrate the bits of this checksum with the encryption bits of the key for reconstitute a complete key. The algorithm will then be used according to a classic operation with a key composed of random encryption bits and this constructed checksum.
L'invention a plus particulièrement pour objet un procédé de calcul d'une donnée de contrôle d'un algorithme à clé secrète à N bits, dont N-N/n bits aléatoires de chiffrement et N/n bits de donnée de contrôle, caractérisé en ce qu'il comporte les étapes suivantes : - chiffrer un message déterminé de K bits à l'aide des N-N/n bits de chiffrement de la clé, construire une donnée de contrôle en sélectionnant N/n bits parmi les K bits du message chiffré, - intégrer un des N/n bits de ladite donnée de contrôle tous les n-1 bits de chiffrement de la clé de manière à constituer une clé secrète complète de N bits. Selon une caractéristique, le message déterminé est un message constant .A more particular subject of the invention is a method for calculating control data of an N-bit secret key algorithm, including NN / n random encryption bits and N / n control data bits, characterized in that that it comprises the following steps: - encrypt a determined message of K bits using the NN / n encryption bits of the key, construct a control datum by selecting N / n bits from the K bits of the encrypted message, - integrate one of the N / n bits of said control data item every n-1 encryption bits of the key so as to constitute a complete secret key of N bits. According to one characteristic, the determined message is a constant message.
Selon une particularité, les K bits d'entrée du message constant ont la même valeur.According to a particular feature, the K input bits of the constant message have the same value.
Selon une autre caractéristique, la donnée de contrôle est composée des N/n premiers bits du message chiffré.According to another characteristic, the control datum is composed of the first N / n bits of the encrypted message.
Selon une caractéristique, K est égal à N. Selon une application préférentielle, l'algorithme à clé secrète est le DES, ladite clé ayant 64 bits, dont 56 bits de chiffrement et 8 bits de donnée de contrôle .According to one characteristic, K is equal to N. According to a preferred application, the secret key algorithm is the DES, said key having 64 bits, including 56 encryption bits and 8 bits of control data.
Selon une caractéristique, l'algorithme à clé secrète étant implémenté dans un composant électronique, la construction de la donnée de contrôle est effectuée une seule fois par clé, lors de la
fabrication du composant électronique ou lors de la première utilisation du composant électronique avec une clé donnée .According to one characteristic, the secret key algorithm being implemented in an electronic component, the construction of the control data is carried out only once per key, during the manufacture of the electronic component or when using the electronic component for the first time with a given key.
Selon une caractéristique, le procédé consiste en outre à vérifier l'intégrité de la clé secrète complète en comparant une donnée de contrôle recalculée, à partir du même message déterminé, avec la donnée de contrôle construite.According to one characteristic, the method also consists in verifying the integrity of the complete secret key by comparing a recalculated control datum, from the same determined message, with the constructed control datum.
Selon une caractéristique, la vérification de la donnée de contrôle est réalisée à chaque mise sous tension du composant électronique.According to one characteristic, the verification of the control data is carried out each time the electronic component is powered up.
Selon une autre caractéristique, la vérification de la donnée de contrôle est réalisée avant chaque appel à 1' algorithme. Selon une caractéristique, lorsque la vérification de la donnée de contrôle est erronée, le procédé comporte une fonction de blocage de l'algorithme avec la clé secrète construite et/ou une fonction de blocage du composant électronique . L'invention s'applique à tout support sécurisé, de type carte à puce, ou à tout dispositif de calcul, de type ordinateur muni d'un logiciel de chiffrement, comportant un composant électronique apte à mettre en œuvre le procédé selon l'invention.According to another characteristic, the verification of the control data is carried out before each call to the algorithm. According to one characteristic, when the verification of the control data is erroneous, the method comprises a function of blocking the algorithm with the secret key constructed and / or a function of blocking the electronic component. The invention applies to any secure medium, of the smart card type, or to any computing device, of the computer type provided with encryption software, comprising an electronic component capable of implementing the method according to the invention. .
Le procédé selon l'invention permet de construire une checksum qui ne révèle aucune information sur la clé secrète à laquelle elle est associée. En effet, la checksum n'est plus du tout liée à la parité des bits de chiffrement de la clé.The method according to the invention makes it possible to construct a checksum which does not reveal any information on the secret key with which it is associated. Indeed, the checksum is no longer linked at all to the parity of the encryption bits of the key.
En outre, cette checksum ne contenant aucune information sensible, il n'est même pas nécessaire de la masquer.
La sécurité de la clé reste néanmoins assurée puisque la vérification qu'aucune attaque n'a été intentée demeure, en calculant une nouvelle checksum et en la comparant à la checksum initialement construite. Le procédé selon l'invention requiert un premier fonctionnement de l'algorithme avec les seuls bits de chiffrement de la clé, de manière à recalculer la checksum pour vérification, ce qui représente un coût en temps. Cependant, ce coût en temps est compensé par le gain en sécurité qu'apporte le procédé selon 1' invention.Furthermore, since this checksum does not contain any sensitive information, it is not even necessary to hide it. The security of the key nevertheless remains assured since the verification that no attack has been launched remains, by calculating a new checksum and comparing it to the checksum initially constructed. The method according to the invention requires a first operation of the algorithm with only the encryption bits of the key, so as to recalculate the checksum for verification, which represents a cost in time. However, this time cost is offset by the gain in security brought by the method according to the invention.
D'autres particularités et avantages de 1 ' invention apparaîtront clairement à la lecture de la description qui est faite ci-après et qui est donnée à titre d'exemple illustratif et non limitatif.Other features and advantages of the invention will become apparent on reading the description which is given below and which is given by way of illustrative and nonlimiting example.
La description fait référence à un algorithme DES à clé secrète de 64 bits. En effet, parmi les algorithmes actuellement connus, seul le DES utilise une checksum pour contrer les attaques mémoires de type DFA. Néanmoins, le procédé selon l'invention pourrait être appliqué à d'autres algorithmes symétriques utilisant des clés secrètes éventuellement plus longues .The description refers to a 64-bit secret key DES algorithm. Indeed, among the currently known algorithms, only DES uses a checksum to counter DFA type memory attacks. However, the method according to the invention could be applied to other symmetrical algorithms using possibly longer secret keys.
L'objet de l'invention est de construire une checksum qui ne révèle aucune information sur les 56 bits de chiffrement de la clé du DES.The object of the invention is to construct a checksum which does not reveal any information on the 56 encryption bits of the DES key.
A cet effet, un message déterminé M de K bits, c'est à dire non tenu secret, est encodé par les 56 bits de chiffrement du DES. Selon un mode de réalisation préférentiel, on choisit un message M de 64 bits constants, c'est à dire fixés et connus. Selon un mode de réalisation, le message M peut être composé de K bits ayant tous la même valeur, par exemple tous à 0.
Le message chiffré M' en sortie du DES comporte K bits (64 dans l'exemple) qui ne divulguent absolument rien des 56 bits de chiffrement utilisés par l'algorithme.To this end, a determined message M of K bits, that is to say not kept secret, is encoded by the 56 encryption bits of the DES. According to a preferred embodiment, a message M of 64 constant bits is chosen, that is to say fixed and known. According to one embodiment, the message M can be composed of K bits all having the same value, for example all at 0. The encrypted message M 'at the output of the DES comprises K bits (64 in the example) which disclose absolutely nothing of the 56 encryption bits used by the algorithm.
L'invention consiste alors à sélectionner 8 bits parmi les 64 bits du message chiffré M'. N'importe quels bits peuvent être sélectionnés, mais pour simplifier, on choisit préférentiellement les 8 premiers, c'est à dire le premier octet du texte chiffré M' . Ces 8 bits forment alors la checksum du DES Co.The invention then consists in selecting 8 bits from the 64 bits of the encrypted message M '. Any bits can be selected, but for simplicity, the first 8 are preferably chosen, that is to say the first byte of the encrypted text M '. These 8 bits then form the DES Co. checksum.
Les bits de cette checksum construite Co sont ensuite intégrés aux 56 bits de chiffrement aléatoire pour former une clé complète de 64 bits. Chaque bit de la checksum est placé entre les bits de chiffrement tous les 7 bits.The bits of this built checksum Co are then integrated into the 56 bits of random encryption to form a complete 64-bit key. Each bit of the checksum is placed between the encryption bits every 7 bits.
La checksum Co ainsi construite l'est une fois pour toute pour une clé donnée, soit en fin de production lors de la fabrication du composant électronique sur lequel le DES est implémenté, soit lors de la première utilisation dudit composant avec cette clé. Il existe en effet des applications dans lesquelles la clé du DES peut être modifiée, une nouvelle construction de la checksum Co est alors nécessaire . Par la suite, le DES retrouve un fonctionnement classique, c'est à dire qu'il code et décode des messages avec une clé de 64 bits dont 56 sont aléatoires et 8 sont une checksum ne contenant strictement aucune information sur lesdits bits de chiffrement.The checksum Co thus constructed is once and for all for a given key, either at the end of production during the manufacture of the electronic component on which the DES is implemented, or during the first use of said component with this key. There are indeed applications in which the DES key can be modified, a new construction of the Co checksum is then necessary. Thereafter, the DES finds a conventional operation, that is to say that it codes and decodes messages with a 64-bit key of which 56 are random and 8 are a checksum containing strictly no information on said encryption bits.
Cependant, la protection contre d'éventuelles attaques mémoire de type DFA reste assurée en recalculant une checksum Ci et en la comparant à celle
construite Co, par exemple à chaque mise sous tension du composant, ou avant chaque appel au DES.However, protection against possible DFA type memory attacks remains ensured by recalculating a checksum Ci and comparing it to that built Co, for example each time the component is powered up, or before each call to DES.
La checksum de vérification Ci est calculée avec les 56 bits de chiffrement de la clé à partir du message constant M initial, et déterminée par 8 des bits du message ainsi chiffré M' (on reprend les mêmes bits que pour Co, les premiers par exemple) .The verification checksum Ci is calculated with the 56 encryption bits of the key from the initial constant message M, and determined by 8 of the bits of the message thus encrypted M '(the same bits are used as for Co, the first for example ).
Si une attaque DFA a été intentée et qu'un bit de la clé a été modifié, la checksum Ci calculée avec la clé attaquée à partir du même message constant M initial sera nécessairement différente de celle construite initialement et mémorisée Co . En effet, le DES étant un algorithme non linéaire, de nombreux bits du message chiffré M' seront modifiés par la modification d'un seul bit de la clé et la checksum Ci reconstruite à partir de cette clé attaquée aura certainement des bits différents de Co.If a DFA attack has been launched and a bit of the key has been modified, the checksum Ci calculated with the attacked key from the same initial constant message M will necessarily be different from that initially constructed and stored Co. Indeed, DES being a nonlinear algorithm, many bits of the encrypted message M 'will be modified by the modification of a single bit of the key and the checksum Ci reconstructed from this attacked key will certainly have bits different from Co .
En revanche, si Cι=Co, la clé n'a subi aucune attaque, et elle peut être utilisée en toute tranquillité.On the other hand, if Cι = Co, the key has not undergone any attack, and it can be used in complete tranquility.
Par contre, si Ci ≠ C0, la clé a subi une attaque. Le procédé selon l'invention comporte alors une fonction de blocage de l'utilisation de l'algorithme de chiffrement/déchiffrement avec cette clé secrète complète construite, et/ou une fonction de blocage de l'utilisation du composant électronique sur lequel le procédé est implanté (par exemple une carte à puce) .
On the other hand, if Ci ≠ C 0 , the key has been attacked. The method according to the invention then comprises a function of blocking the use of the encryption / decryption algorithm with this complete secret key constructed, and / or a function of blocking the use of the electronic component on which the method is implanted (for example a smart card).