Method for secure execution of instructions

By copying and checking protected data and its security information in the processor execution pipeline, the side-channel attacks and fault injection problems of electronic devices when executing instructions are solved, improving security and reducing hardware cost and performance impact.

CN118984987APending Publication Date: 2024-11-19THALES DIS FRANCE SA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380033299.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-04-13
Filing Date
2023-04-13
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

When executing instructions, it is difficult to effectively prevent bypass attacks and fault injection attacks, and accompanying protection measures have a huge impact on hardware design and performance.

Method used

By obtaining instructions in the processor's execution pipeline and performing load and storage operations according to the instruction type order, copying protection data and its associated security information can be used to apply data protection in the processor registers to perform integrity checks, avoiding Requirements for bus width.

Benefits of technology

Improves the security of instruction execution, prevents data tampering and bypass attacks, reduces the impact on hardware design, and maintains the standard size of the memory and processor bus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984987A_ABST
    Figure CN118984987A_ABST
Patent Text Reader

Abstract

The invention relates to a method for securely executing a first instruction by a processor of an electronic system, the electronic system comprising at least one memory configured to be coupled to the processor, and the processor comprising a processor register (103) and an execution unit (104), the execution unit (104) comprising a load and store unit (104a), the method comprises:-obtaining (S1) the first instruction in an execution pipeline of a processor,-determining (S2) that the first instruction to be executed is a load instruction to be protected for loading protection data and associated security information from the at least one memory to a processor register, if the first instruction to be executed is a load instruction to be protected or a store instruction to be protected for storing protection data and associated security information from a processor register to the at least one memory,-if the first instruction to be executed is a load instruction to be protected or a store instruction to be protected,-if the first instruction to be executed is the load instruction to be protected or the store instruction to be protected; at least a first operation (S4), a second operation (S5) and a third operation (S6) are sequentially performed by the processor, where: when the first instruction is a load instruction to be protected, the first operation is a load operation for loading the protection data from the at least one memory to the load and storage unit, and when the first instruction is a load instruction to be protected, the second operation is a load operation for loading the protection data from the at least one memory to the load and storage unit; the second operation is a loading operation for loading the security information associated with the protection data from the at least one memory to the loading and storage unit; and the third operation is a write operation for copying the protection data and the associated security information from the load and store unit to a processor register, when the first instruction is a store instruction to be protected, and when the second instruction is a store instruction to be protected, the third operation is a write operation for copying the protection data and the associated security information from the load and store unit to a processor register. The first operation is a write operation for copying the protection data and the associated security information from a processor register to the load and storage unit, and the second operation is a storage operation for storing the copied protection data from the load and storage unit to the at least one memory, and the third operation is a storage operation for storing the copied associated security information from the load and storage unit to the at least one memory, the security information associated with protected data is data that enables conversion of the protected data into pure data and / or integrity data that enables verification of integrity of the protected data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of securing software execution on an electronic device from attack, and more particularly to a method for securing execution of instructions by a processor of an electronic device. Background Art

[0002] Electronic devices are now widely used to store data that must be protected from any unauthorized access by attackers: personal data such as identity information, biometric data, banking information, secret data such as keys, etc. Therefore, security measures are usually applied to such data to mitigate any fraudulent reading or modification. Such data can be encrypted; their integrity can be improved by storing security information such as signatures, checksums or hash values.

[0003] In order to use such data, the CPU of the electronic device storing the data should read the data in the memory before any subsequent use of the instructions executed by the CPU. At this time, the data is transferred from the memory of the electronic device to the internal registers of the CPU on the bus and then used by the CPU to execute its instructions.

[0004] During such data manipulation, an attacker can perform a side-channel attack, which will allow the attacker to gain knowledge of sensitive information processed by the CPU, such as encryption keys, from electromagnetic leakage or power consumption from the CPU. He can also perform a fault injection attack in order to induce a malfunction of the electronic device and retrieve information about the data from this degraded state. Therefore, in order to prevent such attacks, countermeasures applied to sensitive data should be applied as widely as possible along the execution chain, and not only during the storage of data in the memory of the electronic device. It is applied to the memory interface, bus, CPU cache and internal registers until the execution stage when the CPU is able to handle the protected data.

