Method for protecting a program in an integrated circuit - Patents.com
By randomly inserting fictitious opcodes to mask execution timing, the method protects integrated circuits from attacks while maintaining performance, addressing inefficiencies in existing countermeasures.
Patent Information
- Application Number
- JP2023563860
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-04-19
- Filing Date
- 2022-04-15
- Publication Date
- 2024-11-20
- Estimated Expiration
- 2042-04-15
AI Technical Summary
Existing countermeasures against physical attacks on integrated circuits, such as side-channel and fault attacks, are inefficient as they affect non-sensitive code execution, leading to significant performance impact and characteristic power consumption traces.
A method involving the creation of opcode blocks with fictitious instructions, randomly determined in number and position, to replace original opcodes, masking the execution timing of sensitive code without affecting performance.
Effectively prevents attackers from analyzing execution patterns while maintaining computational efficiency by randomizing the execution of fictitious opcodes, thus complicating attacks without impacting performance.
Smart Images

Figure 0007587097000001 
Figure 0007587097000002 
Figure 0007587097000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a method for protecting a program in an integrated circuit product adapted to execute the program and susceptible to attack.The invention also relates to an integrated circuit using said method. [Background technology]
[0002] There is a constant demand for increasing system resistance against physical attacks, such as side-channel and fault attacks, which typically require executing the same process a huge number of times to reach the target.
[0003] Some attack types may benefit from predictable timing execution, such as setting up and replaying a laser attack, synchronizing events over several runs for a correlation attack, or measuring timing periods for a timing attack. Every logical operation in a computer takes time to execute, and that time can vary depending on the input. By precisely measuring the time of each operation, an attacker can trace it back to the input.
[0004] Currently, several counter-attack solutions exist to alter the predictable timing execution: for example, the Random Clock Stealer solution proposes to remove (or steal) clock pulses; the Clock Jitter solution proposes to continuously change the clock frequency; the Software Inserted Random Delay solution proposes to implement a function where the processing unit executes an unpredictable number of instructions when necessary to protect sensitive code.
[0005] However, these existing solutions are not satisfactory and have drawbacks. For example, random clock stealers and clock jitter are applied to all or most of the code execution, even to non-sensitive parts of the code. Thus, the performance impact to the product executing the code is high. When the random clock stealer stops the clock, the power consumption drops with a characteristic signature. This limits the effectiveness of the countermeasure.
[0006] Random delays inserted by software mean adding functions in the code which increases the code size. The random delays are implemented in dedicated functions that need to be called. The call and return mechanism takes significant clock cycles. The timing cost of inserting a random delay function is high.
[0007] Therefore, these counterattack methods are not efficient enough, and further alternative and advantageous solutions implemented to complement these previous counterattack methods are desirable in the art. Summary of the Invention
[0008] The present invention aims to avoid the above mentioned malicious attacks in an efficient manner, or at least make them more difficult.
[0009] The present invention relates to a method for protecting a program in an integrated circuit product, the method comprising: - creating one or more instruction code blocks for respectively replacing one or more original instruction codes of a program, the instruction code blocks including a number of fictitious instruction codes and corresponding original instruction codes, the fictitious instruction codes being executed without taking into account their results and without affecting the expected results of said program, the number and execution positions of the original instruction codes within the instruction code block being randomly determined by a random or pseudo-random number generator of the integrated circuit product; - executing one or more blocks of instruction code; We propose a method including the following:
[0010] Thus, the present invention enables a process of an integrated circuit product, when its processor executes original instructions (e.g., instruction codes such as OR, AND, XOR, etc.) of a program (e.g., a cryptographic program processing sensitive data), to trigger the execution of other instructions (e.g., fictitious instruction codes) that are executed without considering their operation or return value (e.g., the results of these fictitious instructions may or may not be stored in garbage registers of the processor) and that are executed without affecting the expected result of the program.
[0011] As a result, for one original (or real) opcode of a program, a replacement opcode block is generated and executed that contains the original opcode and one or more fictitious (or fake) opcodes. The number of fictitious opcodes in every opcode block is randomized using a random number generator. Also, the position (or order) of execution of the original opcodes in every opcode block is randomized.
[0012] Thus, the present invention makes it possible to mask (or hide) the execution timing of a program's original instruction code in order to prevent an attacker from analyzing the program's normal execution pattern and discovering security breaches.
[0013] The present invention also makes it possible to dynamically change the execution pattern of the same program by randomizing the number of fictitious instruction codes and the execution positions of the original instruction codes, so that the execution timing of the original instruction codes is different each time the program is executed.
[0014] The proposed solution does not affect the functionality of the product. The performance consumption of the fictitious instruction code is similar to that of normal instruction code execution. Since the method is implemented by hardware (i.e., processor design) rather than software (i.e., function calls), the present invention does not significantly affect the performance of the product.
[0015] This solution is furthermore compatible with the existing countermeasures mentioned above.
[0016] The method according to the invention therefore makes it possible to reduce the risk of malicious attacks in a simple and efficient manner, or at least to make it more complicated for a malicious attacker to carry out the attack.
[0017] In one example, at least a portion of the generated fictitious instruction codes are selected from a list of fictitious instruction codes pre-stored on the integrated circuit product.
[0018] This allows the processor to automatically create fictitious opcodes, for example during the decoding phase, without requiring the developer to manually add the fictitious opcodes to the program's assembly code.
[0019] In one example, at least a portion of the created fictitious instruction code is a copy of the original instruction code.
[0020] This optional feature is easy to implement and can also achieve the same goal of hiding the execution timing of the program's actual instruction code.
[0021] In one example, the operands associated with the created fictitious instruction code (either selected from a pre-stored list or copied from the original instruction code) may be generated by a random or pseudo-random number generator. Alternatively, the operands may be selected randomly or sequentially from a pre-stored list by the processor.
[0022] These fictitious operands are designed to be used by fictitious instruction codes. The purpose of using the fictitious operands and instruction codes is to allow the integrated circuit card to execute a secret program (or at least a secret part of a program) in such a way that the timing of the execution of the secret instructions (instruction codes and data) is almost unpredictable to an attacker.
[0023] As mentioned above, the results of the computation of the fictitious instruction code may or may not be stored in a garbage register so as not to affect the normal (or expected) results of the real instruction code.
[0024] In one example, the method further includes identifying one or more original instruction codes to be replaced from a list of target instruction codes pre-stored in the integrated circuit product.
[0025] This allows the processor to modify the assembly code for only a part of the program (e.g. the sensitive part), so this method has the advantage that it does not require a large performance expenditure.
[0026] The invention also relates to a processor implementing the method for protecting a program in an integrated circuit product according to the invention.
[0027] The invention also relates to an integrated circuit product including a processor according to the invention.
[0028] To the accomplishment of the foregoing and related ends, the one or more embodiments comprise the features hereinafter fully described and particularly pointed out in the claims. [Brief description of the drawings]
[0029] The following description and the annexed drawings set forth in detail certain illustrative aspects and illustrate but a few 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 drawings, and the disclosed embodiments are intended to include all such aspects and their equivalents.
[0030] [Figure 1] 1 is a schematic diagram illustrating the hardware structure of a computing device, such as an integrated circuit product, in accordance with an embodiment of the present invention. [Diagram 2] FIG. 2 shows a schematic flow chart of a method according to an embodiment of the present invention. [Diagram 3] FIG. 2 is a diagram illustrating the execution order of instructions in an instruction block according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0031] In the different drawings, the same elements are provided with the same reference numbers.For clarity, only those elements and steps that are helpful in understanding the present invention are shown in the drawings and described.
[0032] With reference to FIG. 1, a computing device such as an integrated circuit or a smart card may be adapted to protect against physical attacks (such as laser fault attacks, side channel attacks, correlation attacks and timing attacks) by enabling the computing device, and in particular its CPU, to modify the original instructions of a sensitive program (e.g. a cryptographic algorithm) or at least sensitive parts of a program by adding random fictitious instructions to make the execution timing of the original instructions unpredictable.
[0033] In one embodiment of the invention, computing device 100 may include a CPU (or processor) 101 with a cache 102 .
[0034] Caches 102 may include a code cache 103 and a data cache 104 for storing instructions that compiler 110 translates from program 109. Processor 101 uses code cache 103 to store instructions (operation codes, or instruction codes) prior to execution based on the currently executing application program, and data cache 104 to store data arguments (operands) for each instruction code, if applicable. Processor 101 may use an instruction pipelining facility to fetch instructions (which typically include instruction codes and operands) and store them in code cache 103.
[0035] The computing device 100 also includes a RAM106 and ROM (Read Only Memory) 105 The computing device 100 may also store in memory 107 (e.g., a hard disk or other persistent storage) an operating system module 108 and programs 109, as well as a compiler 110. The compiler 110 converts the programs 109 into a list of instructions so that the CPU 101 can process the instructions.
[0036] The compiler 110 (e.g., the program 109 The instructions are stored in cache 102 so that CPU 101 can fetch and execute them in order.
[0037] Before executing at least some of the instructions, the CPU 101 automatically modifies the original instructions (e.g., original instruction codes) of the program 109 by creating new instructions (e.g., fictitious instruction codes) at the hardware layer (e.g., via a CPU instruction decoding module) as further described below. The operating system module 108 controls the overall operation of the computing device, as is known in the art for an operating system.
[0038] Vulnerable code 109 may be any software application or code component that is susceptible to such attacks.
[0039] Those skilled in the art will appreciate that other types of computing devices may be adapted to perform in accordance with the present invention. For example, computing device 100 may alternatively be a mobile phone (or other mobile terminal), a personal digital assistant, an APPLE® computer using a Motorola or other type of processor, a reduced instruction set computer (RISC), or any other type of computer or data processing system. The devices and methods disclosed herein may benefit devices using both fixed-size (RISC-based systems) and variable-size (CISC-based systems) instruction sets.
[0040] 2, the present invention provides an exemplary method 200 for protecting vulnerable code (or program) 109 from attacks (specifically, timing attacks). Initially, either a user or an automated process (e.g., another program) instructs computing device 100 (specifically, processor 101) to execute program 109. Once the program is instructed to execute, compiler 110 converts program 109 into a list of instructions. CPU 101 begins fetching instructions in order, storing the fetched instructions in code cache 103 and storing the fetched data in data cache 104.
[0041] In this example, when CPU 101 proceeds to execute (201) a fetched instruction I (i.e., an original instruction of the program), CPU 101 identifies (202) whether instruction I (e.g., an instruction code such as OR) is present in a list of target instructions pre-stored in CPU 101 (e.g., in a predefined register of CPU 101 or in another internal memory of the CPU). This target instruction list is used to indicate to CPU 101 the functional instructions (e.g., mov, store, xor, etc.) that should be protected against attacks such as timing attacks.
[0042] By pre-storing such a target instruction list in CPU 101, it becomes possible to apply the method of the present invention only to one or more critical portions of program 109, rather than to the entire program, thus allowing a better balance between performance and protection to be achieved.
[0043] It should be noted that a person skilled in the art would easily understand that in a variant, the target instruction list may be omitted. In that case, CPU 101 may apply the protection method of the present invention to all instructions of the program. This may be beneficial when it is important to protect the entire program. In another example, a developer may manually identify the sensitive parts of the program and instruct CPU 101 to trigger the addition of fictitious instructions using specific instructions (e.g., secure_mov, secure_store, secure_xor, etc., created by the compiler to perform the new method). Thus, these optional and alternative features may provide a certain flexibility in the implementation of the present invention.
[0044] After optional step 202, if instruction I is not identified by CPU 101 from the pre-stored list of target instructions, CPU 101 executes (203) instruction I. In other words, the instruction is executed without any protection measures of CPU 101 since it is determined to be non-sensitive.
[0045] Instead, if instruction I is identified from a list of target instructions prestored by CPU 101, in this example, CPU 101 may determine (204) whether there is a list of fictitious instructions prestored in CPU 101 (e.g., in a predetermined register of the CPU), or the CPU may determine (204) whether the prestored list of fictitious instructions is empty.
[0046] If it is determined (204) that the fictitious instruction list exists and is not empty, in this example, CPU 101 selects a number D of fictitious instructions (e.g., instruction codes such as XOR, AND, OR, etc.) from the list and creates (205a) an instruction block consisting of the selected fictitious instructions and instruction I. This instruction block replaces the original instruction I.
[0047] Therefore, in order to conceal the execution timing of instruction I to prevent attacks, CPU 101 executes the created instruction block (206) instead of executing only instruction I.
[0048] In this example, the number D may be determined by a random or pseudorandom number generator implemented, for example, in a register of CPU 101 or an external storage device (e.g., a peripheral device) that determines and transmits the number D to the CPU. Thus, the number of fictitious instructions used by CPU 101 for each original instruction I to be protected may be different. The number D may be fixed by CPU 101 to be within a limited range in order to control performance consumption.
[0049] The selection of the fictitious instruction by the CPU 101 may be done randomly.
[0050] The data used with the fictitious instructions (which may be referred to as fictitious data) may be generated by a random or pseudo-random number generator.
[0051] Among the positions 0, ..., P-1, P+1, ..., D-1 of the fictitious instructions in the instruction block, the position P (or clock cycle, between 0 and D) for executing the original instruction I may be randomly determined by a random number or pseudo-random number generator. In other words, the original instruction I is executed by the CPU 101 once during the Pth clock cycle using real (or expected) data (e.g., operands specified by the program 109). The added fictitious instruction is executed by the CPU 101 D times during the 0th, ..., P-1th, P+1th, ..., D-1th clock cycles, respectively, using fake (or fictitious) data (e.g., operands generated by a random number generator).
[0052] As noted above, randomizing the number D, the position P, and possibly other parameters can make it very difficult, or even impossible, to predict the execution timing of the actual instruction I when the CPU executes a block of instructions instead of just instruction I.
[0053] On the other hand, the present invention is implemented at the hardware level by modifying the instruction decoding behavior of the CPU, thus enabling higher computational performance compared to existing software-level countermeasure solutions. Moreover, the present solution does not require any modification of the program 109 itself. The fictitious instructions are added during the decoding phase of the CPU 101.
[0054] If CPU 101 determines (204) that the predefined fictitious instruction list does not exist or is empty, CPU 101 may still create (205b) a number D of fictitious instructions by directly using copies of original instructions I as fictitious instructions. The execution location (or order) P of real instructions I among the fictitious instructions I may be determined randomly. Fictitious operands may be used with the fictitious instructions. Results from the fictitious instructions may not even be considered or stored by CPU 101.
[0055] Next, CPU 101 executes (206) an instruction block consisting of D+1 instructions I, where original instruction I is executed by CPU 101 with expected data only once during the Pth clock cycle, and an added fictitious instruction (same as original instruction I) is executed by CPU 101 D times during each of the 0th, ..., P-1th, P+1th, ..., D-1th clock cycles using fake (or fictitious) data (e.g., operands generated by a random number generator).
[0056] It should be noted that a person skilled in the art would easily understand that in a variation of the method of the present invention, step 204 of checking the existence of the pre-stored fictitious instruction list may be omitted. In that case, after CPU 101 determines that instruction I needs to be protected, it may automatically replace instruction I with a predetermined fictitious instruction (which may be the same as or different from original instruction I).
[0057] Referring now to FIG. 3, a schematic diagram illustrates the execution order / timing of instructions in an instruction block created by CPU 101 to replace the original instructions.
[0058] The number D of fictitious instructions added to protect the original instruction I and the execution position P of the original instruction I may be determined by a random or pseudorandom number generator. The duration D may be within a specified limited range. The position P ranges from 0 to D-1. The real instruction I is executed in P clock cycles. During clock cycles 0, .., P-1, P+1, .., D, the fictitious instructions may be executed with random or pseudorandom data, respectively. The results of these fictitious instructions may or may not be stored in garbage registers.
[0059] In the above detailed description, reference has been made to the accompanying drawings which show, by way of illustration, specific embodiments in which the invention may be practiced. These embodiments have been described in sufficient detail to enable those skilled in the art to practice the invention. Therefore, the above detailed description is not to be taken in a limiting sense, and the scope of the present invention is defined solely by the appended claims, properly interpreted, along with the full scope of equivalents to which such claims are entitled.
Claims
1. A method for protecting a program (109) stored in a persistent memory (107) in an integrated circuit product (100), comprising: The integrated circuit product (100) implements a processor (101) having a cache (102) and a compiler (110) for converting the program (109) into a list of instructions so that the processor (101) can process the instructions; The method comprises: - said processor (101) creating (205a, 205b) one or more instruction code blocks of said program (109) and storing them in said cache (102) so that said processor (101) can fetch instructions on the list and execute them in order, the instruction code block includes a number (D) of fictitious instruction codes (0, ..., P-1, P+1, ..., D-1) and a corresponding original instruction code (P); the processor (101) executes the fictitious instruction codes (0, ..., P-1, P+1, ..., D-1) without considering their consequences and without affecting the expected outcome of the program; determining the number (D) and the position of the original instruction code (P) within the instruction code block randomly by a random or pseudo-random number generator implemented in an external storage device of the integrated circuit product (100); - said processor (101) executing (206) one or more of said blocks of instruction code.
2. The method according to claim 1, wherein at least a portion of the fictitious instruction codes (0, ..., P-1, P+1, ..., D-1) created by the processor (101) are selected (205a) from a list of fictitious instruction codes pre-stored in the integrated circuit product (100).
3. The method of claim 1 or 2, wherein at least some of the created fictitious instruction codes (0, ..., P-1, P+1, ..., D-1) are copies of the original instruction codes (205b).
4. The method further comprises: The method according to any one of claims 1 to 3, comprising the processor (101) identifying (204) the original instruction code (P) to be replaced from a list of target instruction codes pre-stored in the integrated circuit product (100).
5. 5. The method of claim 1, wherein operands associated with the fictitious instruction codes (0, ..., P-1, P+1, ..., D-1) are generated by the random or pseudo-random number generator implemented in the external storage device.
Citation Information
Patent Citations
Cryptographic architecture with instruction masking and other techniques for thwarting differential power analysis
JP2012095345A
Software Protection Using Code Overlapping
US20080215860A1
CPU obfuscation for cloud applications
US20170091486A1
