FR3045858A1 - METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES - Google Patents

METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES Download PDF

Info

Publication number
FR3045858A1
FR3045858A1 FR1562554A FR1562554A FR3045858A1 FR 3045858 A1 FR3045858 A1 FR 3045858A1 FR 1562554 A FR1562554 A FR 1562554A FR 1562554 A FR1562554 A FR 1562554A FR 3045858 A1 FR3045858 A1 FR 3045858A1
Authority
FR
France
Prior art keywords
code
codes
instruction
pair
sequence
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
FR1562554A
Other languages
French (fr)
Other versions
FR3045858B1 (en
Inventor
Guillaume Barbu
Hugo Greneche
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.)
Idemia France SAS
Original Assignee
Oberthur Technologies 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 Oberthur Technologies SA filed Critical Oberthur Technologies SA
Priority to FR1562554A priority Critical patent/FR3045858B1/en
Publication of FR3045858A1 publication Critical patent/FR3045858A1/en
Application granted granted Critical
Publication of FR3045858B1 publication Critical patent/FR3045858B1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44589Program code verification, e.g. Java bytecode verification, proof-carrying code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • G06F21/125Restricting unauthorised execution of programs by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
    • 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/77Protecting 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 smart cards

Abstract

Un procédé de chargement, au sein d'une mémoire (MEM) d'une entité électronique (C), d'une séquence (APPL) de codes d'instruction exécutables par une machine virtuelle résidant dans l'entité électronique (C) comprend les étapes suivantes : - détection d'un code d'instruction contenu dans une liste prédéterminée de codes d'instruction ; - conversion d'une paire formée du code détecté et d'un code situé dans la séquence (APPL) à une position relative prédéterminée par rapport au code détecté, en une paire distincte de codes selon une règle prédéterminée ; - écriture de la paire distincte dans la mémoire (MEM) en remplacement de la paire formée du code détecté et du code situé à ladite position relative. Un procédé d'exécution d'une séquence de codes d'instruction (APPL') comprend, en cas de lecture d'un code d'instruction appartenant à une liste prédéfinie, une étape de conversion d'une paire formée par le code lu et par le code situé à une position relative prédéterminée par rapport au code lu, en une paire distincte de codes. Un procédé mis en œuvre dans une entité électronique et des entités électroniques correspondantes sont également décrits.A method of loading, within a memory (MEM) of an electronic entity (C), a sequence (APPL) of instruction codes executable by a virtual machine resident in the electronic entity (C) comprises the following steps: - detection of an instruction code contained in a predetermined list of instruction codes; converting a pair formed of the detected code and a code located in the sequence (APPL) to a predetermined relative position with respect to the detected code, into a distinct pair of codes according to a predetermined rule; - Writing the distinct pair in the memory (MEM) to replace the pair formed of the detected code and the code located at said relative position. A method of executing an instruction code sequence (APPL ') comprises, when reading an instruction code belonging to a predefined list, a step of converting a pair formed by the read code and by the code located at a predetermined relative position with respect to the read code, into a distinct pair of codes. A method implemented in an electronic entity and corresponding electronic entities are also described.

Description

Domaine technique auquel se rapporte l'inventionTechnical field to which the invention relates

La présente invention concerne les séquences de codes d’instruction exécutables par une machine virtuelle.The present invention relates to instruction code sequences executable by a virtual machine.

Elle concerne plus particulièrement un procédé de chargement d’une séquence de codes d’instruction, un procédé d’exécution d’une séquence de codes d’instruction, un procédé mis en œuvre dans une entité électronique et des entités électroniques associées. L’invention s’applique particulièrement avantageusement dans le cas où l’on souhaite se prémunir contre les attaques utilisant du code inatteignable, comme expliqué ci-dessous.It relates more particularly to a method of loading a sequence of instruction codes, a method of executing a sequence of instruction codes, a method implemented in an electronic entity and associated electronic entities. The invention applies particularly advantageously in the case where one wishes to guard against attacks using unreachable code, as explained below.

Arriere-plan technologiqueTechnological background

Il est connu, par exemple dans le cadre de la technologie dénommée "Java Card', d’utiliser une machine virtuelle implantée dans une entité électronique (telle qu’une carte à microcircuit) pour charger une séquence de codes d’instruction (par exemple sous forme d’un fichier .CAP) dans l’entité électronique et exécuter cette séquence de codes d’instruction.It is known, for example in the context of the so-called "Java Card" technology, to use a virtual machine implanted in an electronic entity (such as a microcircuit card) to load a sequence of instruction codes (for example as a .CAP file) in the electronic entity and execute this sequence of instruction codes.

Afin de se protéger contre certaines attaques, il est connu de vérifier la séquence de codes d’instruction avant son exécution. Une telle vérification est généralement réalisée à l’extérieur de l’entité électronique, ou, au sein même de l’entité électronique, typiquement lors du chargement de la séquence de codes d’instruction.In order to protect against certain attacks, it is known to check the sequence of instruction codes before it is executed. Such a check is generally performed outside the electronic entity, or, within the electronic entity itself, typically during the loading of the instruction code sequence.

Comme expliqué par exemple dans l’article "The Ultimate Control Flow Transfer in a Java Based Smart Card', de Guillaume Bouffart et Jean-Louis Lanet, in Computers & Security 2015, les techniques de vérification actuelles ne permettent toutefois pas de détecter du code inatteignable (en anglais : "unreachable code"), à savoir des codes d’instruction présents dans une partie d’une séquence où le flux de commande (en anglais : "control flow") ne passe jamais en fonctionnement normal.As explained for example in the article "The Ultimate Control Flow Transfer in a Java Based Smart Card", by Guillaume Bouffart and Jean-Louis Lanet, in Computers & Security 2015, the current verification techniques do not make it possible to detect unreachable code (in English: "unreachable code"), namely instruction codes present in a part of a sequence where the control flow (in English: "control flow") never goes into normal operation.

Un tel code inatteignable peut en revanche être exécuté lorsqu’un attaquant met en œuvre une attaque par faute qui permet de s’écarter du flux de commande normal.Such unreachable code may, however, be executed when an attacker implements a fault attack that deviates from the normal command stream.

Objet de l’inventionObject of the invention

Dans ce contexte, la présente invention propose un procédé de chargement, au sein d’une mémoire d’une entité électronique, d’une séquence de codes d’instruction exécutables par une machine virtuelle résidant dans l’entité électronique, caractérisé par les étapes suivantes : - détection d’un code d’instruction contenu dans une liste prédéterminée de codes d’instruction ; - conversion d’une paire formée du code détecté et d’un code situé dans la séquence à une position relative prédéterminée par rapport au code détecté, en une paire distincte de codes selon une règle prédéterminée ; - écriture de la paire distincte dans la mémoire en remplacement de la paire formée du code détecté et du code situé à ladite position relative.In this context, the present invention proposes a method of loading, within a memory of an electronic entity, a sequence of instruction codes executable by a virtual machine resident in the electronic entity, characterized by the steps following: - detection of an instruction code contained in a predetermined list of instruction codes; converting a pair formed of the detected code and a code located in the sequence to a predetermined relative position with respect to the detected code, into a distinct pair of codes according to a predetermined rule; writing the distinct pair into the memory instead of the pair formed of the detected code and the code located at said relative position.

Pour l’exécution d’une séquence ainsi chargée, il sera nécessaire comme expliqué ci-après de procéder à une nouvelle conversion de la paire de codes d’instruction écrite dans la mémoire. Cette nouvelle conversion ne pourra pas toutefois se dérouler correctement (et l’exécution pourra par exemple être interrompue) si un attaquant cherche à sauter (en anglais : "s/c/p") l’exécution de l’un des deux codes au moyen d’une attaque (telle qu’une attaque laser), par exemple dans le but de faire exécuter du code inatteignable comme expliqué ci-dessus. L’exécution ultérieure est ainsi protégée de telles attaques.For the execution of a sequence thus loaded, it will be necessary, as explained below, to carry out a new conversion of the pair of instruction codes written in the memory. However, this new conversion will not be able to proceed correctly (and the execution may for example be interrupted) if an attacker tries to skip (in English: "s / c / p") the execution of one of the two codes. by means of an attack (such as a laser attack), for example in order to execute unreachable code as explained above. Subsequent execution is thus protected from such attacks.