[0005] The problem arises from the impact that such measures have on the data size, which is caused by the security information accompanying the protection data (integrity check information, shielding data, etc.). As a result, in order to enable existing electronic devices to store and process such security information together with the protection data up to the CPU, the hardware design of such electronic devices should usually be adapted, for example by increasing the data word length in the memory, by increasing the data bus width. Such modifications have a huge impact on existing designs in terms of hardware costs and performance, not to mention the necessary engineering and testing effort.

[0006] Therefore, a need exists for a method that enables a CPU to safely execute instructions by increasing the protection of sensitive data manipulated by the instructions from fault attacks or side-channel analysis, which has a lower impact on the architecture of the electronic device performing the execution. Summary of the invention

[0007] To this end and according to a first aspect, the invention therefore relates to a method for securely executing a first instruction by a processor of an electronic system, wherein the electronic system comprises at least one memory configured to be coupled to the processor and comprises processor registers and an execution unit, the execution unit comprising a load and store unit, the method comprising:

[0008] a) obtaining the first instruction in an execution pipeline of a processor,

[0009] b) determining whether the first instruction to be executed is a load instruction to be protected for loading protection data and associated security information from the at least one memory to a processor register, or a store instruction to be protected for storing protection data and associated security information from a processor register to the at least one memory,

[0010] c) when the first instruction to be executed is a load instruction to be protected or a store instruction to be protected, the processor sequentially performs at least a first operation, a second operation and a third operation, wherein:

[0011] when the first instruction is a load instruction to be protected, the first operation is a load operation for loading the protection data from the at least one memory to the load and store unit, the second operation is a load operation for loading the security information associated with the protection data from the at least one memory to the load and store unit, and the third operation is a write operation for copying, by the coprocessor, the protection data and the associated security information from the load and store unit to a processor register,

[0012] when the first instruction is a store instruction to be protected, the first operation is a write operation for copying the protection data and the associated security information from a processor register to the load and store unit, the second operation is a store operation for storing the copied protection data from the load and store unit to the at least one memory, and the third operation is a store operation for storing the copied associated security information from the load and store unit to the at least one memory,

[0013] The security information associated with the protection data is data enabling conversion of the protection data into pure data and / or integrity data enabling verification of the integrity of the protection data.

[0014] Such a method enables improving the security of the execution of the first instruction by enabling saving the data in a masked / encrypted form and / or performing integrity checks on the data from the memory of the electronic system to the processor registers of the processor. By using a single operation to copy the data and its associated security information, it enables doing so without any additional requirements on the size of the bus connecting the memory and the processor.

[0015] The security information associated with the data may be shielding data, cryptographic keys or integrity data in redundant data, a checksum, a minimum value and / or a maximum value of the protection data.

[0016] The method according to the first aspect may comprise, when the first instruction is a load instruction to be protected, performing a security check on the data loaded by the first operation using associated security information loaded by the second operation after the first and second operations have been executed by the processor.

[0017] By doing so, any fraudulent alteration of data between the reading of data in the memory of the electronic system and their copying in the processor may be detected before the data is requested from the processor registers.

[0018] When the processor includes a secure execution unit or a secure coprocessor that executes at least step c above, and the electronic system includes a requester that executes a second instruction, when the second instruction requests access to the data copied in the processor register, the method according to the first aspect may include the following steps executed by the secure execution unit or the secure coprocessor:

[0019] - determine whether the requester is safe,

[0020] - when the requester is determined to be secure, transmitting the requested data and the associated security information to the requester, and executing the second instruction by the requester based on the transmitted data and the transmitted associated security information,

[0021] -When the requester is determined to be unsafe, a secure execution unit or a secure coprocessor processes the requested data by converting the requested data into pure data and / or verifying the integrity of the requested data using security information associated with the requested data stored in a processor register, transmits the processed data to the requester, and the requester executes the second instruction based on the processed data.

[0022] Such a method enables extending protection of the data to the requestor if the requestor is secure; detecting any tampering of the data before executing the second instruction; and at the same time providing the requestor with unmasked / decrypted data if the requestor is not secure and cannot handle the masked / encrypted data.

