FR2895814A1 - Computer application program execution securing method for chip card, involves initializing program counter and continuing program execution when content of counter is equal to stored number of neutral instructions - Google Patents
Computer application program execution securing method for chip card, involves initializing program counter and continuing program execution when content of counter is equal to stored number of neutral instructions Download PDFInfo
- Publication number
- FR2895814A1 FR2895814A1 FR0650026A FR0650026A FR2895814A1 FR 2895814 A1 FR2895814 A1 FR 2895814A1 FR 0650026 A FR0650026 A FR 0650026A FR 0650026 A FR0650026 A FR 0650026A FR 2895814 A1 FR2895814 A1 FR 2895814A1
- Authority
- FR
- France
- Prior art keywords
- instructions
- instruction
- counter
- neutral
- execution
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/28—Error detection; Error correction; Monitoring by checking the correct order of processing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
PROCÉDÉ DE SÉCURISATION DE L'EXÉCUTION D'UN PROGRAMME D'ORDINATEURMETHOD FOR SECURING THE EXECUTION OF A COMPUTER PROGRAM
La présente invention concerne le domaine de la sécurisation de l'exécution des programmes d'ordinateur, notamment dans le cadre des cartes à puce, et a plus particulièrement pour objet un procédé de sécurisation de l'exécution d'un tel programme comportant des instructions de branchement insérées dans un flux d'instructions neutres à exécuter les unes à la suite des autres. The present invention relates to the field of securing the execution of computer programs, particularly in the context of smart cards, and more particularly to a method for securing the execution of such a program comprising instructions. branches inserted in a stream of neutral instructions to execute one after the other.
On sait que les cartes à puce font l'objet de nombreuses tentatives de piratage, notamment par des attaques actives au cours desquelles le pirate potentiel perturbe physiquement le circuit intégré de la puce en vue de modifier le comportement de cette dernière et de dérouter le code logiciel vers un autre type d'exécution. It is known that smart cards are the subject of numerous hacking attempts, in particular by active attacks during which the potential hacker physically disrupts the integrated circuit of the chip in order to modify the behavior of the latter and to divert the code software to another type of execution.
Pour faire échec à ces tentatives, il est bien connu, dans un produit comprenant d'une manière plus générale un ou plusieurs composants électroniques et un logiciel embarqué, d'utiliser des contrôles d'intégrité sur les données et/ou de la redondance de code afin de détecter d'éventuelles perturbations involontaires (spatial) ou volontaire (hacker). Il s'avère toutefois que ces moyens de détection ne sont pas toujours suffisants pour détecter une erreur de séquencement du code : déroutement ou bien encore omission d'une instruction de branchement/saut/retour. To counter these attempts, it is well known, in a product comprising more generally one or more electronic components and embedded software, to use integrity checks on the data and / or redundancy of the data. code to detect possible unintentional (spatial) or voluntary (hacker) disturbances. It turns out, however, that these detection means are not always sufficient to detect a code sequencing error: trap or even omission of a branch / jump / return instruction.
La détection de ce type de faute au moyen de mécanismes logiciels est complexe et coûteuse (en termes de performance) à mettre en oeuvre. En effet, le logiciel doit en permanence conserver dans une ou plusieurs variable(s) temporaire(s) une valeur correspondant à l'état dans lequel il se trouve (machine d'état) et vérifier aux moments opportuns qu'il y a bien cohérence entre l'état dans lequel il se trouve et l'état dans lequel il devrait être. The detection of this type of fault by means of software mechanisms is complex and expensive (in terms of performance) to implement. Indeed, the software must permanently keep in one or more temporary variable (s) a value corresponding to the state in which it is (state machine) and check at the appropriate times that there is coherence between the state in which it is and the state in which it should be.
La présente invention a pour objet de s'affranchir de cette gestion fastidieuse et pénalisante au niveau logiciel en l'intégrant directement dans l'architecture matérielle (hardware) du composant à protéger. The object of the present invention is to overcome this fastidious and penalizing management at the software level by integrating it directly into the hardware architecture of the component to be protected.
On sait qu'une unité centrale de traitement CPU (central processing unit) a pour mission, dans un composant électronique de type microprocesseur, de décoder et exécuter une à une les instructions qui composent le logiciel (software). Elle est donc au coeur du séquencement du code et, par là même, la mieux placée pour effectuer la vérification de cohérence d'état pour peu que, selon l'invention, on en modifie légèrement le fonctionnement. It is known that a central processing unit CPU (CPU central processing unit) has for mission, in an electronic component of microprocessor type, to decode and execute one by one the instructions that make up the software. It is therefore at the heart of the sequencing of the code and, by the same token, best placed to carry out the state consistency check, provided that, according to the invention, the operation thereof is slightly modified.
On rappelle que la CPU lit à l'adresse pointée par le pointeur de programme (PC : program counter), le code opération de l'instruction à exécuter ainsi que les éventuels opérandes associés à cette instruction. It is recalled that the CPU reads at the address pointed by the program pointer (PC: program counter), the operation code of the instruction to be executed and any operands associated with this instruction.
On distinguera dans ce qui suit les instructions neutres (qui n'impliquent pas de rupture du programme) des instructions de branchement (qui impliquent une mise à jour du pointeur de programme avec un décalage ou une valeur immédiate). In the following, the neutral instructions (which do not imply breaking of the program) are distinguished from the branching instructions (which imply an update of the program pointer with an offset or an immediate value).
On peut noter, à titre d'exemples d'instructions neutres : les instructions arithmétiques et logiques (ORL, AND ...) ; - les instructions de lecture/écriture en mémoire ou dans des registres (MOV, LD, ...) ; et à titre d'exemple d'instructions de branchements : - les branchements conditionnels ou non (BEQ, BRA ...) ; - les sauts (JMP) ; les sauts dans une sous-routine (JSR) ; les retours de sous-routine (RTS). Examples of neutral instructions include: arithmetic and logical instructions (ORL, AND ...); - read / write instructions in memory or in registers (MOV, LD, ...); and as an example of branching instructions: - conditional or non-conditional branching (BEQ, BRA ...); - jumps (JMP); jumps in a subroutine (JSR); subroutine returns (RTS).
Afin de pallier les inconvénients mentionnés ci-dessus, l'invention a tout d'abord pour objet un procédé de sécurisation de l'exécution d'un programme d'ordinateur comportant des instructions de branchement insérées dans un flux d'instructions neutres à exécuter les unes à la suite des autres, ledit procédé comprenant les étapes consistant à : - enregistrer dans une mémoire, préalablement à l'exécution dudit programme, respectivement préalablement à l'exécution d'une instruction particulière dudit programme, le nombre d'instructions neutres à exécuter entre chaque instruction de branchement, respectivement entre ladite instruction de branchement particulière et l'instruction de branchement qui la précède ; - lors de l'exécution du programme • lors de l'exécution de chaque instruction neutre o incrémenter un compteur d'instructions ; • et au moins lors de l'exécution de chaque instruction de branchement o lire le contenu dudit compteur d'instructions ; o comparer le contenu dudit compteur d'instructions au nombre enregistré dans ladite mémoire, d'instructions neutres censées avoir été exécutées depuis l'instruction de branchement précédente ; et -si le contenu dudit compteur d'instructions est égal au nombre d'instructions neutres enregistré, initialiser ledit compteur et poursuivre l'exécution dudit programme ; -si le contenu dudit compteur d'instructions n'est pas égal au nombre d'instructions neutres enregistré, générer une interruption. In order to overcome the drawbacks mentioned above, the object of the invention is first of all a method for securing the execution of a computer program comprising branch instructions inserted in a stream of neutral instructions to be executed. one after the other, said method comprising the steps of: - recording in a memory, prior to the execution of said program, respectively before the execution of a particular instruction of said program, the number of neutral instructions to execute between each branch instruction respectively between said particular branch instruction and the branch instruction which precedes it; - when executing the program • when executing each neutral instruction o incrementing an instruction counter; • and at least during the execution of each branch instruction o read the contents of said instruction counter; o comparing the contents of said instruction counter to the number stored in said memory, of neutral instructions supposed to have been executed from the previous branch instruction; and if the content of said instruction counter is equal to the number of neutral instructions recorded, initializing said counter and continuing execution of said program; if the content of said instruction counter is not equal to the number of neutral instructions recorded, generating an interrupt.
On comprend que ce procédé puisse sécuriser l'exécution du programme contre les tentatives de déroutement. It is understood that this method can secure the execution of the program against the attempts of diversion.
On suppose en effet qu'une perturbation déroute le programme en perturbant par exemple l'adresse d'un branchement. Le compteur d'instructions sera remis à zéro puis le programme sautera à une adresse ADDR quelconque. Si ADDR correspond à une instruction neutre dans une zone de code linéaire, alors, lorsque le programme atteindra l'instruction de branchement suivante, le contenu du compteur sera égal au nombre d'instructions neutres exécutées depuis ADDR et donc nécessairement différent du nombre correspondant préalablement enregistré, et le déroutement sera détecté. It is assumed that a disturbance confuses the program by disturbing for example the address of a branch. The instruction counter will be reset and the program will jump to any ADDR address. If ADDR corresponds to a neutral instruction in a linear code field, then, when the program reaches the next branch instruction, the contents of the counter will be equal to the number of neutral instructions executed since ADDR and therefore necessarily different from the corresponding number previously saved, and the trap will be detected.
On observe que l'enregistrement en mémoire des nombres d'instructions neutres peut s'effectuer soit avant l'exécution du programme pour toutes les instructions de branchement, soit au fur et à mesure de cette exécution lors du passage de chaque instruction de branchement particulière. It is observed that the recording in memory of the numbers of neutral instructions can be done either before the execution of the program for all the instructions of branching, or as and when this execution during the passage of each instruction of particular branching .
Par ailleurs, on entend généralement par interruption non seulement une interruption proprement dite de l'exécution du programme, mais également toute mise en état d'alerte. Moreover, interruption is generally understood not only as an interruption proper to the execution of the program, but also any setting in the state of alert.
L'invention a également pour objet un programme d'ordinateur pour la sécurisation d'un programme d'application comportant des instructions de branchement insérées dans un flux d'instructions neutres à exécuter les unes à la suite des autres, ce programme étant agencé pour : - lire les instructions dudit programme d'application ; - détecter les instructions de branchement ; - lors de la détection d'une instruction de branchement déterminée • compter le nombre d'instructions neutres à exécuter depuis l'instruction de branchement précédente ; • insérer ledit nombre d'instructions neutres en tant que paramètre de ladite instruction de branchement déterminée. The invention also relates to a computer program for securing an application program including branch instructions inserted in a stream of neutral instructions to be executed one after the other, this program being arranged to : - read the instructions of the application program; - detect the connection instructions; - when detecting a specific branch instruction • count the number of neutral instructions to be executed from the previous branch instruction; • insert said number of neutral instructions as a parameter of said determined branch instruction.
Ce programme peut notamment constituer un compilateur ou un interpréteur selon le langage utilisé pour le programme d'application. This program can in particular be a compiler or an interpreter according to the language used for the application program.
Dans un mode de réalisation particulier, ce programme peut en outre être agencé pour, lors de la détection d'une instruction de branchement déterminée, insérer des instructions consistant à : o lire le contenu d'un compteur d'instructions susceptible d'être incrémenté lors de l'exécution de chaque instruction neutre ; o comparer ledit nombre d'instructions neutres au contenu dudit compteur d'instructions ; et - en cas d'égalité entre ledit nombre d'instructions neutres 15 et le contenu dudit compteur, initialiser ledit compteur et exécuter ledit branchement ; - en cas d'inégalité entre ledit nombre d'instructions neutres et le contenu dudit compteur, générer une interruption. 20 On observera que, lorsqu'un programme d'application est ainsi sécurisé lors de sa compilation ou de son interprétation, la mémoire d'enregistrement des nombres d'instructions neutres dont il est question ci-dessus n'est autre alors qu'une partie de la mémoire 25 dans laquelle sont stockées les instructions de ce programme d'application, puisque ces nombres d'instructions apparaissent comme des paramètres des instructions de branchement. In a particular embodiment, this program may also be arranged to, when detecting a branch instruction determined, insert instructions consisting in: o reading the contents of an instruction counter that can be incremented during the execution of each neutral instruction; o comparing said number of neutral instructions with the contents of said instruction counter; and - in case of equality between said number of neutral instructions and the content of said counter, initializing said counter and executing said connection; in case of inequality between said number of neutral instructions and the content of said counter, generating an interruption. It will be observed that, when an application program is thus secure during its compilation or interpretation, the memory for recording the numbers of neutral instructions referred to above is none other than one. part of the memory 25 in which are stored the instructions of this application program, since these numbers of instructions appear as parameters of the branch instructions.
Par ailleurs, les instructions consistant à lire le contenu du 30 compteur d'instructions, à comparer ce contenu au nombre d'instructions neutres, à initialiser le compteur, et à générer une interruption peuvent être effectivement insérées dans le programme d'application modifié, ou être réalisées matériellement au niveau de l'unité centrale sur laquelle s'exécute le programme modifié. Further, the instructions to read the contents of the instruction counter, to compare this content to the number of neutral instructions, to initialize the counter, and to generate an interrupt can be effectively inserted into the modified application program. or be physically performed at the CPU where the modified program runs.
Dans un mode de mise en oeuvre particulier, ledit programme de sécurisation est agencé pour : - détecter les labels associés à des instructions de branchement ; D lors de la détection d'un tel label, • compter le nombre d'instructions neutres à exécuter depuis l'instruction de branchement précédente ou le label précédent ; • insérer, en amont dudit label, une instruction de contrôle comportant ledit nombre d'instructions neutres en tant que paramètre. In a particular mode of implementation, said security program is arranged to: detect the labels associated with branch instructions; D when detecting such a label, • count the number of neutral instructions to be executed from the previous branch instruction or the previous label; • insert, upstream of said label, a control instruction comprising said number of neutral instructions as a parameter.
Plus particulièrement, le programme de sécurisation peut être agencé pour, lors de la détection d'un tel label, insérer des instructions consistant à : o lire le contenu dudit compteur d'instructions ; o comparer ledit nombre d'instructions neutres au contenu dudit compteur d'instructions ; et en cas d'égalité entre ledit nombre d'instructions neutres et le contenu dudit compteur, initialiser ledit compteur et passer à l'instruction suivante ; - en cas d'inégalité entre ledit nombre d'instructions neutres et le contenu dudit compteur, générer une interruption. More particularly, the security program can be arranged to, when detecting such a label, insert instructions consisting in: o reading the contents of said instruction counter; o comparing said number of neutral instructions with the contents of said instruction counter; and in case of equality between said number of neutral instructions and the content of said counter, initializing said counter and proceed to the next instruction; in case of inequality between said number of neutral instructions and the content of said counter, generating an interruption.
L'instruction de contrôle est donc ajoutée juste avant un label correspondant à une instruction de branchement de manière à tenir compte du fait que le programme peut entrer dans le flux 30 d'instructions neutres au niveau du label et non pas au niveau de l'instruction de branchement précédente. Cette instruction de contrôle est gérée par l'unité de traitement comme une instruction de branchement en comparant le contenu de la mémoire du nombre d'instructions neutres au compteur d'instructions. 25 L'invention a également pour objet un programme d'ordinateur sécurisé, comportant des instructions de branchement insérées dans un flux d'instructions neutres à exécuter les unes à la suite des autres, dans lequel lesdites instructions de branchement comprennent, en tant que paramètre, le nombre d'instructions neutres à exécuter depuis l'instruction de branchement précédente. The control instruction is therefore added just before a label corresponding to a branch instruction so as to take into account that the program can enter the stream of neutral instructions at the label level and not at the level of the label. previous branch instruction. This control instruction is handled by the processing unit as a branch instruction by comparing the contents of the memory of the number of neutral instructions to the instruction counter. The invention also relates to a secure computer program comprising branch instructions inserted in a stream of neutral instructions to be executed one after the other, wherein said branch instructions comprise, as parameter , the number of neutral instructions to execute from the previous branch instruction.
Dans un mode de réalisation particulier, ledit programme sécurisé comprend en outre des instructions consistant, au moins lors de l'exécution de chaque instruction de branchement, à : • lire le contenu d'un compteur d'instructions susceptible d'être incrémenté lors de l'exécution de chaque instruction neutre ; • comparer le contenu dudit compteur d'instructions audit paramètre ; et o si le contenu dudit compteur d'instructions est égal audit paramètre, initialiser ledit compteur et poursuivre l'exécution dudit programme ; o si le contenu dudit compteur d'instructions n'est pas égal audit paramètre, générer une interruption. In a particular embodiment, said secure program further comprises instructions consisting, at least during the execution of each branch instruction, in: • reading the contents of an instruction counter that can be incremented when the execution of each neutral instruction; Comparing the content of said instruction counter to said parameter; and o if the content of said instruction counter is equal to said parameter, initializing said counter and continuing the execution of said program; o if the content of said instruction counter is not equal to said parameter, generating an interrupt.
Également dans un mode de réalisation particulier, ledit programme d'ordinateur comporte des labels associés à des instructions de branchement, et comporte en outre, en amont desdits labels une instruction de contrôle comportant, en tant que paramètre, le nombre d'instructions neutres à exécuter depuis l'instruction de branchement précédente ou le label précédent. Also in a particular embodiment, said computer program includes labels associated with branch instructions, and further comprises, upstream of said labels, a control instruction including, as a parameter, the number of neutral instructions to execute from the previous branch instruction or the previous label.
Plus particulièrement, ledit programme d'ordinateur peut comporter en outre, en amont desdits labels, des instructions consistant à : o lire le contenu dudit compteur d'instructions ; o comparer ledit nombre d'instructions neutres au contenu dudit compteur d'instructions ; et - en cas d'égalité entre ledit nombre d'instructions neutres et le contenu dudit compteur, initialiser ledit compteur et passer à l'instruction suivante ; - en cas d'inégalité entre ledit nombre d'instructions neutres et le contenu dudit compteur, générer une interruption. More particularly, said computer program may further comprise, upstream of said labels, instructions consisting in: reading the content of said instruction counter; o comparing said number of neutral instructions with the contents of said instruction counter; and - in case of equality between said number of neutral instructions and the contents of said counter, initializing said counter and proceed to the next instruction; in case of inequality between said number of neutral instructions and the content of said counter, generating an interruption.
L'invention a également pour objet une unité de traitement informatique comprenant des moyens pour exécuter un programme d'ordinateur comportant des instructions de branchement insérées dans un flux d'instructions neutres à exécuter les unes à la suite des autres, respectivement des labels associés à des instructions de branchement, dans laquelle lesdits moyens comprennent : > une mémoire susceptible de contenir le nombre d'instructions neutres à exécuter entre chaque instruction de branchement, respectivement entre chaque label et l'instruction de branchement ou le label précédent, lors de l'exécution dudit programme ; > un compteur d'instructions susceptible d'être incrémenté lors de l'exécution de chaque instruction neutre dudit programme ; > des moyens pour comparer, préalablement à l'exécution d'une instruction de branchement, respectivement lors du passage d'un label, le contenu dudit compteur d'instructions au nombre enregistré dans ladite mémoire d'instructions neutres censées avoir été exécutées depuis l'instruction de branchement ou le label précédent. The subject of the invention is also a computer processing unit comprising means for executing a computer program comprising branch instructions inserted in a stream of neutral instructions to be executed one after the other, or labels associated with each other. branching instructions, wherein said means comprises: a memory capable of containing the number of neutral instructions to be executed between each branch instruction, respectively between each label and the branch instruction or the previous label, when execution of said program; an instruction counter that can be incremented during the execution of each neutral instruction of said program; means for comparing, prior to the execution of a branch instruction, respectively during the passage of a label, the content of said instruction counter to the number recorded in said neutral instruction memory supposed to have been executed since branch instruction or the previous label.
L'invention a également pour objet un composant électronique comprenant une unité de traitement telle que décrite ci-dessus. The invention also relates to an electronic component comprising a processing unit as described above.
L'invention a également pour objet une carte à puce comprenant un composant électronique tel que décrit ci-dessus. The invention also relates to a smart card comprising an electronic component as described above.
On décrira maintenant à titre d'exemple non limitatif des modes de réalisation de l'invention en référence aux dessins annexés dans lesquels : - la figure 1 est un organigramme illustrant le procédé selon l'invention ; - la figure 2 représente schématiquement un programme d'application modifié selon l'invention ; - la figure 3 représente un composant électronique selon l'invention ; et - la figure 4 représente une carte à puce selon l'invention. Embodiments of the invention will now be described by way of non-limiting example with reference to the accompanying drawings, in which: FIG. 1 is a flowchart illustrating the method according to the invention; FIG. 2 diagrammatically represents a modified application program according to the invention; FIG. 3 represents an electronic component according to the invention; and FIG. 4 represents a smart card according to the invention.
La figure 1 illustre le procédé selon l'invention tel qu'il peut être mis en oeuvre par la CPU représentée en 1 à la figure 3, et comprenant : - une mémoire 2, contenant les nombres d'instructions neutres à exécuter entre chaque instruction de branchement d'un programme à exécution sécurisée ; -un compteur d'instructions Cl 3 susceptible d'être incrémenté par la CPU lors de l'exécution de chaque instruction neutre du programme ; - un comparateur 4 pour comparer le contenu du compteur 3 au contenu d'un emplacement de la mémoire 2 correspondant à une instruction de branchement déterminée. FIG. 1 illustrates the method according to the invention as it can be implemented by the CPU represented in 1 in FIG. 3, and comprising: a memory 2, containing the numbers of neutral instructions to be executed between each instruction connecting a secure execution program; an instruction counter C1 3 that can be incremented by the CPU during the execution of each neutral instruction of the program; a comparator 4 for comparing the contents of the counter 3 with the contents of a location in the memory 2 corresponding to a determined branch instruction.
Avant l'exécution du programme, les nombres d'instructions neutres à exécuter entre chaque instruction de branchement du programme sont enregistrés en 10 dans les emplacements respectifs de la mémoire, par exemple lors de la compilation du programme. On verra ci-après que la mémoire 2 peut n'être autre que des emplacements particuliers de la mémoire contenant la suite des instructions du programme à exécuter, où ces nombres apparaissent sous la forme de paramètres des instructions de branchement. Before the execution of the program, the numbers of neutral instructions to be executed between each branch instruction of the program are recorded at 10 in the respective locations of the memory, for example during compilation of the program. It will be seen below that the memory 2 may be none other than specific locations of the memory containing the sequence of instructions of the program to be executed, where these numbers appear in the form of parameters of the branch instructions.
On a vu qu'en variante, l'enregistrement en mémoire des nombres d'instructions neutres peut s'effectuer au fur et à mesure de l'exécution du programme lors du passage de chaque instruction de branchement particulière. It has been seen that, alternatively, the recording in memory of the numbers of neutral instructions can be carried out as and when the program is executed during the passage of each particular branch instruction.
Puis, au cours de l'exécution du programme, la CPU lit successivement chaque instruction de façon connue. Pour chaque nouvelle instruction lue, la CPU détermine en 11 s'il s'agit d'une instruction neutre ou d'une instruction de branchement. Then, during program execution, the CPU successively reads each instruction in a known manner. For each new instruction read, the CPU determines in 11 whether it is a neutral instruction or a branch instruction.
S'il s'agit d'une instruction neutre, le compteur 3 est incrémenté en 10 12, l'instruction est exécutée en 13, et la CPU passe à l'instruction suivante en 14. If it is a neutral instruction, the counter 3 is incremented at 12, the instruction is executed at 13, and the CPU proceeds to the next instruction at 14.
S'il s'agit d'une instruction de branchement, la CPU lit le compteur en 15 et compare en 16 son contenu au contenu de la mémoire 15 correspondant à cette instruction de branchement particulière. En cas d'égalité, il n'y a pas eu d'anomalie dans le déroulement du programme, le compteur est remis à zéro en 17 et, comme précédemment, l'instruction est exécutée en 13 et la CPU passe en 14 à l'instruction suivante. En cas d'inégalité, il y a eu une 20 anomalie, et une interruption est générée en 18. If it is a branch instruction, the CPU reads the counter at 15 and compares its content to the contents of the memory corresponding to that particular branch instruction. In the case of a tie, there has been no anomaly in the course of the program, the counter is reset to 17 and, as before, the instruction is executed at 13 and the CPU switches to 14 at the end of the program. following instruction. In case of inequality, there was an anomaly, and an interruption is generated in 18.
La figure 2 montre comment un programme d'application est modifié de sorte d'inclure dans chaque instruction de branchement particulière, un paramètre supplémentaire PNI (Preceding Neutra) 25 Instructions) correspondant au nombre d'instructions neutres présentes dans le programme entre la précédente instruction de branchement (ou le début de la sous-routine, ou du programme) et celle-ci. Figure 2 shows how an application program is modified to include in each particular branch instruction an additional parameter PNI (Preceding Neutra) Instructions corresponding to the number of neutral instructions present in the program between the previous instruction. branch (or the beginning of the subroutine, or program) and this one.
30 On constate par exemple en 20 que le programme consiste en x instructions avant d'atteindre une première instruction de branchement (qui inclura donc le paramètre PNI=x). Le code peut alors suivre deux branches qui elles-mêmes consistent en un premier morceau de code linéaire (composé de respectivement yl en 21 et z en 22 instructions neutres), etc... For example, it will be seen at 20 that the program consists of x instructions before reaching a first branch instruction (which will therefore include the parameter NIP = x). The code can then follow two branches which themselves consist of a first piece of linear code (composed respectively of yl in 21 and z in 22 neutral instructions), etc.
On peut considérer comme autre exemple que l'instruction jsr(toto) n'est pas exécutée en 23 suite à une perturbation. Il en résulte donc que Cl ne sera pas remis à zéro et lorsque le programme atteindra en 24 l'instruction RTS(y2), il y aura incohérence entre Cl = yl+y2 et PNI = y2. Another example is that the instruction jsr (foo) is not executed at 23 following a disturbance. As a result, Cl will not be reset and when the program reaches RTS (y2) in 24, there will be an inconsistency between Cl = y1 + y2 and PN1 = y2.
Afin de considérer le cas particulier du saut en 25 à un label dans le code (jmp label), il est nécessaire d'introduire en 26 une nouvelle instruction CTL. Cette instruction est insérée dans le code juste avant les labels correspondant à des jmp/branch. In order to consider the particular case of the jump in 25 to a label in the code (jmp label), it is necessary to introduce at 26 a new instruction CTL. This statement is inserted into the code just before the labels corresponding to jmp / branch.
L'instruction CTL est gérée par le CPU au même titre qu'une instruction de branchement classique en comparant la valeur de PNI au compteur Cl. Pour être exécutable sur une CPU telle que celle de la figure 3, un logiciel doit subir une opération de transformation afin d'insérer l'instruction CTL aux endroits nécessaires et de générer les bonnes valeurs de PNI pour toutes les instructions de branchement. The CTL instruction is managed by the CPU in the same way as a conventional branch instruction by comparing the value of PNI with the counter C1. To be executable on a CPU such as that of FIG. 3, a software must undergo an operation of transformation to insert the CTL instruction where needed and generate the correct NIBP values for all branch instructions.
Il convient de noter le cas particulier des interruptions hardware qui se traduisent par une rupture du séquencement suivie habituellement de l'exécution du code correspondant à l'interruption et de l'instruction finale RTI (ReTurn from Interrupt) qui met fin au code de l'interruption et qui retourne à l'exécution du programme initial là ou il avait été interrompu. Ce type d'évènement peut être géré de deux manières : - durant l'exécution de l'interruption, le mécanisme décrit ci-dessus est débrayé et Cl conserve sa valeur. Le mécanisme est réactivé par l'instruction RTI. Dans ce cas-là, l'exécution de l'interruption est transparente ; par contre elle n'est pas protégée car réalisée en dehors du mécanisme selon l'invention Note the particular case of hardware interrupts that result in a break in the sequencing usually followed by the execution of the code corresponding to the interrupt and the final instruction RTI (ReTurn from Interrupt) which terminates the code of the interrupt and return to the execution of the initial program where it was interrupted. This type of event can be managed in two ways: - during the execution of the interruption, the mechanism described above is disengaged and Cl retains its value. The mechanism is reactivated by the RTI instruction. In this case, the execution of the interruption is transparent; on the other hand, it is not protected because it is made outside the mechanism according to the invention
- dans un autre mode de réalisation, la valeur de Cl est sauvegardée lorsque l'interruption apparaît (au même titre que la banque de registres en général et l'adresse de retour dans tous les cas). Cl est remis à zéro de sorte que le mécanisme est toujours actif durant le traitement de l'interruption. La valeur sauvegardée de Cl est restaurée lors de l'exécution de l'instruction RTI. Par ailleurs, l'instruction RTI est considérée comme une instruction de branchement et, comme telle, inclut le paramètre PNI qui sera validé avant son exécution. in another embodiment, the value of Cl is saved when the interruption appears (in the same way as the bank of registers in general and the return address in all cases). Cl is reset so that the mechanism is still active during interrupt processing. The saved value of Cl is restored when the RTI instruction is executed. In addition, the RTI instruction is considered a branch instruction and, as such, includes the NIBP parameter that will be validated before it is executed.
Si l'on revient à la figure 3, le compteur 3 peut être réalisé sous la forme d'un registre de taille N bytes, permettant de compter jusqu'à 2^8.N. Dans un mode de réalisation de l'invention, on peut prendre N=1 byte. Le paramètre PNI est alors codé dans la mémoire 2 sur le même nombre N de byte que le compteur 3. Returning to FIG. 3, the counter 3 can be implemented in the form of a register of size N bytes, making it possible to count up to 2 ^ 8.N. In one embodiment of the invention, N = 1 byte can be taken. The parameter PNI is then coded in the memory 2 on the same number N of byte as the counter 3.
La figure 3 montre par ailleurs la CPU 1 comme faisant partie d'un 20 composant électronique 30, tandis que la figure 4 montre une carte à puce 31 comportant le composant 30. FIG. 3 further shows the CPU 1 as part of an electronic component 30, while FIG. 4 shows a smart card 31 having the component 30.
La présente invention permet de détecter la plupart des erreurs de séquencement liées à une perturbation, avec 25 - un faible coût en taille de code (ajout du paramètre PNI pour toutes les instructions de branchement et de l'instruction CTL aux labels branchables) ; - un faible coût en taille de silicium (ajout d'un compteur Cl et de la gestion par le décodeur d'instruction de la comparaison de 30 Cl à PNI pour les instructions de branchement) ; - un faible coût en temps d'exécution (éventuellement nul car la comparaison et l'incrémentation de Cl peuvent être fait en parallèle avec l'exécution de l'instruction). The present invention makes it possible to detect most of the perturbation related sequencing errors with a low code size cost (adding the PNI parameter for all branch instructions and the CTL instruction to pluggable labels); a low cost in silicon size (addition of a counter C1 and management by the instruction decoder of the comparison of 30 Cl to PNI for branching instructions); a low cost in execution time (possibly zero because the comparison and the incrementation of C1 can be done in parallel with the execution of the instruction).
Claims (13)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
FR0650026A FR2895814A1 (en) | 2006-01-04 | 2006-01-04 | Computer application program execution securing method for chip card, involves initializing program counter and continuing program execution when content of counter is equal to stored number of neutral instructions |
PCT/EP2006/070061 WO2007077142A2 (en) | 2006-01-04 | 2006-12-21 | Method for securing a computer program execution |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
FR0650026A FR2895814A1 (en) | 2006-01-04 | 2006-01-04 | Computer application program execution securing method for chip card, involves initializing program counter and continuing program execution when content of counter is equal to stored number of neutral instructions |
Publications (1)
Publication Number | Publication Date |
---|---|
FR2895814A1 true FR2895814A1 (en) | 2007-07-06 |
Family
ID=38110446
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
FR0650026A Pending FR2895814A1 (en) | 2006-01-04 | 2006-01-04 | Computer application program execution securing method for chip card, involves initializing program counter and continuing program execution when content of counter is equal to stored number of neutral instructions |
Country Status (2)
Country | Link |
---|---|
FR (1) | FR2895814A1 (en) |
WO (1) | WO2007077142A2 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019025516A1 (en) * | 2017-08-02 | 2019-02-07 | Texplained | Device for detecting lce attack and taking counter-measures |
CN114647445A (en) * | 2020-12-18 | 2022-06-21 | 意法半导体(格勒诺布尔2)公司 | Reverse engineering detection method on a processor and corresponding integrated circuit |
FR3118233A1 (en) * | 2020-12-18 | 2022-06-24 | STMicroelectronics (Alps) SAS | REVERSE ENGINEERING DETECTION METHOD ON A PROCESSING UNIT USING AN INSTRUCTION REGISTER AND CORRESPONDING INTEGRATED CIRCUIT |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9117070B2 (en) | 2008-05-30 | 2015-08-25 | Nxp, B.V. | Method for adapting and executing a computer program and computer architecture therefore |
FR2977342A1 (en) * | 2011-06-30 | 2013-01-04 | Proton World Int Nv | VERIFYING THE INTEGRITY OF A PROGRAM EXECUTED BY AN ELECTRONIC CIRCUIT |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2790844A1 (en) * | 1999-03-09 | 2000-09-15 | Gemplus Card Int | METHOD AND DEVICE FOR MONITORING THE PROGRESS OF A PROGRAM, PROGRAM DEVICE FOR MONITORING ITS PROGRAM |
US20030188231A1 (en) * | 2002-04-01 | 2003-10-02 | Cronce Paul A. | Method for runtime code integrity validation using code block checksums |
FR2849226A1 (en) * | 2002-12-20 | 2004-06-25 | Oberthur Card Syst Sa | Protection method for a chip card, especially for protection against differential fault analysis attacks, whereby a signature is created prior to program running that can be compared with a signature created during program running |
EP1605333A1 (en) * | 2004-06-07 | 2005-12-14 | Proton World International N.V. | Program execution control |
-
2006
- 2006-01-04 FR FR0650026A patent/FR2895814A1/en active Pending
- 2006-12-21 WO PCT/EP2006/070061 patent/WO2007077142A2/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2790844A1 (en) * | 1999-03-09 | 2000-09-15 | Gemplus Card Int | METHOD AND DEVICE FOR MONITORING THE PROGRESS OF A PROGRAM, PROGRAM DEVICE FOR MONITORING ITS PROGRAM |
US20030188231A1 (en) * | 2002-04-01 | 2003-10-02 | Cronce Paul A. | Method for runtime code integrity validation using code block checksums |
FR2849226A1 (en) * | 2002-12-20 | 2004-06-25 | Oberthur Card Syst Sa | Protection method for a chip card, especially for protection against differential fault analysis attacks, whereby a signature is created prior to program running that can be compared with a signature created during program running |
EP1605333A1 (en) * | 2004-06-07 | 2005-12-14 | Proton World International N.V. | Program execution control |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019025516A1 (en) * | 2017-08-02 | 2019-02-07 | Texplained | Device for detecting lce attack and taking counter-measures |
CN114647445A (en) * | 2020-12-18 | 2022-06-21 | 意法半导体(格勒诺布尔2)公司 | Reverse engineering detection method on a processor and corresponding integrated circuit |
FR3118233A1 (en) * | 2020-12-18 | 2022-06-24 | STMicroelectronics (Alps) SAS | REVERSE ENGINEERING DETECTION METHOD ON A PROCESSING UNIT USING AN INSTRUCTION REGISTER AND CORRESPONDING INTEGRATED CIRCUIT |
US12236000B2 (en) | 2020-12-18 | 2025-02-25 | STMicroelectronics (Alps) SAS | Reverse engineering detection by counting consecutive incremental branch instructions in an instruction register of a processor |
Also Published As
Publication number | Publication date |
---|---|
WO2007077142A3 (en) | 2009-03-19 |
WO2007077142A2 (en) | 2007-07-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1161725B1 (en) | Method for monitoring a programme flow | |
EP1702268B1 (en) | Method for controlling program execution integrity by verifying execution trace prints | |
FR2849226A1 (en) | Protection method for a chip card, especially for protection against differential fault analysis attacks, whereby a signature is created prior to program running that can be compared with a signature created during program running | |
EP1904946B1 (en) | Detection of faults during a long perturbation | |
WO2007077142A2 (en) | Method for securing a computer program execution | |
WO2006045924A1 (en) | Protection against attacks by generation of errors on jump instructions | |
EP1700218B1 (en) | Method for determining operational characteristics of a program | |
WO2014023894A1 (en) | System for detecting a modification of a subprogram call stack | |
FR2967275A1 (en) | METHOD, COMPUTER PROGRAM AND DEVICE FOR SECURING INTERMEDIATE PROGRAMMING CODE FOR ITS EXECUTION BY A VIRTUAL MACHINE | |
EP1605333B1 (en) | Program execution control | |
WO2001003084A1 (en) | Method for making secure a sensitive information processing in a monolithic security module, and associated security module | |
FR3008504A1 (en) | METHOD FOR PROVIDING AN INSTRUCTION CODE AND CIRCUIT | |
EP1980968B1 (en) | Program execution protection | |
FR2814557A1 (en) | PROTECTION AGAINST THE ABUSE OF AN INSTRUCTION IN A MEMORY | |
FR2889005A1 (en) | PERMANENT MATERIAL INTEGRITY OF DATA | |
EP4131041B1 (en) | Method for verifying execution of a software program | |
WO2009106757A1 (en) | Method for secure data transfer | |
WO2007006887A1 (en) | Protection against attacks by generating errors on jump instructions | |
FR2879781A1 (en) | METHOD AND DEVICE FOR FILLING THE SECURITY OF A MEMORY AND ASSOCIATED MEMORY | |
WO2023083776A1 (en) | Process for detecting an attempted linear extraction of the content of a memory | |
EP4177780A1 (en) | Method for detecting an attempt at linear extraction of the contents of a memory | |
FR3140186A1 (en) | Method for detecting an attempt to linearly extract the contents of a memory | |
FR3147397A1 (en) | COMPUTER SYSTEM CONFIGURED TO RUN A COMPUTER PROGRAM | |
EP2698739A1 (en) | Method for dynamic management of codes associated with security countermeasures, corresponding computer program product and device | |
WO2012052228A1 (en) | Method for securing the execution of a computer code by means of dynamic redundancy |