Selon d’autre caractéristiques éventuellement envisageables (sans que cela ne soit limitatif) : - le code situé à une position relative prédéterminée par rapport au code détecté est un code contigu, dans la séquence, au code détecté ; - le code contigu est le code précédant, dans la séquence, le code détecté ; - la liste prédéterminée contient l’ensemble des codes correspondant à une instruction de rupture inconditionnelle du flux de commande ; - les codes de la séquence correspondent à des codes normalisés selon une spécification donnée (éventuellement une spécification relative à une norme) ; - les codes de la paire distincte correspondent à des codes inutilisés selon ladite spécification donnée ; - l’étape de conversion comprend une étape de lecture, dans une table de correspondance, de la paire distincte associée à la paire formée du code détecté et du code situé à ladite position relative ; - l’étape de conversion comprend une étape d’application d’une fonction arithmétique à la paire formée du code détecté et du code situé à ladite position relative. L’invention propose également un procédé d’exécution d’une séquence de codes d’instruction par une machine virtuelle résidant sur une entité électronique, comprenant les étapes suivantes : - en cas de lecture d’un code d’instruction appartenant à une liste prédéfinie de codes, conversion, selon une règle prédéterminée, d’une paire formée par le code lu et par le code situé à une position relative prédéterminée par rapport au code lu, en une paire distincte de codes comprenant un premier code et un second code ; - exécution, par la machine virtuelle, d’une instruction définie au moins en partie par le premier code. L’instruction ne sera donc exécutée que si l’étape de conversion a pu, comme cela est prévu en fonctionnement normal, déterminer le premier code (ainsi que le second code) sur la base de la paire formée par le code lu et par le code situé à ladite position relative ; la conversion échouera en revanche si un attaquant empêche le traitement de l’un de ces deux codes pour tenter d’exécuter du code inatteignable.According to other possible features that may be envisaged (without being limiting): the code situated at a predetermined relative position with respect to the detected code is a code contiguous, in the sequence, with the detected code; the contiguous code is the code preceding, in the sequence, the detected code; the predetermined list contains all the codes corresponding to an unconditional instruction for breaking the control flow; the codes of the sequence correspond to codes standardized according to a given specification (possibly a specification relating to a standard); the codes of the distinct pair correspond to unused codes according to said given specification; the conversion step comprises a step of reading, in a correspondence table, the distinct pair associated with the pair formed of the detected code and the code situated at said relative position; the conversion step comprises a step of applying an arithmetic function to the pair formed of the detected code and the code located at said relative position. The invention also proposes a method of executing a sequence of instruction codes by a virtual machine residing on an electronic entity, comprising the following steps: - if reading an instruction code belonging to a list predefined code, conversion, according to a predetermined rule, of a pair formed by the read code and the code located at a predetermined relative position with respect to the read code, into a distinct pair of codes comprising a first code and a second code ; execution by the virtual machine of an instruction defined at least in part by the first code. The instruction will therefore only be executed if the conversion step could, as is expected during normal operation, determine the first code (as well as the second code) on the basis of the pair formed by the read code and the code located at said relative position; the conversion will fail, however, if an attacker prevents the processing of one of these two codes in an attempt to execute unreachable code.

Selon d’autre caractéristiques éventuellement envisageables (sans que cela ne soit limitatif) : - le code situé à ladite position relative est le code suivant le code lu ; - le procédé comprend une étape d’exécution, par la machine virtuelle, d’une autre instruction définie au moins en partie par le second code ; - l’autre instruction est une instruction de rupture inconditionnelle du flux de commande ; - le premier code et le second code correspondent à des codes normalisés selon une spécification donnée ; - les codes de la liste prédéfinie correspondent à des codes inutilisés selon ladite spécification donnée ; - l’étape de conversion comprend une étape de lecture, dans une table de correspondance, de la paire distincte associée à la paire formée par le code lu et par le code situé à ladite position relative ; - l’étape de conversion comprend une étape d’application d’une fonction arithmétique à la paire formée par le code lu et par le code situé à ladite position relative ; - le procédé comprend une étape de vérification que la paire formée par le code lu et par le code situé à ladite position relative fait partie d’un ensemble de paires possibles (c’est-à-dire en pratique que la paire formée par le code lu et par le code suivant fait partie d’une liste préétablie de paires).According to other possible features that may be envisaged (without being limiting): the code situated at said relative position is the code following the code read; the method comprises a step of execution, by the virtual machine, of another instruction defined at least in part by the second code; the other instruction is an instruction of unconditional breaking of the control flow; the first code and the second code correspond to standardized codes according to a given specification; the codes of the predefined list correspond to unused codes according to said given specification; the conversion step comprises a step of reading, in a correspondence table, the distinct pair associated with the pair formed by the code read and the code located at said relative position; the conversion step comprises a step of applying an arithmetic function to the pair formed by the code read and the code located at said relative position; the method comprises a step of verifying that the pair formed by the code read and the code located at said relative position is part of a set of possible pairs (i.e. in practice that the pair formed by the code read and by the following code is part of a pre-established list of pairs).

On peut prévoir, en cas d’échec de ladite vérification, la mise en œuvre d’une fonction de traitement d’erreur (comprenant par exemple l’inscription en mémoire non-volatile d’un code d’erreur et/ou le blocage de tout fonctionnement ultérieur de l’entité électronique et/ou l’effacement de certaines données au moins de l’entité électronique). L’invention propose également un procédé mis en œuvre dans une entité électronique comprenant un procédé de chargement tel que décrit ci-dessus et un procédé d’exécution tel que décrit ci-dessus. L’invention propose en outre une entité électronique comprenant une machine virtuelle, une mémoire et un module de chargement, au sein de la mémoire, d’une séquence de codes d’instruction exécutables par la machine virtuelle, caractérisée en ce que le module de chargement est conçu pour détecter un code d’instruction contenu dans une liste prédéterminée de codes d’instruction, pour convertir une paire formée du code détecté et d’un code situé dans la séquence à une position relative prédéterminée par rapport au code détecté, en une paire distincte de codes selon une règle prédéterminée, et pour écrire la paire distincte dans la mémoire en remplacement de la paire formée du code détecté et du code situé à ladite position relative. L’invention propose enfin une entité électronique comprenant une machine virtuelle et une mémoire, caractérisée par un module d’exécution conçu pour convertir selon une règle prédéterminée, en cas de lecture dans la mémoire d’un code d’instruction appartenant à une liste prédéfinie de codes, une paire formée par le code lu et par le code situé à une position relative prédéterminée par rapport au code lu, en une paire distincte de codes comprenant un premier code et un second code, la machine virtuelle étant conçue pour exécuter une instruction définie au moins en partie par le premier code.In case of failure of said verification, the implementation of an error processing function (including for example the non-volatile memory registration of an error code and / or the blocking) can be provided. any subsequent operation of the electronic entity and / or erasure of at least some data from the electronic entity). The invention also proposes a method implemented in an electronic entity comprising a charging method as described above and a method of execution as described above. The invention also proposes an electronic entity comprising a virtual machine, a memory and a loading module, within the memory, of a sequence of instruction codes executable by the virtual machine, characterized in that the module of loading is designed to detect an instruction code contained in a predetermined list of instruction codes, for converting a pair formed of the detected code and a code located in the sequence to a predetermined relative position with respect to the detected code, in a distinct pair of codes according to a predetermined rule, and for writing the distinct pair into the memory instead of the pair formed of the detected code and the code located at said relative position. The invention finally proposes an electronic entity comprising a virtual machine and a memory, characterized by an execution module designed to convert according to a predetermined rule, when reading in the memory of an instruction code belonging to a predefined list. codes, a pair formed by the read code and the code located at a predetermined relative position with respect to the read code, into a distinct pair of codes comprising a first code and a second code, the virtual machine being adapted to execute an instruction defined at least in part by the first code.

Les caractéristiques optionnelles présentées ci-dessus en termes de procédé peuvent également s’appliquer à ces entités électroniques.The optional features presented above in terms of method can also be applied to these electronic entities.