[0023] According to a first embodiment, determining whether the first instruction is a load or store instruction to be protected comprises determining whether an opcode of the instruction corresponds to a protected instruction or an unprotected instruction.

[0024] According to a second embodiment, determining whether the first instruction is a load or store instruction to be protected comprises determining whether the first instruction to be executed comprises predetermined metadata.

[0025] According to a third embodiment, determining whether the first instruction is a load or store instruction to be protected comprises verifying a value stored in a security configuration register of the processor.

[0026] By doing so, protection of load and store instructions may be selectively activated only for some load and store instructions.

[0027] According to a second aspect, the invention relates to a computer program product directly loadable into the memory of at least one computer, comprising software code instructions for executing the steps of the method according to the first aspect of the invention when said product is run on a computer.

[0028] According to a third aspect, the invention relates to an electronic system comprising a processor configured to perform the steps of the method according to the first aspect of the invention.

[0029] To the accomplishment of the foregoing and related ends, one or more embodiments comprise the features hereinafter fully described and particularly pointed out in the claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The following description and drawings set forth certain illustrative aspects in detail and are indicative of only some of the various ways in which the principles of the embodiments may be employed. Other advantages and novel features will become apparent from the following detailed description when considered in conjunction with the accompanying drawings, and the disclosed embodiments are intended to include all such aspects and their equivalents.

[0031] · Figure 1 is a schematic diagram of an electronic system according to the present invention;

[0032] · Figure 2a is a schematic diagram of a method for securely executing a load instruction by an electronic system according to an embodiment of the present invention;

[0033] · Figure 2bis a schematic diagram of a method for securely executing a storage instruction by an electronic system according to an embodiment of the present invention;

[0034] · Figure 3a and 3b is a schematic diagram of steps according to a method for providing a requestor with access to protection data stored in a processor register of an execution unit. DETAILED DESCRIPTION

[0035] According to a first aspect, the present invention relates to a method for securely executing a first instruction by a processor 101 of an electronic system 100 .

[0036] like Figure 1 As depicted, such an electronic system 100 includes a processor 101 for executing a code including a first instruction. The processor includes a program counter PC 102, a processor register 103, and an execution unit 104, which may include a load and store unit LSU 104a and an arithmetic and logic unit ALU 104b. The processor may also include an additional internal memory 105 (e.g., a cache memory), and one or more coprocessors 106 (secure or unsecure) located, for example, on the same die or the same PCB as the processor. The electronic system also includes at least one memory, such as a non-volatile memory 107, a RAM memory 108, and / or a ROM memory 109, which stores code instructions and additional data, including data used as instruction opcodes and associated security information. These three types of data may be stored in a single memory, or in separate memories. The electronic system 100 may also include a communication interface 110, through which the electronic system 100 may be connected to a network. Such an interface may be a wireless interface connected to an antenna and may be used to connect the electronic system 100 to various forms of wireless networks, such as a wide area network, a WiFi network, or a mobile phone network. Alternatively, such an interface may be a wired interface, such as an Ethernet interface. The electronic system 100 may also include an input / output component 111 that provides an interface to a user of the first device, such as one or more screens, speakers, a mouse, a tactile surface, a keyboard, etc.

[0037] Such an electronic system may be, for example, a tamper-proof smart card, a personal computer, a server or a smartphone.

[0038] When the first instruction is an instruction to manipulate data, such as a load or store instruction, the data will be accompanied by security information to ensure the safe execution of the first instruction and prevent any reading or manipulation of the data by an attacker. For example, the data may be shielded or encrypted, and the security information associated with it may be shielding data or a cryptographic key that enables the protected data to be converted into pure data by deshielding or decrypting it. The security information may also be integrity data that enables checking the integrity of the data, such as a checksum or hash value, redundant data, minimum and / or maximum values ​​of the data associated with them. It may also be a color label as described in patent application EP20306400.1 filed on November 18, 2020.

