The invention relates to a method allowing a function secured by temporal desynchronization to be executed by a microprocessor, and to a data-storage medium and an electronic computer for implementing this method.
Temporal desynchronization is an approach employed in software or hardware countermeasures to make attempts at cryptanalysis of a function executed, for example, by a microprocessor of an on-board system more difficult. Below, this executed function is called a “secure function” because it is generally a function, such as, for example, an encryption or decryption function, that executes operations that are the primary target of attackers.
Cryptanalysis of a function in particular consists in studying the operation of this function in order to reveal secret information processed by this function, or to modify its operation. Attempts at cryptanalysis are conventionally called “attacks”.
Temporal desynchronization is, for example, an effective way of making side-channel attacks more difficult. Side-channel attacks encompass a wide variety of different possible attacks. For example, certain of these attacks consist in measuring a physical quantity correlated with the operations executed by the microprocessor when it is executing the secure function. This physical quantity may be the electrical power consumption of the microprocessor, the electromagnetic radiation from the microprocessor, the noise of the microprocessor, the execution time, inter alia. In the case where the physical quantity is the electrical power consumption of the microprocessor, this attack is known by the acronym DPA (“Differential Power Analysis”) or CPA (“Correlation Power Analysis”). These attacks aim to correlate an external event, such as the measurement of a physical quantity, with the time at which a particular instruction of the secure function is executed. Temporal-desynchronization techniques aim to make it more difficult to establish this correlation between external events and the execution of certain particular instructions.
Another known attack is, for example, the fault injection attack. This attack consists in causing a fault or a malfunction of the microprocessor at the particular time at which it is executing a critical instruction of the secure function. A critical instruction is, for example, a conditional branch instruction in order to cause an unexpected operation of this secure function. In the context of this type of attacks, temporal desynchronization increases how difficult it is for an attacker to target with fault injection the time at which a particular instruction of the secure function is executed.
These attacks have in common that it is necessary to correlate an external event, such as a measurement of electrical power consumption or the injection of a fault, with the time at which a particular instruction of the secure function is executed. Temporal-desynchronization techniques aim to make it more difficult to establish this correlation between external events and the execution of certain particular instructions. To this end, it has already been proposed to introduce a random time lag before the execution of each instruction of the secure function. Thus, known methods allowing a function to be executed by a microprocessor comprise:
For example, such a method is disclosed in the following articles:
By virtue of these known methods, the time at which a particular instruction of a secure function is executed varies randomly from one execution of this secure function to another.
The problem with the known methods is that the instructions of the secure function that are located, for example, at the start of this function are less well protected than the following instructions and are therefore more vulnerable to side-channel attacks, because the inserted time delay accumulates over the course of the instructions executed. Instructions that are located at the start of the secure function are those that are executed first. This will be explained using the following simplified example in which, whatever the index m:
At the present time, the difficulty of a side-channel attack is considered to be inversely proportional to the height of the maximum SPmaxm of the statistical distribution SPm, where the index m is the order number of the instruction counted, for example, from the first IDeb instruction of the secure function. On this subject, the reader may consult the article Coron2010.
To remedy this problem, it has already been proposed to modify each law Pm so that the statistical distributions SPm exhibit lower maximums SPmaxm including for low values of the index m. For example, this is what is proposed in the article Coron2010 or the article by Olivier Benoit cited above.
In particular, in the article by Olivier Benoit, the proposed law Pm is constructed so that the statistical distribution SPm has the largest possible standard deviation and therefore so that it is as flat as possible. The proposed law Pm is non-uniform. As indicated in this article, because the law Pm is non-uniform, in the particular case where a single time lag, drawn using this law Pm, is introduced before the sequence of instructions to be protected, the robustness of this sequence of instructions to a side-channel attack is decreased. To mitigate this drawback, it is proposed, in this particular case, to draw this single time lag with a uniform law and to use the law Pm for all the other time lags introduced elsewhere. In the article by Olivier Benoit, the group of possible values from which the values of the introduced time lags are drawn is the set [1; 255]. It is underlined that this set [1; 255] combined with the law Pm does not meet condition (1) described later on in this patent application. Specifically, condition (1) depends on a statistical distribution SSk of the sum of the time lags already introduced before the execution of the instruction to be protected. However, these already-introduced time lags are all drawn using the law Pm except possibly one time lag that is drawn using the uniform law. Thus, to verify whether condition (1) is met or not by the set [1; 255], it is necessary to take into account the distribution SSk and therefore the statistical distribution of the sum of the time lags already introduced using the law Pm. Simulations carried out by the inventors have shown that, in the case of the embodiment presented as preferred in the article by Olivier Benoit (i.e. for the following values of the parameters of the law Pm: a=32, b=16, k=0.92), condition (1) is not met. Other simulations carried out for the numerical values of the parameters a, b and k given in tables 1 and 2 of the article by Oliver Benoit have shown that condition (1) is not met by any of the numerical examples disclosed in this article. This is due to the fact that the law Pm was constructed to obtain the flattest possible statistical distribution of the sum of the introduced time lags.
Moreover, in practice, it is sometimes not possible or not desirable to modify the laws Pm.
The invention therefore aims to provide a method for executing a function secured by temporal desynchronization that is more robust against attacks and without it being necessary to modify the laws Pm already employed to achieve this. One subject thereof is therefore such an executing method as claimed in claim 1.
The embodiments of this method may comprise one or more of the features of the dependent claims.
Another subject of the invention is a data-storage medium that is readable by an electronic computer, wherein this data-storage medium comprises instructions for executing the method that is one subject of the present patent application, when these instructions are executed by the electronic computer.
Another subject of the invention is an electronic computer for implementing the claimed method.
The invention will be better understood on reading the following description, which is given merely by way of non-limiting example, and with reference to the drawings, in which:
In these figures, the same reference numbers have been used to denote elements that are the same. In the remainder of this description, features and functions that are well known to a person skilled in the art are not described in detail.
Below, unless otherwise indicated, terms such as “preceding instruction”, “following instruction”, “before”, and “after”, are defined with respect to the direction Dref. Thus, the instruction preceding the instruction Im is the instruction Im−1.
The terms “first instruction of the secure function” and “last instruction of the secure function” designate the first and last instruction of the secure function in the order in which these instructions are executed by an electronic computer, respectively. These first and last instructions are denoted IDeb and IDer, respectively. These instructions IDeb and IDer are independent of the direction Dref.
The instruction I1 is typically an instruction that corresponds to a time that could be chosen as a synchronization time by an attacker wishing to implement a side-channel attack. It is therefore a particular instruction of the secure function, the execution of which is easy to identify. Typically, it is the instruction IDeb or the instruction IDer of the secure function.
When the instruction I1 is the first instruction IDeb of the secure function, then the direction Dref points from the instruction IDeb to the instruction IDer. In contrast, when the instruction I1 is the last instruction IDer of the secure function, the direction Dref points from the instruction IDer to the instruction IDeb.
The time taken by the electronic computer to execute the instruction Im is denoted tim. In the particular case of the instructions I1, IDeb and IDer, these execution times are also denoted tref, tdeb and tder, respectively.
Lastly, the secure function comprises one or more sequences Seqk of instructions. A sequence Seqk is a group of one or more instructions Im that are systematically executed one after another. The sequences Seqk are separate from one another. Thus, an instruction Im that belongs to any sequence Seqk cannot also belong to another sequence of instructions.
Similarly to what was explained with respect to the index m, the index k is the order number of the sequence Seqk with respect to the other sequences of instructions of the secure function. This order number is assigned by taking instruction I1 as the origin and proceeding in the direction Dref. Thus, starting from the instruction I1 and proceeding in the direction Dref, the first sequence of instructions encountered is the sequence Seq1, the second sequence of instructions encountered is the sequence Seq2 and so on.
The terms “first instruction of the sequence Seqk” and “last instruction of the sequence Seqk” designate the first and the last instruction of the sequence Seqk in the direction Dref, respectively.
The time of execution of the first instruction of the sequence Seqk is denoted tsk.
Here, each sequence Seqk is associated with a respective zone Zk of introduction of a second time lag. The zone Zk comprises one or more instructions Im. It begins with an instruction denoted IZd,k and ends with an instruction denoted IZf,k. The zone Zk systematically precedes, in the direction Dref, the sequence Seqk. Thus, the instruction IZd,k is systematically located before, in the direction Dref, the first instruction of the sequence Seqk. The instruction IZf,k is located after the instruction IZd,k in the direction Dref. The instruction IZf,k is also located before, in the direction Dref, or coincides with the first instruction of the sequence Seqk. In
The secure function is typically a function that manipulates and/or processes secret information during its execution. For example, the secure function is an encryption or decryption function. In the case of encryption or decryption functions, the secret information often corresponds to an encryption or decryption key. For example, here, the secure function is an AES (“Advanced Encryption Standard”) encryption function. The secure function comprises a succession of instructions that codes the operations carried out by the computer 4 when it executes this secure function.
Many different architectures are possible for the computer 4. Here, by way of illustration, the computer 4 comprises:
To simplify
The computer 4 is capable of producing temporal variability on each execution of the secure function. To this end, it comprises an ordinary-temporal-desynchronization module 18 and a reinforced-temporal-desynchronization module 20.
The module 18 is for example a conventional temporal-desynchronization module. For example, it is here a hardware module capable of introducing a random time lag before the execution of each instruction Im of the secure function. Below, the random time lags introduced by the module 18 are called “first time lags”. The first time lag introduced before the instruction Im is introduced between the times tim−1 and tim. For example, the first time lags are introduced by varying the frequency of the clock 6. On this subject, the reader may refer to the following article: T. Guneysu et al.: “Generic side-channel countermeasures for reconfigurable devices,” Cryptographic Hardware and Embedded Systems CHES 2011, Springer Berlin Heidelberg, 2011, pp. 33-48.
To do this, before the execution of each instruction Im, the module 18 randomly chooses a value of a first delay from a group G1,m of n1,m possible values of this first delay. The number n1,m is an integer higher than or equal to two. The values of the group G1,m are typically integer multiples of an elementary duration de. In the particular case described here, the various values of the group G1,m are denoted j.de where:
The module 18 chooses each new value of the first delay from the group G1,m by carrying out a random draw that respects a probability law Pm. The law Pm associates with each value of the group G1,m a probability of occurrence. Here, the law Pm and the group G1,m are for example the same whatever the values of the index m.
The module 20 reinforces the temporal desynchronization of the sequences Seqk of instructions. To do this, for example, independently of the operation of the module 18, the module 20 is capable of introducing, before each time tsk at which the execution of the sequence Seqk begins, an additional time lag called the “second time lag” below. Generally, this second time lag is introduced between the times tsk−1 and tsk. Here, this second time lag is introduced in the zone Zk located between the last instruction of the sequence Segk−1 and the first instruction of the sequence Seqk. Here, the instruction IZf,k is chosen to be equal to the first instruction Im of the sequence Seqk. This zone Zk immediately precedes and is therefore contiguous with the sequence Seqk.
In the case of a software implementation of the module 20, the instruction IZd,k is for example an instruction that calls a routine RI2d that triggers the introduction of the second time lag before the execution of the instruction IZf,k. In this case, typically, the instruction IZf,k is the instruction located at the return address of the routine RI2d. The routine RI2d is executed by the microprocessor 10 before the execution of the first instruction of the sequence Seqk begins.
To introduce the second time lag, the module 20 randomly chooses a value of a second delay from a group G2,k of n2,k different values. The number n2,k is an integer number higher than or equal to two. Below, the values contained in the group G2,k are denoted x0, x1, . . . , xl, . . . , xn2,k−1. Typically, each value xl is an integer multiple of the duration de. To make this random choice, the module 20 uses a probability law Sk that associates a probability of occurrence Sk[xl] with each value xl of the group G2,k. The sum of all these probabilities of occurrence Sk[xl] is equal to one. Next, a second time lag, the duration of which is equal to the second delay xl, is introduced between the times tZd,k and tZf,k at which the instructions IZd,k and IZf,k are executed, respectively.
By way of illustration, the routine RI2d comprises instructions that, when they are executed by the microprocessor 10:
Here, the module 20 is associated with a memory in which is stored for each sequence Seqk:
For example, by way of illustration, this information is stored in the memory 12.
Preferably, the law Sk is practically equiprobable, i.e., whatever the value xl, the probability Sk[xl] is comprised between 0.9/n2,k and 1.1/n2,k. In this embodiment, each law Sk is equiprobable, i.e. each probability Sk[xl] is equal to 1/n2,k.
To increase the temporal desynchronization of the sequence Seqk, the values xl of the group G2,k stored beforehand in the memory 12 meet the following condition (1):
where:
The sum of the time lags already introduced between the times tref and tsk notably comprises:
It will be noted that this sum may also take into account any time lag other than those introduced by modules 18 and 20. In contrast, this sum does not take into account the second time lag selected using the law Sk.
The number p is a number chosen during the design of the law Sk. The higher this number p, the lower the maximum SEmaxk and therefore the greater the robustness of the sequence Seqk to side-channel attacks. The maximum of a statistical distribution SEk is here denoted SEmaxk. The statistical distribution SEk is the statistical distribution of the sum of all the time lags introduced between the times tref and tsk. The statistical distribution SEk is therefore identical to the statistical distribution SSk except that it in addition takes into account the second time lag selected using the law Sk.
The reason why meeting condition (1) allows the maximum SEmaxk to be decreased will now be explained with reference to
These explanations are given in the particular case where n2,k is equal to two, so that the two values of the group G2,k are x0 and x1. In addition, here, the value x0 is zero and the value x1 is an integer multiple of the duration de. For example, the value x1 is equal to 5de. The law Sk is equiprobable and therefore the probabilities of occurrence of the values x0 and x1 are both equal to 0.5.
The graph of
The graph of
Therefore, if condition (1) is met, whatever the value of the index j, the probability of occurrence SEk(j.de) is lower than SSmaxk/p. The maximum SEmaxk is therefore necessarily lower than the maximum SSmaxk. Thus, the introduction of the second time lag decreases the value of the maximum SEmaxk with respect to an embodiment in which this second time lag would never be introduced before the time tsk. Therefore, provided that the values xl of the group G2,k meet condition (1), the temporal desynchronization of the sequence Seqk is improved by a configurable factor related to the factor 1/p. In the particular case of the above explanations, the maximum SEmaxk is two times lower than the maximum SSmaxk, despite introducing a second time lag that is only equal to x1/2 on average.
Condition (1) is expressed in the general case where:
It is possible to determine a high number of sets of values xl that meet condition (1). However, among this high number of possible sets of xl values, certain are more advantageous than others. These sets of values x1 that are more advantageous than others meet additional conditions. For example, in this embodiment, the values of the group G2,k in addition meet the following condition, condition (2):
where:
Thus, contrary to the statistical distribution SSk, the distribution SPk takes into account only the introduced first time lags. Therefore, notably, it does not take into account any second time lags introduced before the time tsk−1.
Currently, it is believed that if the values of the group G2,k meet condition (2) then they also necessarily meet condition (1). The statistical distribution SPk is easier to determine than the distribution SSk. For example, the distribution SPk may be measured experimentally. To do this, in an initialization phase, the secure function is executed multiple times by a computer identical to computer 4 except that it is devoid of a module 20. During each of these executions, the time at which the execution of the sequence Seqk begins is recorded. On the basis of these recordings, the statistical distribution SPk is then constructed. It will be noted that the advantage of measuring the statistical distribution SPk is that this may be done without knowing the various laws Pm used by the module 18.
Alternatively, if, conversely, the various laws Pm used by the module 18 are known, then it is also possible to construct the statistical distribution SPk by computation, this being simple and rapid. Once the statistical distribution SPk has been constructed, its maximum SPmaxk is also known.
Moreover, in order not to slow down the execution of the secure function too much, it is desirable for the weighted average of the introduced second time lags to be as low as possible. To this end, it is required here that x0=0. In addition, regardless of the index l higher than or equal to 1, it is also required that the values xl be comprised between 0.9.l.i.de and 1.1.l.i.de, where the number i is the lowest integer for which at least one of the following conditions (3) or (3′) is met:
Condition (3′) is used if only the distribution SPk has been determined. Otherwise, preferably, condition (3) is used. Any set of values xl that meets condition (3) or (3′) also in addition meets condition (1). The sets of values xl that meet condition (3′) also in addition meet condition (2).
Finally, in this embodiment, it is in addition required that the group G2,k be the same for T different sequences Seqk, where T is an integer higher than or equal to two. For example, the T sequences Seqk are the T successive sequences Seqk to Seqk+T−1. To achieve this, the same set of values xl must meet conditions (3) or (3′) for k, k+1 up to k+(T−1). In other words, in this embodiment, regardless of the index l higher than or equal to 1, it is also required that the values xl be comprised between 0.9.l.i.de and 1.1.l.i.de, where the number i is the lowest integer for which at least one of the following condition (4) or (4′) is met:
The operation of the system 2 will now be described with reference to
The method begins with an initialization phase 40. This phase 40 begins with the identification of the sequences Seqk of instructions of the secure function that must be subjected to reinforced temporal desynchronization. There are many different ways of identifying these sequences. However, below, certain guidelines are given that allow the implementation of the method described here to be optimized. For example, for each possible sequence Seqk, a safety threshold S1,k, below which the maximum SEmaxk must lie, is set. By way of illustration, here, this threshold S1,k is the same for all the sequences Seqk. Typically, the threshold S1,k is chosen to be lower than 0.2 or 0.1 and, preferably, lower than 0.08 or 0.05 or 0.01.
As explained above, the larger the summed amount of introduced first time lags, the more the value of the maximum SPmaxm decreases. There is therefore an index a+1, corresponding to an instruction Ia+1, from which the maximum SPmaxm is lower than the threshold S1,k, without it being necessary to introduce second time lags. In other words, the instruction Ia is the last instruction for which the following condition is met: SPmaxa>S1,k. It is therefore unnecessary to introduce second time lags after the execution of instruction Ia. The introduction of second time lags after the execution of the instruction Ia unnecessarily delays the execution of the secure function. Here, during phase 40, the instruction Ia is identified. To do this, for example, the distribution SPm of the sum of the first time lags between the time tref and the time tim is determined by increasing the index m to the index a+1. The statistical distribution SPm is determined by measurement or by computation if the laws Pm are known. The instruction If of the secure function from which the introduction of second time lags must be inhibited is then chosen to lie between the instruction Ia and the instruction Ib. Therefore, the introduction of second time lags ceases well before the time tder and even despite the fact that the introduction of first time lags continues after the execution of the instruction If, until the time tder, for example. In order not to unnecessarily delay the execution of the secure function, the index b is here chosen to lie between a and a+100.
Generally, the first instructions of the secure function do not process secret information. There is therefore often an index d below which the introduction of the second time lag is also unnecessary. The sequences Seqk are therefore here located between the instructions Id and If. Between these instructions Id and If, certain sequences of instructions may be more critical than others. Thus, advantageously, each sequence Seqk corresponds to one of these more critical sequences of instructions. In this case, the sequences Seqk of instructions are separated from one another by less critical instructions of the secure function. The times of execution of these less critical instructions are desynchronized only by the introduction of first delays.
Lastly, each identified sequence Seqk is associated with one zone Zk. To do this, the instruction IZd,k is introduced in the code of the secure function between the last instruction of the sequence Seqk−1 and the first instruction of the sequence Seqk. Here, the instruction IZd,k is a call to the routine RI2d. In this case, the instruction IZf,k is the instruction located at the return address of this routine RI2d.
Also in phase 40, for each sequence Seqk, a law Sk is constructed so that following the introduction of the second time lag, the maximum SEmaxk is lower than the threshold S1,k. To achieve this, the various statistical distributions SSk or SPk associated with each sequence Seqk are determined either from measurements or by computation if the laws Pm are known and the distribution is computable. Below, the particular case where it is the statistical distributions SPk that have been determined is considered. However, everything that is described in this particular case also applies to the case where it is the distributions SSk that are determined, the expression “SPk” simply needing to be replaced by the expression “SSk”.
When the statistical distribution SPk has been determined, the maximum SPmaxk is also known. The number p such that SPmaxk/p=S1,k is then determined.
Next, the number n2,k is set equal to or higher than the ceiling of the number p. The ceiling of a number is the lowest integer higher than or equal to that number.
The probability of occurrence Sk[xl] associated with each of the values xl of the group G2,k is also chosen. Here, the law Sk is equiprobable, i.e. the law Sk is a discrete uniform law. In this case, the probability of occurrence Sk[xl] of each value xl is therefore equal to 1/n2,k.
Lastly, for each set of T successive sequences Seqk to Seqk+T−1, the values xl that meet condition (4′) are determined and stored in the memory 12. Thus, at the end of phase 40, for each sequence Seqk:
Once the initialization phase 40 has ended, the system 2 may then proceed with a phase 42 of executing the secure function.
In the phase 42, and more precisely in step 44, the microprocessor 10 executes one after another the instructions Im of the secure function.
In parallel, the module 18 executes, for example continuously, a phase 46 of ordinary temporal desynchronization. In this embodiment, phase 46 comprises, before the execution of each instruction Im, the execution of the following operations 48 and 50.
In operation 48, the module 18 randomly chooses, according to the law Pm, a value of a first delay from the group G1,m.
Next, in operation 50, the module 18 introduces a first time lag of duration equal to this first delay before the execution of the instruction Im by the microprocessor 10. This first time lag is introduced between the times tim−1 and tim. The introduction of this first time lag therefore results in a shift of the time tim with respect to the time tim−1.
In parallel with step 44 and phase 46, module 20 executes a phase 60 of reinforced temporal desynchronization. The execution of phase 60 is here triggered only in response to each loading or execution of an instruction IZd,k. As explained above, in this embodiment, the instruction IZd,k is a call to the routine RI2d. The execution of phase 60 is then systematically interrupted in response to the instruction IZf,k being loaded or executed. When phase 60 is executed, the module 20 carries out the following operations.
In an operation 62, the module 20 randomly chooses a value of the second delay from the group G2,k, this choice being made according to the law Sk.
Next, in an operation 64, the module 20 introduces a second time lag of duration equal to the second delay, chosen in operation 62, before the instruction IZf,k is loaded or executed, i.e. here before the instruction located at the return address of the routine RI2d is loaded. The routine RI2d introduces this second time lag by executing unnecessary instructions a certain number of times, for example.
There are many other methods of introducing a time lag during the execution of a secure function. All the methods presented below may be applied both to the introduction of the first time lag and to the introduction of the second time lag.
For example, a polymorphic code may be used to do this. Polymorphic codes are well known. For example, the reader may consult the following articles on this subject:
In summary, a polymorphic code of a secure function is capable of performing a given operation, but by executing, alternately, various variants of the executable code. Each of these variants produces the same result when it is executed by the microprocessor, but the code for each of these variants is different. For example, typically, to perform the given operation, each of the variants executes a different number of instructions and/or different instructions. The times taken by the microprocessor to execute each of these variants are therefore different from one another. Thus, choosing a variant that takes longer to execute than another variant introduces a time lag in the execution of the secure function. The executable code of each of these variants may be stored beforehand in a memory or be generated on the fly in a compilation phase prior to its execution. Conventionally, during the execution of the polymorphic code, the variant to be executed to perform the operation is randomly chosen. Instead of this, here the variant to be executed to perform the operation is chosen depending on the value of the first or the second delay. In other words, a variant whose execution time is equal to the first or to the second randomly chosen delay is chosen.
It is also possible to introduce a time lag into the execution of a secure function by decreasing the frequency of the clock that sets the rate of the operation of the microprocessor. On this subject, the reader may refer to the following article: T. Guneysu et al.: “Generic side-channel countermeasures for reconfigurable devices,” Cryptographic Hardware and Embedded Systems CHES 2011, Springer Berlin Heidelberg, 2011, pp. 33-48.
Another method for introducing a time lag into the execution of a secure function is to interrupt its execution for a preset time interval, either by preempting the execution of the secure function by triggering an interrupt, or by inserting into the code of the secure function calls to independent routines the execution time of which is variable. On this subject, the reader may consult the following article: J.-S. Coron et al.: “An efficient method for random delay generation in embedded software” Lecture Notes in Computer Science, vol. 5747 LNCS, pp. 156-170, 2009.
In the phase 46 of ordinary temporal desynchronization, the first time lag is not necessarily introduced in the same way depending on whether, in parallel, the phase 60 of reinforced temporal desynchronization is executed or not. For example, in phase 46, and in the absence of parallel execution of phase 60, the first time lag is introduced by modifying the frequency of the clock 6. When phases 46 and 60 are executed simultaneously, the first time lag may be introduced by triggering the execution of a routine RI1d. During the execution of this routine RI1d, the first delay is randomly chosen using the law Pk associated with the first instruction of the sequence Seqk. The second delay is randomly chosen using the law Sk. Next, the first and second delays thus chosen are added to each other to obtain a third delay. A time lag of a duration equal to the third delay is then introduced immediately before the time tsk. For example, in this case, this delay may be introduced by executing a loop of unnecessary instructions a sufficient number of times to delay the time tsk with respect to the time tsk−1 by a duration equal to the third time lag. In this case, since the first time lag is introduced by executing the routine RI1d, it does not need to be introduced using the module 18 and hence the module 18 may be temporarily deactivated.
The second time lag does not need to be introduced immediately before the first instruction of the sequence Seqk. In other words, the instruction IZf,k may be located one or more instructions before the first instruction of the sequence Seqk. The instruction IZf,k may even be located before the first instruction of the sequence Segk−1, or even anywhere between the instructions I1 and the first instruction of the sequence Seqk.
The second time lag does not need to be introduced all at once. As a variant, the second time lag is divided into a plurality of sub-periods, the sum of which is equal to the duration of the second time lag. Next, each of these time-lag sub-periods is introduced during the execution of the secure function at different respective times located between the times tsk−1 and tsk. To do this, typically, the instructions IZd,k and IZf,k are separated from each other by a plurality of intermediate instructions and these time-lag sub-periods are each introduced before a respective intermediate instruction.
When the reinforced-temporal-desynchronization module is implemented in the form of a hardware or software module that operates independently of the secure function, this module comprises, for each sequence Segk, identifiers stored beforehand in its memory that allow it to identify particular instructions of the secure function that precede the sequence Seqk. These particular instructions identifiable by the module 20 correspond to the instructions IZd,k and IZf,k. For example, the identifiers used are the addresses of the instructions IZd,k and IZf,k. In this case, the module 20 continuously compares the address of the instruction loaded by the microprocessor 10 with the previously stored addresses of the instructions IZd,k. When the module 20 determines that the address of the instruction loaded by the microprocessor 10 corresponds to one of the previously stored addresses of the instructions IZd,k, then it executes the operations 62 and 64. In the case where the address of the instruction loaded by the microprocessor 10 corresponds to the previously stored address of an instruction IZf,k, then the module 20 interrupts the execution of phase 60. If the introduction of the second time lag has not yet ended when the instruction Izf,k is loaded or executed, then the second time lag is introduced at that time, all at once in step 64.
As a variant, the distances between two successive values of the group G2,k are not all the same. In other words, the n2,k values of the group G2,k do not need to be uniformly distributed. For example, in the case where n2,k=3, the group G2,k contains the following three values 0, i.de and 4.i.de instead of the three values 0, i.de and 2.i.de as described in the preceding embodiments.
As a variant, conditions (3) and (3′) are not met. In this case, the distance between any two successive values of the group G2,k is not equal to i.de, but strictly larger than i.de. For example, this distance is larger than or equal to 1.1.i.de or 1.5.i.de or 2.i.de.
In another variant, the group G2,k does not contain the value 0. For example, the group G2,k contains only the values i.de and 2.i.de.
The T sequences Seqk that meet condition (4) or (4′) are not necessarily consecutive sequences Seqk but may be arbitrarily chosen from the set of sequences Seqk.
Condition (4) or (4′) need not be met. In this case, the group G2,k is generally different from the group G2,k+1. Specifically, the maximum SPmaxk or SSmaxk varies as a function of the value of the index k.
More generally, the laws Sk and Sk+1 may differ from each other in one or more of the following features:
Even when condition (4) or (4′) is met by the values of the groups G2,k and G2,k+1, the laws Sk and Sk+1 are not necessarily identical. For example, these laws Sk and Sk+1 may differ from each other in the probabilities associated with each of the values xl of the group G2,k.
The same sequence Seqk may be associated with a plurality of different laws Sk here denoted Sk,1, Sk,2, Sk,3 and so on. The laws Sk,1, Sk,2, Sk,3 all meet condition (1). Here, the laws Sk,1, Sk,2 and Sk,3 are for example obtained for different values of the number p, denoted p1, p2 and p3, with, for example, p1>1.3, p2>p1 and p3>p2. In other words, the value obtained for SEmaxk is higher when the law Sk,1 is used than when the law Sk,2 is used. Likewise, the maximum SEmaxk is higher when the law Sk,2 is used than when the law Sk,3 is used. Next, during the execution of the secure function, the module 20 selects, from among the various possible laws Sk,1, Sk,2, Sk,3, the law to be used to randomly choose the value of the second delay. This selection is preferably made depending on the context in which the secure function is executed. For example, the module 20 automatically selects the law Sk to be used depending on a required security level that was transmitted to it beforehand. The required security level may be determined by the computer itself. Thus if the computer detects or determines that it is probable that it is currently being subjected to an attack, a side-channel attack for example, then the computer 4 increases the security level, this leading to a law Sk that decreases the maximum SEmaxk more being selected. The security level may also be selected depending on the nature of the processing operations currently being executed by the computer 4.
In the embodiments described above, the distribution SPk is used instead of the distribution SSk to construct the law Sk. In other embodiments, the statistical distribution SSk is constructed and then used in turn to construct the law Sk. In this case, it is possible to construct groups G2,k of values that meet condition (1) without meeting condition (2). Contrary to the statistical distribution SPk, the statistical distribution SSk takes into account both the first and the second time lags already introduced before the execution of the sequence Seqk. Thus, to construct the statistical distribution SSk, it is necessary to know the statistical distribution SSk−1 and the law Sk−1. Therefore, it is possible to construct the statistical distribution SSk using an iterative process. For example, from the time t=0 to the time t=kmax, where kmax is the highest value of the index k, the following operations are reiterated:
1) constructing the statistical distribution SSt+1 on the basis of the statistical distribution SSt, of the law St and of the laws Pm used to introduce the first time lags between the time tst−1 and the time tst, then
2) constructing the law St+1 on the basis of the statistical distribution SSt+1 and of its maximum SSmaxt+1.
The statistical distribution SS1 is equal to the statistical distribution SPZf,1 because, before the time tZf,1, no second time lag other than the one chosen according to the law S1 has yet been introduced.
Many variants of the Pm law are possible. Similarly to what was described with respect to the law Sk, the law Pm used to choose the value of the first delay is not necessarily always the same for all the instructions Im. For example, the laws Pm and Pm+1 may differ from each other in one or more of the following features:
The law Pm may also associate, with one or more values of the group G1,m, a zero probability of occurrence. For example, the law Pm may associate a zero value of occurrence with the zero value of the first delay. Thus, each time a new value of the first delay is chosen, this new value is systematically different from the zero value.
Many other embodiments of the system 2 are possible. For example, the module 20 is not necessarily a software module executed by the same microprocessor as that which executes the secure function. Thus, as a variant, the module 20 is a software module executed by a security microprocessor capable of introducing the second time lags during the execution of the secure function by the microprocessor 10. The module 20 may also take the form of a hardware module able to execute phase 60. When the modules 18 and 20 are modules that are independent of the microprocessor 10, these modules may be implemented on the same security microprocessor or in the same hardware module independent of the microprocessor 10.
The microprocessor 10 that executes the secure function is not necessarily a generic microprocessor equipped with an arithmetic logic unit able to execute a program stored in an external memory. For example, as a variant, the microprocessor is a specific microprocessor only capable of executing the secure function. For example, such a specific microprocessor is a hardware module dedicated to the execution of this specific function and that cannot be programmed to execute new functions other than those provided for during its design. For example, it may be a hardware module designed to execute the AES secure function.
The initialization phase 40 may be carried out by the computer 4 itself. In this case, during the initialization phase, the microprocessor 10 executes the secure function a plurality of times and, during each of these executions, only the phase 46 of ordinary temporal desynchronization is implemented. During this initialization phase, phase 60 of reinforced temporal desynchronization is not executed. Typically, in this case, during this initialization phase, the secret information processed by the secure function is replaced by decoys. For example, the encryption keys are replaced by randomly drawn encryption keys. Thus, this secret information cannot be leaked during the initialization phase by the repeated executions of the secure function. During this initialization phase, for each sequence Seqk, the module 20 notes the time tsk at which the execution of this sequence begins. As described above, on the basis of these various measurements, the module 20 constructs the statistical distribution SPk and therefore obtains the value of the maximum SPmaxk. Next, the module 20 chooses the number n2,k, for example as described above. In another embodiment, the number n2,k may be randomly chosen from a limited group of integers. The law Sk[xl] is systematically chosen to be equal to 1/n2,k. From this moment, the module 20 automatically determines a set of values x1 that meets condition (1) and in addition, optionally, condition (2), (3′) and/or (4′). To do this, it uses the distribution SPk that it has determined automatically. At this stage, the law Sk has been automatically constructed and it is then stored in the memory 12 associated with the sequence Seqk. This memory 12 comprises, beforehand, the identifiers of the instructions IZd,k and IZf,k. For example, these instructions are, as in the embodiments previously described, a call and return instruction of the routine RI2d, respectively. Once the law Sk has been determined for each of the sequences Seqk, then the initialization phase stops and the computer 4 then proceeds to the actual phase of execution of the secure function. This execution phase is for example identical to phase 42 described above.
The module 20 may also execute the initialization phase 40 at the same time as the execution phase 42. For example, as in the embodiment of the above paragraph, the module 20 constructs the statistical distribution SPk just before the execution of the sequence Seqk on the basis of knowledge of the laws Pm and of the order number m of the first instruction of the sequence Seqk. On the basis of this determined statistical distribution SPk, the module 20 constructs the law Sk as described above. In this case, the law Sk is constructed between the times tsk−1 and tsk.
Advantageously, in the initialization phase 40, the microprocessor also identifies the instruction If from which the insertion of the second delays becomes unnecessary to meet the condition SEmaxk<S1,k and may therefore be systematically inhibited. For example, to do this the microprocessor proceeds as described in the main embodiment. In particular, the microprocessor identifies the last instruction Ia, and therefore the time ta, for which the following condition is met: SPmaxa>S1,k. Since, in order to do this, the statistical distribution SPm must be determined for various times tim, this determination is carried out either during the execution of an initialization phase 40 that precedes the execution of phase 42 or during an initialization phase 40 executed at the same time as the phase 42. These two alternatives are for example implemented as described in the two preceding paragraphs.
In one simplified embodiment, the instructions IZd,k and IZf,k are automatically introduced into the code of the secure function by the computer 4 in phase 40. For example, the computer 4 distributes randomly or, on the contrary, uniformly, these instructions IZd,k and IZf,k throughout the code of the secure function. In this case, the sequences Seqk do not necessarily correspond to a sequence of critical instructions.
In another variant, phase 60 is executed in response to a command received by the computer 4. In this case, until this command is received, even if the microprocessor 10 loads or executes an instruction IZd,k, phase 60 is not executed. In contrast, after receipt of this command, as soon as the microprocessor 10 loads or executes an instruction IZd,k, phase 60 is executed. For example, this command is sent and received by the computer 4 as soon as an attempt at attack is detected. In another variant, this command comprises the law Sk and the group G2,k to be used to introduce, immediately in response, a second time lag. In this case, phase 60 may be triggered at any time and without waiting for an instruction IZd,k to be loaded or executed by the microprocessor 10. In this last variant, the instructions Izd,k and IZf,k may be omitted.
Similarly, phase 60 may be interrupted in response to a command received by the computer 4.
In another embodiment, in response to the instruction IZd,k being loaded or executed, before the execution of phase 60 is triggered, the module 20 determines, by computation, the maximum SPmaxZd,k of the statistical distribution SPZd,k. Next, it compares this computed maximum SPmaxZd,k with a high threshold Sh stored beforehand. If the computed maximum SPmaxZd,k is higher than this threshold Sh, then the module 20 triggers the execution of phase 60. In the contrary case, the module 20 inhibits the execution of phase 60. This allows the times at which phase 60 is triggered to be automatically adapted to various secure functions executable by the same microprocessor 10.
As a variant, phase 46 is not executed throughout the duration of the execution of the secure function. For example, phase 46 may be interrupted when the instructions being executed are not critical. Subsequently, the execution of phase 46 may also be restarted if necessary. Optionally, phase 60 may continue to be executed during the period of time in which phase 46 is interrupted. It is even possible to execute phase 60 only during the period of time in which phase 46 is interrupted.
Steps 62 and 64 may be executed a plurality of times for the same sequence Seqk. For example, in the embodiment described with reference to
Certain side-channel attacks are carried out by taking as reference time the time at which the execution of the secure function ends. To make these attacks difficult, it is also necessary to minimize the maximum SEmaxk in the case where the reference time tref is equal to the time tder and the direction Dref points from the instruction IDer to the instruction IDeb. In this case, the statistical distributions SSk or SPk are different from those constructed when the reference time tref is equal to the time tdeb. More generally, if it is suspected that a time at which a particular instruction of the secure function is executed may be used as a reference time to implement a side-channel attack, then the methods described here may be implemented choosing as time tref this time at which this particular instruction is executed. The time tref may therefore be located between the times tdeb and tder. In particular, to protect the execution of the secure function, from various side-channel attacks using various reference times, a plurality of phases of reinforced temporal desynchronization similar to phase 60 may be executed in parallel. These various phases of reinforced temporal desynchronization then differ from one another only in the time tref chosen as the reference time. In particular, it is useful to execute, in parallel with phase 60, an additional phase of reinforced temporal desynchronization for which the reference time tref has been chosen to be equal to tder. Specifically, this then allows the instructions located at the start of the secure function to be protected, as well as those located at the end of the secure function.
The number of instructions contained in the sequence Seqk is for example equal to one.
As a variant, the group of secure-function instructions before each of which steps 48 and 50 are executed does not contain all the instructions of the secure function, but only a small number of these instructions Im. For example, this group contains only one instruction in two of the secure function.
Introducing a second time lag in addition to the first time lag allows the maximum SEmaxk to be decreased and therefore side-channel attacks to be made more difficult. In addition, this decrease in the maximum SEmaxk is obtained without it being necessary to modify the law Pm. Therefore, this method may be implemented in cases where it is not possible or not desirable to modify the laws Pm used to randomly choose the first delays. The method described here may therefore be implemented in a higher number of cases.
The fact that the law Sk is equiprobable or practically equiprobable allows, for a group G2,k of given values, the maximum SEmaxk to be minimized and therefore side-channel attacks to be made even more difficult.
Choosing each value xl between 0.9.l.i.de and 1.1.l.i.de, where i is the lowest integer that meets condition (3) or (3′), allows, for a preset number n2,k of values of the group G2,k, the execution time of the secure function to be minimized.
Choosing n2,k=2 allows the execution time of the secure function to be minimized.
The fact that the values xl of the group G2,k in addition meet condition (4) or (4′) allows the same group G2,k of values to be used to decrease the maximum SEmaxk of a plurality of sequences Sk to Sk+T−1.
Inhibiting the execution of phase 60 well before the end of the execution of the secure function allows the execution time of this secure function to be shortened.
Inhibiting the execution of phase 60 after the execution of the instruction If allows the execution time of the secure function to be further decreased.
Determining SPmaxk and triggering phase 60 only if the maximum SPmaxk crosses a preset threshold allows the time at which phase 60 is triggered to be automatically adapted to various secure functions executable by the same microprocessor 10.
Number | Date | Country | Kind |
---|---|---|---|
1856781 | Jul 2018 | FR | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/FR2019/051640 | 7/2/2019 | WO | 00 |