Par ailleurs, lorsque l’entité électronique comprend un processeur, le module de chargement et/ou le module d’exécution peuvent être mis en oeuvre du fait de l’exécution d’instructions (mémorisées dans la mémoire susmentionnée ou une autre mémoire) par le processeur.Furthermore, when the electronic entity comprises a processor, the loading module and / or the execution module can be implemented because of the execution of instructions (stored in the aforementioned memory or another memory) by the processor.

Description detaillee d’un exemple de réalisationDetailed description of an example of realization

La description qui va suivre en regard des dessins annexés, donnés à titre d’exemples non limitatifs, fera bien comprendre en quoi consiste l’invention et comment elle peut être réalisée.The following description with reference to the accompanying drawings, given by way of non-limiting examples, will make it clear what the invention consists of and how it can be achieved.

Sur les dessins annexés : - la figure 1 représente schématiquement une entité électronique conforme à l’invention ; - la figure 2 est un logigramme présentant un procédé de chargement d’une application dans l’entité électronique de la figure 1 ; et - la figure 3 est un logigramme présentant un procédé d’exécution d’une application au sein de l’entité électronique de la figure 1.In the accompanying drawings: FIG. 1 schematically represents an electronic entity according to the invention; FIG. 2 is a logic diagram showing a method for loading an application in the electronic entity of FIG. 1; and FIG. 3 is a logic diagram showing a method of executing an application within the electronic entity of FIG. 1.