[0039] When a first instruction transfers such protection data associated with such security information between a processor and at least one memory of an electronic system, a first main idea of ​​the present invention is that when the first instruction is executed, at least two operations are performed in sequence, which respectively copy the data itself and the security information associated therewith. By doing so, such security information does not only reside in a memory external to the processor. The data can also be accompanied by their security information in the internal memory and registers of the processor, which enables data protection (such as data masking) to be applied inside the processor, and security checks, such as integrity checks, are performed on the data when the data is stored in the processor. In order to copy the data and its associated security information by a single operation, the width of the bus connecting the memory and the processor of the electronic system will have to be expanded in order to handle the security information. By using a separate operation to copy the security information, the size of the bus can be kept standard and there is no need to expand the bus width.

[0040] A second main idea of ​​the invention is to use the load and store unit LSU 104a as a temporary buffer between the processor registers 103 of the processor and at least one memory 107, 108, 109 of an electronic system external to the processor. As an example, in case of a load instruction of data from a memory to a processor register of the processor, after transferring the data from the memory to the LSU of the processor, but before copying the data in the processor register of the processor, it enables to perform an operation on the data, such as demasking the data, decrypting the data or checking the integrity of the data.

[0041] The following paragraphs describe in detail the steps of the method for securely executing a first instruction by an electronic system according to the present invention. Figure 2a describes the case of a load instruction, and Figure 2b Such secure execution may be performed by the secure execution unit 104 of the processor 101 or the secure coprocessor 106 . Figure 2a and2b This corresponds to a case where such execution is performed by a security coprocessor.

[0042] In a first step S1 , the processor, in the execution pipeline of the processor 101 , fetches a first instruction from a memory of the electronic system 107 , 108 , 109 storing a code to be executed.

[0043] In a second step S2, the processor determines whether the first instruction to be executed is an instruction to copy data between one or more memories and the processor, and whether fraudulent operations on such data should be prevented. More precisely, in this step, the processor determines whether the first instruction to be executed is one of the following two instructions:

[0044] a load to protect instruction for loading protection data and associated security information from at least one memory into processor registers 103, or

[0045] • A store to protect instruction for storing protection data and associated security information from the processor register 103 to at least one memory.

[0046] Protection of the execution of the first instruction may be activated in several ways which are not mutually exclusive.

[0047] The instructions to be protected can be identified by a specific opcode added to the processor instruction set. In this case, at the second step, the processor can determine whether the first instruction is to be protected by determining whether the opcode of the instruction corresponds to a protected instruction or an unprotected instruction.

[0048] The instructions to be protected may also be identified by specific metadata or metadata combinations embedded in the instructions. In such a case, at the second step, the processor may determine whether the first instruction to be executed includes such predetermined metadata to determine whether the first instruction is to be protected.

[0049] The protection of the execution of the instruction can also be activated independently of the instruction itself, for example by setting a register of the processor to a predetermined value. In such a case, at a second step, the processor can determine whether the first instruction is to be protected by verifying the value stored in the security configuration register of the processor.

[0050] Protection can also be permanently activated for any instruction fetched into the processor, without requiring any action to be performed. In this case, any load or store instruction fetched into the processor is considered protected.

[0051] At this stage, when the first instruction is not a load or store instruction, or when it is a load or store instruction but is not identified as being protected, as will be further described below, the first instruction may be executed by a processor as described in the prior art.

[0052] However, when it is determined at the second step S2 that the first instruction to be executed is a load instruction to be protected or a store instruction to be protected, the method according to the present invention performs the following steps.

[0053] In a third step S3, when the first instruction to be protected is to be executed by the security coprocessor 106, the processor unloads the first instruction from its execution pipeline to the execution pipeline of the security coprocessor. This unloading is optional, because the processor can let the secure execution unit in its own execution unit 104 execute the first instruction. In the following paragraphs, it will be considered that the first instruction is executed by the security component of the processor: the secure execution unit of the processor or the security coprocessor (if any).

[0054] Then, in order to execute the first instruction, the processor 101 sequentially performs at least the first operation in the fourth step S4, the second operation in the fifth step S5, and the third operation in the sixth step S6.

[0055] When the first instruction is a load instruction to be protected, the protection data and the associated security information are loaded into the load and store unit LSU 104a, respectively: at a fourth step S4, the first operation is a load operation for loading the protection data from the memory storing it into the load and store unit; and at a fifth step S5, the second operation is a load operation for loading the security information associated with these data from the memory storing it into the load and store unit (LSU) 104a. After these two operations have been performed, both the protected data and the associated security information are stored in the LSU, despite the fact that the size of the bus connecting the memory and the LSU may be smaller than the cumulative size of the data and the security information. Then, at a sixth step S6, the third operation is a write operation for copying the loaded protection data and the associated security information from the load and store unit to the processor register 103. These three operations may be performed in a different order; for example, the security information may be loaded before the protection data.

[0056] The first instruction may also be a store instruction to be protected. For example, a previous instruction may have generated output data and associated security information, both of which are temporarily stored in a processor register 103 of the processor. In such a case, the protection data and the associated security information are first retrieved in the LSU 104a: at a fourth step S4, the first operation is a write operation for copying the protection data and the associated security information from the processor register to the load and store unit. The protection data and the associated security information may then be stored separately from the load and store unit LSU to at least one memory 107, 108, 109: at a fifth step S5, the second operation is a store operation for storing the copied protection data from the load and store unit to the memory; and at a sixth step S6, the third operation is a store operation for storing the copied associated security information from the load and store unit of the processor to the memory. These three operations may be performed in a different order; for example, the security information may be stored before the protection data.

[0057] The paragraphs describing the execution of the first, second and third operations above mentioned copying data to or from a processor register. Depending on the size of the register, the size of the copied data and, in the case of copying from a register, the location of the data in the processor register, these operations may involve one or several processor registers.

[0058] When the first instruction is a load instruction to be protected, loading the protection data and the associated security information in the LSU enables the execution of actions on these data after they are transmitted on the bus between the memory and the processor of the electronic system and before they are stored in the processor register. Therefore, after the processor has executed the first and second operations at the fourth and fifth steps S4 and S5, during the checking step S61, the processor can use the associated security information loaded by the second operation to perform a security check on the data loaded by the first operation. The processor can, for example, check the integrity of the data so as to verify that the data has not been changed by the fault attack during the execution of the fourth and fifth steps before copying the data to the processor register. In the event of a failure of the security check, the processor can perform various actions, such as activating countermeasures, sounding an alarm, preventing the checked data from being copied to the processor register, deleting the checked data or moving it to an isolated memory area, and performing a reset of the electronic system.

[0059] When the first instruction is a load instruction, the protection data and the associated security information are loaded into the processor register of the processor by the secure execution unit or the secure coprocessor. After performing these load operations, these data may be requested by another circuit of the electronic system (hereinafter referred to as the "requestor") to execute a subsequent instruction (hereinafter referred to as the second instruction). The requestor of such data may be, for example, an execution unit of the processor 104, a coprocessor 106 of the processor, or another processor or coprocessor of the electronic system. In such a case, the behavior of the secure execution unit or the secure coprocessor may depend on whether the data requestor is considered secure, such as Figure 3a and 3b In these figures, the requester is shown as being external to the processor, but as described above, it may be included in the processor.

[0060] In a seventh step S7, it is determined whether the requester is safe.

[0061] If the requester is secure, the requester extends the security perimeter including the electronic system memory and the secure execution unit or secure coprocessor, and the data can remain intact: if they are masked / encrypted in the LSU and processor registers, they are masked / encrypted and accompanied by their security information for later unmasking / decryption and / or verification of their integrity. Figure 3a As shown, when it is determined that the requester is safe, in the eighth step S8, the processor can transmit the requested data and the associated security information to the requester, and the requester can execute the second instruction based on the transmitted data and the transmitted associated security information. For example, when such a mask is an XOR and the second instruction is compatible with it (e.g., another XOR), the requester may be able to process the masked data and may not need to remove the mask to execute the second instruction.

[0062] On the contrary, if the requester is not secure, such as Figure 3b As shown, the security chain ends at the processor register. Therefore, when the requester is determined to be unsafe, at the eighth step S8, the security execution unit or the security coprocessor can process the requested data by converting the requested data into pure data, for example, by demasking or decrypting it, and / or using the security information associated with the requested data stored in the processor register to verify the integrity of the requested data. After successfully performing the processing, the security execution unit or the security coprocessor can transmit the processed data to the requester.

[0063] In a ninth step S9, the requester may execute a second instruction based on the processed data and then store the result in a processor register.