La figure 1 représente schématiquement une entité électronique conforme à l’invention. L’entité électronique est ici un élément sécurisé, par exemple une carte à microcircuit C (éventuellement une carte à circuit intégré universelle ou U ICC pour "Universal Integrated Circuit Card"). Une telle carte à microcircuit C est par exemple montée de manière amovible dans un dispositif électronique tel qu’un téléphone cellulaire. Il s’agit généralement dans ce cas d’une carte SIM (pour "Subscriber Identity Module"). L’entité électronique pourrait être en variante un autre type d’élément sécurisé, par exemple un élément sécurisé intégré (ou eSE pour "embedded Secure Elément'). Un tel élément sécurisé peut être soudé au sein d’un dispositif électronique tel qu’un téléphone cellulaire. Il peut s’agir d’une carte à circuit intégré universelle intégrée ou eUlCC pour "embedded Universal Integrated Circuit Card'. L’entité électronique pourrait également être une carte de type SD (par exemple une carte SD, "secure microSD” ou "microSD"), par exemple avec un masque Java Card.Figure 1 shows schematically an electronic entity according to the invention. The electronic entity is here a secure element, for example a microcircuit card C (possibly a universal integrated circuit card or U ICC for "Universal Integrated Circuit Card"). Such microcircuit card C is for example removably mounted in an electronic device such as a cell phone. In this case, it is generally a SIM card (for "Subscriber Identity Module"). The electronic entity could alternatively be another type of secure element, for example an integrated secure element (or eSE for "embedded Secure Element"). Such a secure element can be soldered within an electronic device such as A cellular phone can be an integrated universal integrated circuit card or eUlCC for embedded Universal Integrated Circuit Card. The electronic entity could also be an SD type card (for example an SD card, "secure microSD" or "microSD"), for example with a Java Card mask.

Selon une autre variante encore, l’entité électronique pourrait être un ordinateur personnel ou une carte de transport, par exemple. L’entité électronique comprend un processeur PROC, une mémoire MEM et au moins une interface I.According to yet another variant, the electronic entity could be a personal computer or a transport card, for example. The electronic entity comprises a processor PROC, a memory MEM and at least one interface I.

Le processeur PROC est par exemple réalisé sous la forme d’un microprocesseur.The processor PROC is for example made in the form of a microprocessor.

La mémoire MEM est ici une mémoire non-volatile réinscriptible. L’entité électronique peut comprendre d’autres mémoires (non représentées), par exemple une mémoire vive.The memory MEM here is a rewritable non-volatile memory. The electronic entity may comprise other memories (not shown), for example a random access memory.

Certains au moins des éléments précités peuvent en pratique être réunis au sein d’un même circuit électronique tel qu’un microcontrôleur. L’interface I permet la connexion de l’entité électronique à un dispositif électronique extérieur (tel qu’un lecteur de carte équipant un téléphone cellulaire) et l’échange de données entre les circuits électroniques (en particulier le processeur PROC) de l’entité électronique et le dispositif électronique extérieur.At least some of the aforementioned elements can in practice be brought together in the same electronic circuit such as a microcontroller. The interface I allows the connection of the electronic entity to an external electronic device (such as a card reader equipping a cellular telephone) and the exchange of data between the electronic circuits (in particular the PROC processor) of the electronic entity and the external electronic device.

Lorsque l’entité électronique est une carte à microcircuit C comme décrit ici (par exemple au format défini par la norme ISO/IEC 7816), l’interface I peut comprendre une pluralité de contacts électriques disposés au niveau de la surface extérieure de la carte à microcircuit C. En variante, l’interface I pourrait être réalisée par des moyens de communication sans contact, par exemple conformément à la norme ISO/IEC 14443. L’entité électronique (ici la carte à microcircuit C) pourrait comprendre des deux types d’interface et utiliser l’une ou l’autre selon son mode de fonctionnement.When the electronic entity is a microcircuit card C as described herein (for example in the format defined by ISO / IEC 7816), the interface I may comprise a plurality of electrical contacts arranged at the outer surface of the card As a variant, the interface I could be made by non-contact communication means, for example in accordance with the ISO / IEC 14443 standard. The electronic entity (in this case the microcircuit card C) could comprise of two types. interface and use one or the other according to its mode of operation.

La mémoire MEM mémorise un premier ensemble d’instructions conçues pour mettre en œuvre un module de chargement (ou installateur) LD.M lorsque ces instructions sont exécutées par le processeur PROC.The memory MEM memorizes a first set of instructions designed to implement a loading module (or installer) LD.M when these instructions are executed by the processor PROC.

Comme expliqué plus loin en référence à la figure 2, le module de chargement LD.M permet de recevoir une application AP P sur l’interface I, de traiter cette application AP P pour en obtenir une version modifiée APP’ et de mémoriser la version modifiée APP’ dans la mémoire MEM. L’application APP est reçue sous forme d’une séquence de codes d’instruction exécutables. Par exemple, dans le cadre de la technologie dénommée "Java Card", l’application APP (couramment désignée "appliquette") est reçue sous forme d’un fichier CAP. Dans ce même contexte, les codes d’instruction sont définis sur un octet (ce pour quoi ils sont couramment désignés par l’appellation "bytecode").As explained below with reference to FIG. 2, the loading module LD.M makes it possible to receive an application AP P on the interface I, to process this application AP P to obtain a modified version APP 'and to memorize the version modified APP 'in MEM memory. The APP application is received as a sequence of executable instruction codes. For example, as part of the so-called "Java Card" technology, the APP application (commonly known as "applet") is received as a CAP file. In this same context, the instruction codes are defined on one byte (for which they are commonly referred to by the name "bytecode").

La mémoire MEM mémorise un second ensemble d’instructions conçues pour mettre en œuvre un module d’exécution (ou interpréteur) EX.M lorsque ces instructions sont exécutées par le processeur PROC.The memory MEM stores a second set of instructions designed to implement an execution module (or interpreter) EX.M when these instructions are executed by the processor PROC.

Comme expliqué plus loin en référence à la figure 3, le module d’exécution EX.M permet de lire des codes d’instruction dans la mémoire MEM, de traiter éventuellement ces codes comme décrit ci-dessous, et de mettre en œuvre les instructions désignées par ces codes (après traitement éventuel).As explained further with reference to FIG. 3, the execution module EX.M makes it possible to read instruction codes in the memory MEM, to possibly process these codes as described below, and to implement the instructions. designated by these codes (after possible treatment).

Le module de chargement LD.M et le module d’exécution EX.M font par exemple partie d’une machine virtuelle, ici une machine virtuelle selon la technologie "Java Card” précitée.The loading module LD.M and the execution module EX.M are for example part of a virtual machine, here a virtual machine according to the aforementioned "Java Card" technology.

La figure 2 est un logigramme présentant un procédé de chargement d’une application dans l’entité électronique de la figure 1.FIG. 2 is a logic diagram showing a method for loading an application in the electronic entity of FIG. 1.

Ce procédé débute à l’étape E2 à laquelle le module de chargement LD.M reçoit via l’interface I une séquence de codes d’instruction formant une application APPL, ici sous forme d’un fichier CAP.This method starts in step E2 at which the loading module LD.M receives via the interface I a sequence of instruction codes forming an APPL application, here in the form of a CAP file.

La séquence de codes d’instruction est alors par exemple mémorisée dans une mémoire vive (non-représentée) associée au processeur PROC.The sequence of instruction codes is then for example stored in a random access memory (not shown) associated with the processor PROC.

Le procédé ci-dessous est alors mis en œuvre pour chacune des méthodes définies dans le fichier .CAP concerné.The method below is then implemented for each of the methods defined in the concerned .CAP file.

Le module de chargement LD.M parcourt la séquence de codes d’instruction jusqu’à détecter une première instruction de rupture inconditionnelle du flux de commande (en anglais : "unconditional control flow breaK'). (Une telle détection est réalisée en pratique en comparant successivement chacun des codes d’instruction de la séquence aux différents codes correspondant à une instruction de rupture inconditionnelle du flux de commande.)The loading module LD.M traverses the sequence of instruction codes until it detects a first instruction of unconditional breaking of the control flow (in English: "unconditional control flow breaK"). (Such a detection is carried out in practice in successively comparing each of the instruction codes of the sequence to the different codes corresponding to an instruction of unconditional breaking of the control flow.)

Les instructions de rupture inconditionnelle du flux de commande comprennent par exemple les instructions de saut inconditionnel (telles que l’instruction "goto") et les instructions de retour d’un sous-programme (telles que l’instruction "sreturn"). Les instructions de rupture inconditionnelle du flux de commande comprennent ici (suivies chacune du code d’instruction correspondant en hexadécimal) :Unconditional termination instructions for the control stream include, for example, unconditional jump instructions (such as the "goto" instruction) and return instructions from a subroutine (such as the "sreturn" instruction). The instructions for unconditional termination of the control stream here (each followed by the corresponding instruction code in hexadecimal):

Goto (0x70) ; - Ret (0x72) ;Goto (0x70); - Ret (0x72);

Areturn (0x77) ;Areturn (0x77);

Sreturn (0x78) ;Sreturn (0x78);

Ireturn (0x79) ;Ireturn (0x79);

Return (0x7A) ;Return (0x7A);

Athrow (0x93) ;Athrow (0x93);

Goto_w (0xA8).Goto_w (0xA8).

Le module de chargement peut alors déterminer à l’étape E4 si la première instruction de rupture inconditionnelle du flux de commande est une instruction de retour (telle que l’instruction "return" dans le cadre de la technologie "Java CarcT) et si aucune instruction de branchement (conditionnel ou inconditionnel) n’a été rencontrée.The loading module can then determine in step E4 whether the first unconditional breaking command of the control flow is a return instruction (such as the "return" instruction in the context of the "Java CarcT" technology) and if no branch instruction (conditional or unconditional) was encountered.

Si tel est le cas (une telle instruction de retour étant conçue pour mettre fin à la méthode décrite par le fichier .CAP concerné, sans possibilité de saut préalable à une autre adresse), le procédé se poursuit à l’étape E6 à laquelle le module de chargement LD.M remplace tout code d’instruction jusqu’à la fin de la méthode en cours par un code prédéterminé, correspondant par exemple à une instruction de retour ou une instruction propriétaire avec pour effet par exemple la récupération de la valeur d’erreur, l’incrémentation d’un compteur ou encore la désactivation de la carte. En variante l’utilisation d’une instruction sans effet, telle que l’instruction "nop" est également possible.If this is the case (such a return instruction being designed to terminate the method described by the .CAP file concerned, without the possibility of previous jump to another address), the method continues in step E6 at which the loading module LD.M replaces any instruction code until the end of the current method with a predetermined code, corresponding for example to a return instruction or a proprietary instruction with the effect, for example, of recovering the value d error, the incrementation of a counter or the deactivation of the card. Alternatively the use of an instruction without effect, such as the instruction "nop" is also possible.

En effet, tout code présent après une instruction de retour sans instruction de branchement préalable correspond nécessairement à du code inatteignable (comme expliqué en introduction), qui est ainsi supprimé grâce à l’étape E6. S’il est en revanche déterminé à l’étape E4 que la première instruction de rupture inconditionnelle du flux de commande n’est pas une instruction de retour ou si une instruction de branchement (conditionnel ou inconditionnel) a été rencontrée, le procédé se poursuit à l’étape E8 pour traitement de l’instruction de rupture inconditionnelle du flux de commande.In fact, any code present after a return instruction without a prior connection instruction necessarily corresponds to unreachable code (as explained in the introduction), which is thus eliminated by the step E6. If, on the other hand, it is determined in step E4 that the first unconditional instruction of the control flow is not a return instruction or if a branch instruction (conditional or unconditional) has been encountered, the process continues. in step E8 for processing the instruction of unconditional breaking of the control flow.

Le module de chargement LD.M détermine à l’étape E8 la paire P formée (ici dans l’ordre inverse) par le code de l’instruction détecté y et le code précédent dans la séquence de codes d’instruction x, et convertit cette paire P=(x,y) en une paire distincte F(P) selon une règle prédéterminée, ici une bijection F. (Selon un mode de réalisation envisageable, la règle prédéterminée est connue seulement de l’entité électronique et variable d’une entité électronique à une entité électronique différente.)The loading module LD.M determines in step E8 the pair P formed (here in reverse order) by the code of the detected instruction y and the preceding code in the sequence of instruction codes x, and converts this pair P = (x, y) into a distinct pair F (P) according to a predetermined rule, here a bijection F. (According to a conceivable embodiment, the predetermined rule is known only to the electronic and variable entity of an electronic entity to a different electronic entity.)

On note a et b les codes de la paire F(P).We denote a and b the codes of the pair F (P).

On prévoit ici que les codes a, b de la paire F(P) soient des codes inutilisés du jeu d’instructions concerné (ici celui prévu pour la technologie "Java Caret').Here it is provided that the codes a, b of the pair F (P) are unused codes of the set of instructions concerned (here that provided for the technology "Java Caret").

Dans l’exemple décrit ici de la technologie "Java Card", il existe 187 codes d’instructions normalisés, dont 8 correspondent à des instructions de rupture inconditionnelle du flux de commande, et 69 codes d’instructions inutilisés (les codes d’instruction étant définis sur un octet comme déjà indiqué, il existe 256 codes possibles).In the example described here of the "Java Card" technology, there are 187 standard instruction codes, 8 of which correspond to instructions for unconditional breaking of the control flow, and 69 unused instruction codes (instruction codes being defined on a byte as already indicated, there are 256 possible codes).

Il existe donc 1496 paires P possibles formées par un code normalisé x et un code normalisé y correspondant à une instruction de rupture inconditionnelle de flux de commande. On peut donc associer, à chacune de ces paires P envisageables, une paire (a, b) de codes inutilisés au moyen d’une bijection F (le nombre de telles paires de codes inutilisés étant égal à 4761 ).There are therefore 1496 possible P pairs formed by a normalized code x and a normalized code y corresponding to an unconditional control flow breaking instruction. It is therefore possible to associate, with each of these possible pairs P, a pair (a, b) of unused codes by means of a bijection F (the number of such pairs of unused codes being equal to 4761).

Selon un premier mode de réalisation envisageable, l’association de chaque paire P=(x,y) à une paire F(P)=(a,b) donnée est mémorisée dans une table de correspondance (stockée par exemple dans la mémoire MEM).According to a first conceivable embodiment, the association of each pair P = (x, y) with a given pair F (P) = (a, b) is stored in a correspondence table (stored for example in the memory MEM ).

Selon un second mode de réalisation envisageable, la paire F(P)=(a,b) est obtenue par application d’une fonction arithmétique à la paire P=(x,y).According to a second conceivable embodiment, the pair F (P) = (a, b) is obtained by applying an arithmetic function to the pair P = (x, y).

Par exemple, en associant un élément i(x) de l’ensemble Ζιβ7 à chaque code d’instruction x, un élément j(y) de l’ensemble Ze à chaque code y correspondant à une instruction de rupture inconditionnelle du flux de commande, et un élément k(a) de l’ensemble Ζθθ à chaque code inutilisé a, la paire F(P)=(a,b) associée à une paire P=(x,y) peut être déterminée par les opérations suivantes : k(a) = INT{[i(x)+187.j(y)]/69} ; k(b) = [i(x)+187.j(y)] mod 69.For example, by associating an element i (x) of the set Ζιβ7 with each instruction code x, an element j (y) of the set Ze with each code y corresponding to an instruction of unconditional breaking of the control flow , and an element k (a) from the set Ζθθ to each unused code a, the pair F (P) = (a, b) associated with a pair P = (x, y) can be determined by the following operations: k (a) = INT {[i (x) + 187.j (y)] / 69}; k (b) = [i (x) + 187.j (y)] mod 69.

On a noté ci-dessus Zm l’ensemble des entiers compris entre 0 et (m-1).We noted above Zm the set of integers between 0 and (m-1).

Le module de chargement LD.M remplace alors, dans la séquence de codes d’instruction, la paire P (dont le second membre y a été détecté comme correspondant à une instruction de rupture inconditionnelle du flux de commande) par la paire F(P) obtenue à l’étape E8, ce qui permet de former une séquence de codes d’instruction modifiée AP PL’ (étape E10).The loading module LD.M then replaces, in the sequence of instruction codes, the pair P (whose second member has been detected therein corresponding to an unconditional instruction of breaking of the control flow) by the pair F (P ) obtained in step E8, which makes it possible to form a sequence of modified instruction codes AP PL '(step E10).

Le module de chargement LD.M poursuit alors son parcours de la séquence de codes d’instruction en recherchant un autre code correspondant à une instruction de rupture inconditionnelle du flux de commande (étape E12).The loading module LD.M then continues its course of the sequence of instruction codes by searching for another code corresponding to an unconditional instruction for breaking the control flow (step E12).

Si un tel code est trouvé, le procédé boucle à l’étape E8 pour traitement de ce nouveau code correspondant à une instruction de rupture inconditionnelle du flux de commande.If such a code is found, the method loops in step E8 for processing this new code corresponding to an unconditional instruction of breaking the control flow.

Si en revanche la fin de la séquence d’instructions est parcourue sans rencontrer un nouveau code correspondant à une instruction de rupture inconditionnelle du flux de commande, le module de chargement LD.M procède à l’étape E14 à l’enregistrement de la séquence de codes d’instruction modifiée APPL’ dans la mémoire MEM.If, on the other hand, the end of the instruction sequence is traversed without encountering a new code corresponding to an instruction of unconditional breaking of the control flow, the load module LD.M proceeds to step E14 at the recording of the sequence of modified instruction codes APPL 'in the memory MEM.

On décrit à présent à titre purement illustratif un exemple d’application du procédé de la figure 2 sur une partie d’une séquence de codes d’instruction : bspush 0x55 0x10 0x55 sstore_3 0x32 goto @0x4 0x70 0x4 sconst_0 0x3 (où on a représenté à gauche les instructions qui correspondent à cette partie de séquence et à droite les codes d’instruction correspondants en hexadécimal).An exemplary application of the method of FIG. 2 to a part of a sequence of instruction codes is described below: bspush 0x55 0x10 0x55 sstore_3 0x32 goto @ 0x4 0x70 0x4 sconst_0 0x3 (where it is shown on the left the instructions that correspond to this part of the sequence and to the right the corresponding instruction codes in hexadecimal).

Le module de chargement LD.M parcourt la séquence de codes d’instruction et détecte l’instruction goto (précisément le code 0x70) qui est une instruction de rupture inconditionnelle du flux de commande (à l’étape E4 s’il s’agit de la première telle instruction, ou à l’étape E12 sinon).The loading module LD.M traverses the sequence of instruction codes and detects the instruction goto (precisely the code 0x70) which is an instruction of unconditional breaking of the control flow (in step E4 if it is of the first such instruction, or in step E12 otherwise).

Le module de chargement LD.M convertit alors (étape E8) la paire P formée du code précédent x=0x32 et du code détecté y=0x70 en une paire F(P)=(a,b), avec par exemple a=0xC1 et b=0xBB (la notation Ox introduisant comme indiqué ci-dessus un nombre en hexadécimal).The loading module LD.M then converts (step E8) the pair P formed of the preceding code x = 0x32 and the detected code y = 0x70 into a pair F (P) = (a, b), with for example a = 0xC1 and b = 0xBB (the notation Ox introducing as above a number in hexadecimal).

La séquence modifiée obtenue (à l’étape E10) est donc la suivante : 0x10 0x55 0xC1 OxBB 0x4 0x3.The modified sequence obtained (in step E10) is thus the following: 0x10 0x55 0xC1 OxBB 0x4 0x3.

Cette séquence est enregistrée dans la mémoire MEM à l’étape E14.This sequence is stored in the memory MEM in step E14.

La figure 3 est un logigramme présentant un procédé d’exécution de l’application APPL’ (qui correspond à la séquence de codes d’instruction enregistrée lors du procédé qui vient d’être décrit en référence à la figure 2) au sein de l’entité électronique de la figure 1.FIG. 3 is a logic diagram showing a method of executing the application APPL '(which corresponds to the sequence of instruction codes recorded during the process which has just been described with reference to FIG. 2) within the electronic entity of Figure 1.

Comme déjà indiqué, un tel procédé est ici mis en œuvre par un module d’exécution EX.M.As already indicated, such a method is here implemented by an execution module EX.M.

Ce procédé débute à l’étape E20 à laquelle le module d’exécution EX.M (c’est-à-dire en pratique le processeur PROC) lit dans la mémoire MEM un code CODn de la séquence de codes d’instruction APPL’. (On remarque qu’il est possible en variante que la séquence de codes d’instruction APPL’ soit au préalable chargée dans une mémoire vive, où les codes de cette séquence sont alors successivement lus par le processeur PROC.)This method starts at step E20 at which the execution module EX.M (i.e. in practice the processor PROC) reads in the memory MEM a code CODn of the sequence of instruction codes APPL ' . (Note that it is possible in a variant that the sequence of instruction codes APPL 'is previously loaded into a random access memory, where the codes of this sequence are then successively read by the processor PROC.)

Lors du premier passage à l’étape E20, ce code CODn est le premier code de la séquence de codes d’instruction.During the first pass to step E20, this code CODn is the first code of the sequence of instruction codes.

Le module d’exécution EX.M détermine alors à l’étape E22 si le code CODn lu fait partie d’une liste prédéfinie L de codes d’instruction (qui correspond ici à l’ensemble des codes utilisés comme premier membre a d’une paire F(P) lorsque la paire P parcourt l’ensemble des paires P envisageables).The execution module EX.M then determines in step E22 whether the read code CODn is part of a predefined list L of instruction codes (which here corresponds to all the codes used as the first member a of a pair F (P) when the pair P traverses the set of possible pairs P).

Dans la négative, le code CODn lu est exécuté de manière conventionnelle à l’étape E24 : il s’agit normalement soit d’un code normalisé correspondant à une instruction (que le module d’exécution EX.M met alors en œuvre comme prévu par la norme ou la spécification concernée), soit d’un paramètre associé à un code normalisé traité à l’itération précédente. Si un code normalisé est attendu et que la valeur du code CODn lu ne correspond pas à un code normalisé, une erreur est détectée et l’exécution de la séquence de codes est par exemple interrompue.If not, the read CODn code is executed conventionally in step E24: it is normally either a normalized code corresponding to an instruction (that the execution module EX.M then implements as expected by the standard or specification concerned), or a parameter associated with a standard code processed at the previous iteration. If a normalized code is expected and the value of the code CODn read does not correspond to a normalized code, an error is detected and the execution of the code sequence is for example interrupted.

Le procédé boucle à l’étape E20 après traitement du code courant CODn.The process is looped in step E20 after treatment of the current code CODn.

Dans le cas de l’exemple de partie de séquence donné ci-dessus, le module d’exécution EX.M procède ainsi à l’étape E24 lorsqu’il lit le code 0x10 (code normalisé correspondant à l’instruction bspush), puis le code 0x55 (paramètre attendu de l’instruction bspush). S’il est en revanche déterminé à l’étape E22 que le code CODn lu fait partie de la liste prédéfinie L de codes d’instruction, le module d’exécution EX.M (c’est-à-dire en pratique le processeur PROC) lit à l’étape E26 le code d’instruction suivant CODn+i (dans la mémoire MEM ou, en variante comme déjà indiqué, dans une mémoire vive où a momentanément été recopiée la séquence de codes d’instruction APPL’).In the case of the example of sequence part given above, the execution module EX.M thus proceeds to step E24 when it reads the code 0x10 (standard code corresponding to the bspush instruction), then the code 0x55 (expected parameter of the bspush instruction). If, on the other hand, it is determined in step E22 that the read code CODn is part of the predefined list L of instruction codes, the execution module EX.M (that is to say in practice the processor PROC) reads in step E26 the following instruction code CODn + i (in the memory MEM or, alternatively as already indicated, in a random access memory where the sequence of instruction codes APPL 'has been copied for a moment).

Le module d’exécution EX.M peut alors vérifier à l’étape E28 que la paire (CODn, CODn+i) formée des deux codes successifs (successivement lus aux étapes E20 et E26) correspond bien à l’une des paires F(P) possibles (c’est-à-dire à l’une des paires F(P) obtenues lorsque la paire P parcourt l’ensemble des paires possibles).The execution module EX.M can then verify in step E28 that the pair (CODn, CODn + i) formed of the two successive codes (successively read in steps E20 and E26) corresponds to one of the pairs F ( P) possible (that is to say, to one of the pairs F (P) obtained when the pair P traverses the set of possible pairs).

Dans la négative, la séquence de codes lus ne correspond pas à la séquence telle qu’elle a été enregistrée à l’étape E14 décrite plus haut. Ce problème provient par exemple du fait qu’un attaquant a réussi à faire passer (en anglais : "s/c/p") une instruction sans qu’elle soit prise en compte, dans le but d’atteindre une zone de code inatteignable comme décrit en introduction. On procède donc dans ce cas à l’étape E30 à un traitement d’erreur, qui met par exemple fin à l’exécution de la séquence de codes d’instruction APPL’.If not, the sequence of codes read does not correspond to the sequence as recorded in step E14 described above. This problem comes for example from the fact that an attacker managed to pass (in English: "s / c / p") an instruction without it being taken into account, in order to reach an unreachable code area as described in the introduction. In this case, therefore, in step E30, an error processing is carried out, which ends, for example, the execution of the sequence of instruction codes APPL '.

Si en revanche la paire (CODn, CODn+i) formée des deux codes successifs correspond bien à l’une des paires F(P) possibles, le module d’exécution EX.M convertit à l’étape E32 cette paire (CODn, CODn+i) en une paire distincte (COD’n, COD’n+i) selon une règle prédéterminée, ici en appliquant la fonction inverse F'1 de la bijection F utilisée au cours du chargement de la séquence de codes d’instruction APPL’ comme décrit plus haut.If, on the other hand, the pair (CODn, CODn + i) formed of the two successive codes corresponds to one of the possible pairs F (P), the execution module EX.M converts in step E32 this pair (CODn, CODn + i) in a distinct pair (COD'n, COD'n + i) according to a predetermined rule, here by applying the inverse function F'1 of the bijection F used during the loading of the instruction code sequence APPL 'as described above.

On a donc ici (COD’n, COD’n+1) = F1[(CODn, COD„+i)].So here we have (COD'n, COD'n + 1) = F1 [(CODn, COD "+ i)].

Selon le premier mode de réalisation déjà mentionné plus haut, l’association de chaque paire P à une paire F(P) est mémorisée dans une table de correspondance, qui peut donc également être utilisée (en sens inverse) pour déterminer la paire F'1[(CODn, CODn+i)] à partir de la paire (CODn, CODn+i).According to the first embodiment already mentioned above, the association of each pair P with a pair F (P) is stored in a correspondence table, which can therefore also be used (in the opposite direction) to determine the pair F ' 1 [(CODn, CODn + i)] from the pair (CODn, CODn + i).

Selon un second mode de réalisation envisageable, la paire F'1[(CODn, CODn+i)] est obtenue par application d’une fonction arithmétique à la paire (CODn, CODn+i).According to a second conceivable embodiment, the pair F'1 [(CODn, CODn + i)] is obtained by applying an arithmetic function to the pair (CODn, CODn + i).

Dans le cas donné ci-dessus où (a,b)=F[(x,y)] avec : k(a) = INT{[i(x)+187.j(y)]/69} ; k(b) = [i(x)+187.j(y)j mod 69, la fonction inverse F"1 est par exemple mise en œuvre comme suit : i(COD’n) = [k(CODn+i) + 69.k(CODn)] mod 187, j(COD’n+i) = INT{[k(CODn+1) + 69.k(CODn)]/187.In the case given above where (a, b) = F [(x, y)] with: k (a) = INT {[i (x) + 187.j (y)] / 69}; k (b) = [i (x) + 187.j (y) j mod 69, the inverse function F "1 is for example implemented as follows: i (COD'n) = [k (CODn + i) + 69.k (CODn)] mod 187, j (COD'n + i) = INT {[k (CODn + 1) + 69.k (CODn)] / 187.

On retrouve ainsi les deux codes d’instruction initialement présents dans la séquence de codes d’instruction APPL reçue à l’étape E2 décrite plus haut.There are thus the two instruction codes initially present in the sequence of instruction codes APPL received in step E2 described above.

Les codes COD’n, COD’n+i de la paire obtenue par l’étape de conversion E32 sont alors successivement exécutés de manière conventionnelle.The codes COD'n, COD'n + i of the pair obtained by the conversion step E32 are then successively executed in a conventional manner.

Dans l’exemple décrit ici, le premier code COD’n peut être soit un code normalisé correspondant à une instruction (que le module d’exécution EX.M met alors en oeuvre comme prévu par la norme ou la spécification concernée), soit un paramètre associé à un code normalisé précédemment traité ; le second code COD’n+i est quant à lui ici nécessairement un code associé à une instruction de rupture inconditionnelle du flux de commande (qui sera alors exécuté, éventuellement après lecture du code suivant correspondant à un paramètre associé au code COD’n+i).In the example described here, the first code COD'n can be either a standardized code corresponding to an instruction (that the execution module EX.M then implements as provided by the standard or specification concerned), or a parameter associated with a previously processed standard code; the second code COD'n + i is in turn necessarily a code associated with an unconditional breaking command of the control flow (which will then be executed, possibly after reading the following code corresponding to a parameter associated with the code COD'n + i).

Le procédé boucle ensuite à l’étape E20 pour lecture du code suivant.The method then loops to step E20 for reading the next code.

Dans le cas de la partie de séquence de codes d’instruction donnée plus haut à titre d’exemple, le module d’exécution EX.M détermine à l’étape E22 que le code 0xC1 fait partie de la liste prédéfinie L, lit par conséquent à l’étape E26 le code suivant OxBB, vérifie à l’étape E28 que la paire (0xC1, OxBB) est une paire F(P) possible, puis convertit cette paire (0xC1, OxBB) en la paire initiale (0x32, 0x70) à l’étape E32.In the case of the instruction code sequence part given above by way of example, the execution module EX.M determines in step E22 that the code 0xC1 is part of the predefined list L, read by therefore in step E26 the following code OxBB, checks in step E28 that the pair (0xC1, OxBB) is a possible pair F (P), and then converts this pair (0xC1, OxBB) to the initial pair (0x32, 0x70) in step E32.

Le module d’exécution EX.M exécute alors l’instruction sstore_3 (correspondant au code 0x32), puis l’instruction goto @0x4 (après un nouveau passage à l’étape E20 pour lire le code suivant 0x4).The execution module EX.M then executes the instruction sstore_3 (corresponding to the code 0x32), then the instruction goto @ 0x4 (after a new passage in the step E20 to read the next code 0x4).

Dans l’exemple qui vient d’être décrit, les codes convertis sont des codes contigus dans la séquence de codes d’exécution. On peut prévoir de manière générale d’utiliser une paire formée d’un premier code et d’un second code situé à une position relative prédéterminée par rapport au premier code (éventuellement non contiguë au premier code). Lors de l’exécution, on pourra alors au besoin mémoriser de manière temporaire certains codes avant leur exécution. En effet, si un premier code est lu et fait partie de la liste prédéfinie L de codes d’instruction et que le second code de la paire est situé m octets plus loin (le nombre m étant prédéterminé), le module d’exécution EX.M lit et mémorise temporairement les codes d’instruction (intermédiaires) situés entre le premier code et le second code, lit le second code, convertit la paire formée par le premier code et le second code comme décrit ci-dessus en un troisième code et un quatrième code, puis exécute les instructions définies (dans cet ordre) par le troisième code, les codes intermédiaires et le quatrième code.In the example just described, the converted codes are contiguous codes in the sequence of execution codes. In general, it is possible to use a pair formed of a first code and a second code located at a predetermined relative position with respect to the first code (possibly not contiguous to the first code). During the execution, we can then temporarily store some codes before their execution. Indeed, if a first code is read and is part of the predefined list L of instruction codes and the second code of the pair is located m bytes further (the number m being predetermined), the execution module EX .M reads and temporarily stores the (intermediate) instruction codes located between the first code and the second code, reads the second code, converts the pair formed by the first code and the second code as described above into a third code and a fourth code, then execute the defined instructions (in that order) by the third code, the intermediate codes and the fourth code.

Claims (19)

REVENDICATIONS 1. Procédé de chargement, au sein d’une mémoire (MEM) d’une entité électronique (C), d’une séquence (APPL) de codes d’instruction exécutables par une machine virtuelle résidant dans l’entité électronique (C), caractérisé par les étapes suivantes : - détection (E4 ; E12) d’un code d’instruction contenu dans une liste prédéterminée de codes d’instruction ; - conversion (E8) d’une paire formée du code détecté et d’un code situé dans la séquence (APPL) à une position relative prédéterminée par rapport au code détecté, en une paire distincte de codes (F(P)) selon une règle prédéterminée ; - écriture (E14) de la paire distincte (F(P)) dans la mémoire (MEM) en remplacement de la paire formée du code détecté et du code situé à ladite position relative.1. Method for loading, within a memory (MEM) of an electronic entity (C), a sequence (APPL) of instruction codes executable by a virtual machine resident in the electronic entity (C) characterized by the steps of: - detecting (E4; E12) an instruction code contained in a predetermined list of instruction codes; - converting (E8) a pair formed of the detected code and a code located in the sequence (APPL) to a predetermined relative position with respect to the detected code, into a distinct pair of codes (F (P)) according to a predetermined rule; - Writing (E14) of the distinct pair (F (P)) in the memory (MEM) instead of the pair formed of the detected code and the code located at said relative position. 2. Procédé de chargement selon la revendication 1, dans lequel le code situé à une position relative prédéterminée par rapport au code détecté est un code contigu, dans la séquence, au code détecté.The charging method according to claim 1, wherein the code located at a predetermined relative position with respect to the detected code is a code contiguous, in the sequence, with the detected code. 3. Procédé de chargement selon la revendication 2, dans lequel le code contigu est le code précédant, dans la séquence (APPL), le code détecté.3. Loading method according to claim 2, wherein the contiguous code is the code preceding, in the sequence (APPL), the detected code. 4. Procédé de chargement selon l’une des revendications 1 à 3, dans lequel la liste prédéterminée contient l’ensemble des codes correspondant à une instruction de rupture inconditionnelle du flux de commande.4. Loading method according to one of claims 1 to 3, wherein the predetermined list contains all the codes corresponding to an unconditional breaking command of the control flow. 5. Procédé de chargement selon l’une des revendications 1 à 4, dans lequel les codes de la séquence (APPL) correspondent à des codes normalisés selon une spécification donnée et dans lequel les codes de la paire distincte (F(P)) correspondent à des codes inutilisés selon ladite spécification donnée.The loading method according to one of claims 1 to 4, wherein the codes of the sequence (APPL) correspond to codes standardized to a given specification and in which the codes of the distinct pair (F (P)) correspond to unused codes according to said given specification. 6. Procédé de chargement selon l’une des revendications 1 à 5, dans lequel l’étape de conversion (E8) comprend une étape de lecture, dans une table de correspondance, de la paire distincte associée à la paire formée du code détecté et du code situé à ladite position relative.6. Loading method according to one of claims 1 to 5, wherein the conversion step (E8) comprises a step of reading, in a correspondence table, the distinct pair associated with the pair formed of the detected code and code located at said relative position. 7. Procédé de chargement selon l’une des revendications 1 à 5, dans lequel l’étape de conversion (E8) comprend une étape d’application d’une fonction arithmétique à la paire formée du code détecté et du code situé à ladite position relative.The loading method according to one of claims 1 to 5, wherein the converting step (E8) comprises a step of applying an arithmetic function to the pair formed of the detected code and the code located at said position. relative. 8. Procédé d’exécution d’une séquence de codes d’instruction (APPL’) par une machine virtuelle résidant sur une entité électronique, comprenant les étapes suivantes : - en cas de lecture d’un code d’instruction (CODn) appartenant à une liste prédéfinie (L) de codes, conversion (E32), selon une règle prédéterminée, d’une paire formée par le code lu (CODn) et par le code (CODn+i) situé à une position relative prédéterminée par rapport au code lu, en une paire distincte de codes comprenant un premier code (COD’n) et un second code (COD’n+i) ; - exécution (E34), par la machine virtuelle, d’une instruction définie au moins en partie par le premier code (COD’n).8. A method of executing an instruction code sequence (APPL ') by a virtual machine residing on an electronic entity, comprising the following steps: - when reading an instruction code (CODn) belonging to to a predefined list (L) of codes, conversion (E32), according to a predetermined rule, of a pair formed by the read code (CODn) and by the code (CODn + i) located at a predetermined relative position with respect to the code read, in a distinct pair of codes including a first code (COD'n) and a second code (COD'n + i); - Execution (E34), by the virtual machine, of an instruction defined at least in part by the first code (COD'n). 9. Procédé d’exécution selon la revendication 8, dans lequel le code situé à ladite position relative est le code suivant le code lu.9. The execution method according to claim 8, wherein the code located at said relative position is the code following the code read. 10. Procédé d’exécution selon la revendication 8 ou 9, comprenant une étape d’exécution, par la machine virtuelle, d’une autre instruction définie au moins en partie par le second code (COD’n+i).10. The execution method according to claim 8 or 9, comprising a step of execution, by the virtual machine, of another instruction defined at least in part by the second code (COD'n + i). 11. Procédé d’exécution selon la revendication 8 ou 9, dans lequel l’autre instruction est une instruction de rupture inconditionnelle du flux de commande.11. The execution method according to claim 8 or 9, wherein the other instruction is an unconditional command breaking command. 12. Procédé d’exécution selon l’une des revendications 8 à 11, dans lequel le premier code (COD’n) et le second code (COD’n+i) correspondent à des codes normalisés selon une spécification donnée et dans lequel les codes de la liste prédéfinie (L) correspondent à des codes inutilisés selon ladite spécification donnée.12. Method of execution according to one of claims 8 to 11, wherein the first code (COD'n) and the second code (COD'n + i) correspond to standardized codes according to a given specification and in which the codes of the predefined list (L) correspond to unused codes according to said given specification. 13. Procédé d’exécution selon l’une des revendications 8 à 12, dans lequel l’étape de conversion (E32) comprend une étape de lecture, dans une table de correspondance, de la paire distincte associée à la paire formée par le code lu et par le code situé à ladite position relative.13. The execution method according to one of claims 8 to 12, wherein the conversion step (E32) comprises a step of reading, in a correspondence table, the distinct pair associated with the pair formed by the code. read and by the code located at said relative position. 14. Procédé d’exécution selon l’une des revendications 8 à 12, dans lequel l’étape de conversion (E32) comprend une étape d’application d’une fonction arithmétique à la paire formée par le code lu et par le code situé à ladite position relative.14. The execution method according to one of claims 8 to 12, wherein the conversion step (E32) comprises a step of applying an arithmetic function to the pair formed by the code read and by the code located at said relative position. 15. Procédé d’exécution selon l’une des revendications 8 à 14, comprenant une étape de vérification (E28) que la paire formée par le code lu (CODn) et par le code suivant (CODn+i) fait partie d’un ensemble de paires possibles.15. The execution method according to one of claims 8 to 14, comprising a verification step (E28) that the pair formed by the read code (CODn) and the following code (CODn + i) is part of a set of possible pairs. 16. Procédé d’exécution selon la revendication 15, comprenant, en cas d’échec de ladite vérification (E28), la mise en œuvre d’une fonction de traitement d’erreur.16. The execution method according to claim 15, comprising, in case of failure of said verification (E28), the implementation of an error processing function. 17. Procédé mis en œuvre dans une entité électronique, comprenant un procédé de chargement selon l’une des revendications 1 à 7 et un procédé d’exécution selon l’une des revendications 8 à 16.17. A method implemented in an electronic entity, comprising a charging method according to one of claims 1 to 7 and a method of execution according to one of claims 8 to 16. 18. Entité électronique (C) comprenant une machine virtuelle, une mémoire (MEM) et un module de chargement (LD.M), au sein de la mémoire (MEM), d’une séquence (APPL) de codes d’instruction exécutables par la machine virtuelle, caractérisée en ce que le module de chargement (LD.M) est conçu pour détecter un code d’instruction contenu dans une liste prédéterminée de codes d’instruction, pour convertir une paire formée du code détecté et d’un code situé dans la séquence (APPL) à une position relative prédéterminée par rapport au code détecté, en une paire distincte de codes selon une règle prédéterminée, et pour écrire la paire distincte dans la mémoire (MEM) en remplacement de la paire formée du code détecté et du code situé à ladite position relative.18. Electronic entity (C) comprising a virtual machine, a memory (MEM) and a loading module (LD.M), within the memory (MEM), of a sequence (APPL) of executable instruction codes by the virtual machine, characterized in that the loading module (LD.M) is adapted to detect an instruction code contained in a predetermined list of instruction codes, for converting a pair formed of the detected code and a code located in the sequence (APPL) at a predetermined relative position with respect to the detected code, in a distinct pair of codes according to a predetermined rule, and for writing the distinct pair in the memory (MEM) instead of the pair formed of the code detected and code located at said relative position. 19. Entité électronique (C) comprenant une machine virtuelle et une mémoire (MEM), caractérisée par un module d’exécution (EX.M) conçu pour convertir selon une règle prédéterminée, en cas de lecture dans la mémoire (MEM) d’un code d’instruction (CODn) appartenant à une liste prédéfinie de codes, une paire formée par le code lu (CODn) et par le code (CODn+i) situé à une position relative prédéterminée par rapport au code lu, en une paire distincte de codes comprenant un premier code (COD’n) et un second code (COD’n+i), la machine virtuelle étant conçue pour exécuter une instruction définie au moins en partie par le premier code (COD’n).19. Electronic entity (C) comprising a virtual machine and a memory (MEM), characterized by an execution module (EX.M) designed to convert according to a predetermined rule, in case of reading in the memory (MEM) of an instruction code (CODn) belonging to a predefined list of codes, a pair formed by the read code (CODn) and by the code (CODn + i) located at a predetermined relative position with respect to the read code, in a pair distinct code comprising a first code (COD'n) and a second code (COD'n + i), the virtual machine being designed to execute an instruction defined at least in part by the first code (COD'n).
FR1562554A 2015-12-16 2015-12-16 METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES Active FR3045858B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
FR1562554A FR3045858B1 (en) 2015-12-16 2015-12-16 METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
FR1562554A FR3045858B1 (en) 2015-12-16 2015-12-16 METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES
FR1562554 2015-12-16

Publications (2)

Publication Number Publication Date
FR3045858A1 true FR3045858A1 (en) 2017-06-23
FR3045858B1 FR3045858B1 (en) 2018-02-02

Family

ID=56084104

Family Applications (1)

Application Number Title Priority Date Filing Date
FR1562554A Active FR3045858B1 (en) 2015-12-16 2015-12-16 METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES

Country Status (1)

Country Link
FR (1) FR3045858B1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040003264A1 (en) * 2002-06-27 2004-01-01 Pavel Zeman System and method for obfuscating code using instruction replacement scheme
US20060195906A1 (en) * 2005-02-26 2006-08-31 International Business Machines Corporation System, method, and service for detecting improper manipulation of an application
WO2012082812A2 (en) * 2010-12-18 2012-06-21 Microsoft Corporation Security through opcode randomization

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040003264A1 (en) * 2002-06-27 2004-01-01 Pavel Zeman System and method for obfuscating code using instruction replacement scheme
US20060195906A1 (en) * 2005-02-26 2006-08-31 International Business Machines Corporation System, method, and service for detecting improper manipulation of an application
WO2012082812A2 (en) * 2010-12-18 2012-06-21 Microsoft Corporation Security through opcode randomization

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
AHMADOU A. SERE ET AL: "Automatic detection of fault attack and countermeasures", PROCEEDINGS OF THE 4TH WORKSHOP ON EMBEDDED SYSTEMS SECURITY, WESS '09, 1 January 2009 (2009-01-01), New York, New York, USA, pages 1 - 7, XP055283889, ISBN: 978-1-60558-700-4, DOI: 10.1145/1631716.1631723 *

Also Published As

Publication number Publication date
FR3045858B1 (en) 2018-02-02

Similar Documents

Publication Publication Date Title
EP1161725B1 (en) Method for monitoring a programme flow
EP1605333B1 (en) Program execution control
FR2612316A1 (en) INTEGRATED CIRCUIT BOARD HAVING INTERNAL ERROR INTELLIGENCE CAPABILITY
EP3123387B1 (en) Securing of the loading of data into a nonvolatile memory of a secure element
WO2006045924A1 (en) Protection against attacks by generation of errors on jump instructions
EP2447835B1 (en) Method for configuring an electronic entity
EP1779284B1 (en) Data processing method and device
EP2565810A1 (en) Microprocessor protected against memory dump
EP3391228B1 (en) Method for writing in a non-volatile memory of an electronic entity, and related electronic entity
EP3441902B1 (en) Method for protecting an electronic device against fault-injection attacks
FR2960327A1 (en) METHOD AND SYSTEM FOR ACCESSING AN INTEGRATED CIRCUIT COMPRISING A PERSONAL AUTHENTICATION KEY
FR3045858A1 (en) METHOD FOR LOADING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR EXECUTING A SEQUENCE OF INSTRUCTION CODES, METHOD FOR IMPLEMENTING AN ELECTRONIC ENTITY, AND ASSOCIATED ELECTRONIC ENTITIES
FR2918483A1 (en) PORTABLE ELECTRONIC DEVICE AND FILE MANAGEMENT METHOD FOR USE IN A PORTABLE ELECTRONIC DEVICE
EP2058746B1 (en) Portable electronic entity, host station and associated method
FR3019351A1 (en) METHOD FOR SECURELY CONFIGURING AN APPLICATION IN A USER TERMINAL
EP3032451B1 (en) Method for running a program by a processor and electronic entity comprising such a processor
EP1547005B2 (en) Microcircuit card whereof the performances can be modified after customization
EP1803084B1 (en) Method for locking an integrated circuit
EP2252978B1 (en) Integrated circuit card having a modifiable operating program and corresponding method of modification
EP3514749A1 (en) Method for controlling dependancy rules of updated objects in a microcircuit and corresponding device
WO2016097637A1 (en) Method of securing a pin code with error counters in a chip card
FR3089042A1 (en) Method for personalizing an electronic device with monitoring of the interruption of a personalization step
EP3985531A1 (en) Biometric enrolment with verification
FR3074323A1 (en) METHOD AND DEVICE FOR CRYPTOGRAPHIC DATA PROCESSING
FR3045862A1 (en) METHOD FOR WRITING IN A NON-VOLATILE MEMORY, METHOD FOR READING IN A NON-VOLATILE MEMORY AND METHOD IMPLEMENTED IN AN ELECTRONIC ENTITY

Legal Events

Date Code Title Description
PLFP Fee payment

Year of fee payment: 2

PLSC Publication of the preliminary search report

Effective date: 20170623

PLFP Fee payment

Year of fee payment: 3

PLFP Fee payment

Year of fee payment: 5

CA Change of address

Effective date: 20200826

CJ Change in legal form

Effective date: 20200826

PLFP Fee payment

Year of fee payment: 6

PLFP Fee payment

Year of fee payment: 7

PLFP Fee payment

Year of fee payment: 8

PLFP Fee payment

Year of fee payment: 9