[0064] According to a second aspect, the invention relates to a computer program product directly loadable into the memory of at least one computer, comprising software code instructions for performing the steps of the method described above when said product is run on a computer.

[0065] In addition to these features, the computer program according to the second aspect of the invention may be configured to perform or may include any other features previously described herein.

[0066] Thus, the electronic system and method proposed herein enable to increase the security of the execution of the first instruction by keeping the data in a shielded form and / or performing an integrity check on the data from the memory of the electronic system up to the processor registers of the processor. By using a single instruction for copying the data and its associated security information, it enables to do this without any additional requirements on the size of the bus connecting the memory and the processor.

Claims

1. A method for securely executing a first instruction by a processor (101) of an electronic system (100), wherein the electronic system comprises at least one memory (107, 108, 109) configured to be coupled to the processor, and the processor comprises a processor register (103) and an execution unit (104), the execution unit (104) comprising a load and store unit (104a), The method comprises: a) acquiring (S1) the first instruction in an execution pipeline of the processor, b) determining (S2) whether the first instruction to be executed is a load instruction to be protected for loading protection data and associated security information from the at least one memory to the processor register, or a store instruction to be protected for storing protection data and associated security information from the processor register to the at least one memory, c) when the first instruction to be executed is a load instruction to be protected or a store instruction to be protected, the processor sequentially executes at least a first operation (S4), a second operation (S5) and a third operation (S6), in: when the first instruction is a load instruction to be protected, the first operation is a load operation for loading the protection data from the at least one memory to the load and store unit, the second operation is a load operation for loading the security information associated with the protection data from the at least one memory to the load and store unit, and the third operation is a write operation for copying the protection data and the associated security information from the load and store unit to the processor register, when the first instruction is a store instruction to be protected, the first operation is a write operation for copying the protection data and the associated security information from the processor register to the load and store unit, the second operation is a store operation for storing the copied protection data from the load and store unit to the at least one memory, and the third operation is a store operation for storing the copied associated security information from the load and store unit to the at least one memory, The security information associated with the protection data is data enabling conversion of the protection data into pure data and / or integrity data enabling verification of the integrity of the protection data.

2. The method according to claim 1, wherein: The security information is shielding data, cryptographic keys or integrity data in redundant data, a checksum, a minimum value and / or a maximum value of the protection data.

3. The method according to claim 1 or 2, comprising: When the first instruction is a load instruction to be protected, after the first and second operations have been executed by the processor, a security check is performed on the data loaded by the first operation using the associated security information loaded by the second operation.

4. The method according to any one of claims 1 to 3, wherein: The processor (101) includes a secure execution unit (104) or a secure coprocessor (106) for performing at least step c of claim 1, and the electronic system includes a requester for executing a second instruction, the method comprising, by the secure execution unit or the coprocessor, when access to the data copied in the processor register (103) is requested by the second instruction: - determining (S7) whether the requester is safe, - when the requester is determined to be safe, transmitting the requested data and the associated security information to the requester, and executing the second instruction by the requester based on the transmitted data and the transmitted associated security information (S8), -When the requester is determined to be unsafe, the secure execution unit or the secure coprocessor processes the requested data by converting the requested data into pure data and / or verifying the integrity of the requested data using the security information associated with the requested data stored in the processor register, transmits the processed data to the requester, and the requester executes the second instruction based on the processed data.

5. The method according to any one of claims 1 to 4, wherein: Determining (S2) whether the first instruction is a load or store instruction to be protected includes determining whether an opcode of the instruction corresponds to a protected instruction or an unprotected instruction.

6. The method according to any one of claims 1 to 4, wherein: Determining (S2) whether the first instruction is a load or store instruction to be protected includes determining whether the first instruction to be executed includes predetermined metadata.

7. The method according to any one of claims 1 to 4, wherein: Determining (S2) whether the first instruction is a load or store instruction to be protected includes verifying a value stored in a security configuration register of the processor.

8. A computer program product directly loadable into the memory of at least one computer, comprising software code instructions for performing the steps of any one of claims 1 to 7 when said product is run on said computer.

9. An electronic system (100), comprising a processor (101) configured to perform the steps of any one of claims 1 to 7.