This application claims priority from German Patent Application No. 10 2004 018 874.2, which was filed on Apr. 19, 2004, and is incorporated herein by reference in its entirety.
1. Field of the Invention
The present invention relates generally to the determination of a result and is, for example, beneficial in determining results as they occur during the execution of a cryptographic algorithm.
2. Description of the Related Art
In some cryptographic algorithms, so-called S-boxes are used. Examples of such cryptographic algorithms are, for example, the DES (data encryption standard) and the AES (advanced encryption standard) algorithms.
The encrypted and expanded 48-bit data block is again mapped to a 32-bit data block in the so-called S-boxes S1, S8 mentioned above. For this, each S-box maps six different ones of the 48 bits of the encrypted data block to four bits, respectively, wherein the mapping rules of the individual S-boxes are mostly set by standards. Following this S-box mapping 918, the resulting value is again subjected to a permutation P 920, and then the permuted 32-bit block is subjected to an XOR operation 922 with the 32-bit data block L 904 of the previous round. The XOR-combined 32-bit data block represents the new 32-bit data block R 906 for the next round. This round defined by the steps 908, 910, 912, 918, 920 and 922 is performed 16 times. After the 16 rounds, the resulting 32-bit data blocks L and R (904, 906) are again joined into a 64-bit data block and subjected to an output permutation 924 inverse to the permutation 902, the result being the final 64-bit output data block in encrypted form indicated by 926.
When executing a cryptographic algorithm, such as the DES algorithm explained by way of example above, on a hardware basis, information on the processed operation and the used data, such as particularly the round keys, are leaked by side channels, such as current supply or electromagnetic radiation. This information may then be used with the aid of DPA (differential power analysis) or DMA (differential electro-magnetic analysis) to spy out secrets, such as the master key of the DES algorithm on which the round keys are based. This may be illustrated with respect to the DES algorithm of
As mentioned above, the crypto-algorithms DES and AES are not the only ones in which data are encrypted by means of S-boxes. In all these algorithms, a differential current analysis or an analysis of the emitted electromagnetic radiation allows an attack on secret data in the way indicated above. If unprotected S-boxes are used for memory encryption in a microcontroller, even software crypto-algorithms running on the processor and getting data from the encrypted memories may be attacked via a DPA attack.
Avoiding this therefore requires minimizing the usable radiation or hiding it so that it does not become usable or only becomes usable with large effort. Up to now, this problem has not been solved in an adequate way. Although it is possible to enhance the security against DPA attacks in this respect by the use of full-custom dual-rail circuit technology, the use of this circuit technology implies a very large effort which does not seem justified in all applications. Further possible approaches would be, for example, a randomized program execution, which could, however, be recognized from the leakage profile, the execution of critical calculations with data protected by a one-time pad, the generation of noise, the introduction of jitter into the code execution and/or the clock of the system, or the like. These possibilities, however, are not very effective, in part, or they are blocked by patents of third parties.
It is an object of the present invention to provide a scheme for determining a result allowing enhanced security against cryptographic attacks, such as DPA or DEMA attacks, with acceptable effort.
In accordance with a first aspect, the present invention provides a device for determining a calculation result, having a unit for determining a first intermediate result and a second intermediate result, wherein the result depends on the first intermediate result and the second intermediate result; and a unit for randomly determining a sequence in which the unit for determining executes the determination of the first intermediate result and the second intermediate result.
In accordance with a second aspect, the present invention provides a method for calculating a result, having the steps of determining a first intermediate result and a second intermediate result; wherein the result depends on the first intermediate result and the second intermediate result, and wherein the method further has the step of randomly determining a sequence in which the steps of determining are executed.
In accordance with a third aspect, the present invention provides a computer program with a program code for performing the above-mentioned method, when the computer program runs on a computer.
Preferred embodiments of the present invention will be explained in more detail in the following with respect to the accompanying drawings, in which:
a is a schematic illustration of the structure of the input data block prior to the S-box substitution in a DES algorithm;
b is a schematic illustration of the arrangement of S-box look-up tables in a linear address space according to an embodiment of the present invention;
c is a schematic illustration of the structure of an address for substituting a 6-bit word and/or block from the input data block of
d is a pseudo program code for the implementation of a random execution of the S-box operations in a substitution operation of a round of a DES algorithm according to an embodiment of the present invention; and
A central idea of the present invention is that a reduction of the averaged leakage information when executing cryptographic algorithms may be achieved by determining the results or partial results which occur in the course of the execution of this algorithm and are themselves based on intermediate results such that the sequence in which the intermediate results are determined is determined randomly. The present invention makes use of the fact that, on the one hand, it is irrelevant for the determination of a result from two intermediate results with respect to the result of the determination in which order the intermediate results are determined, that, however, on the other hand, the leakage information detectable from outside, i.e. the correlation of secret data with the power consumption and/or the emitted electromagnetic power or the like, is reduced when the intermediate results are determined in random order, because even when the same input data are used for the algorithm when executing the cryptographic algorithm, the resulting leakage profiles differ. This increases the number of necessary averagings on the attacker side which can be decisive for success or failure of an attack.
The present invention is particularly advantageous when the determination of the intermediate results includes looking up in one or more look-up tables, because, especially in the case of memory accesses, correlations on the address, as they occur, for example, in the S-box accesses of known block ciphers, such as the DES or AES algorithms, represent a large leakage risk. In particular, an effective hardware protection, for example by dual-rail circuit technology, is very hard to realize here because of the mostly very extensive memory systems. However, an encryption round in block ciphers generally consists of several independent S-box accesses, namely eight parallel, mutually independent accesses to eight different S-boxes in the case of the DES and 16 independent accesses to a common S-box in the case of the AES, so that the invention may be used in a particularly effective way here with respect to the S-box accesses because the number of possible execution sequences from which one is randomly determined is large.
One embodiment of the present invention makes use of this property and allows an effective reduction of the averaged leakage information in memory accesses, which are required for the DPA/DEMA, wherein the reduction cannot be cancelled by external attack methods, whereby this kind of attack is made significantly harder or is even prevented.
According to this embodiment, the means for determining the intermediate results on which the final result is based includes one or more look-up tables. An intermediate result is defined as the result of looking up in the look-up table and/or one of the look-up tables using an input date associated with the intermediate result. The individual look-up and/or substitution processes, however, are performed in a random sequence instead of a predetermined constant sequence.
According to a special embodiment of the present invention, the randomness of the execution of the determination of the intermediate results is achieved by randomly determining one of the determinations of an intermediate result as the starting first intermediate result determination from which the determinations of the remaining intermediate results are executed in a predetermined constant cyclical sequence.
The number of the possible execution sequences is limited to the number of the intermediate results in this embodiment, but the implementation is simple as only one random value has to be determined.
The present invention is further advantageous in that it is implementable in existing program codes for cryptographic algorithms in a way that different program code portions do not have to be jumped to randomly to realize the different random execution sequence, but that the random execution sequence may be achieved with one and the same program code only by clever address manipulations and/or pointer manipulations. The attacker therefore cannot draw conclusions as to the randomly determined execution sequence, not even by observing the program counter and/or the program processing profile.
It is to be noted that like elements have been given the same reference numerals in
Accordingly, the device 10 includes an input 12 for A, an input 14 for B, and an output 16 for C. Further, the device 10 includes first and second intermediate result determination means 18 and 20, respectively, means 22 for forming the result C from intermediate results of the intermediate result determination means 18, 20, and means 24 for determining an execution sequence.
The intermediate result determination means 18 is connected between the input 12 and the means 22. Accordingly, the intermediate result determination means 20 is connected between the input 14 and the means 22. The means 22 outputs the result C at output 16. The means 24 for determining the sequence operates on corresponding means, such as the means 18 and 20 themselves or means not shown between inputs 12 and 14 on the one hand and the intermediate result determination means 18 and 20 on the other hand, to determine and/or control randomly the sequence of the processing of the input operands A and B by the intermediate result determination means 18, 20, as described in the following.
After the structure of the device 10 of
The intermediate result determination means 18 and 20 determine an intermediate result from the input operands and/or input operand sets A and B, respectively, according to a predetermined operation. The predetermined operation may, for example, include looking up in a look-up table based on the operand and/or the operand set A and/or B, or the logical and/or arithmetic combining of the input operands of the input operand set A and/or B to obtain the respective intermediate result. An example of an arithmetic combination would be a modular multiplication or modular addition of two input operands.
After having received the intermediate results from the intermediate result determination means 18 and 20, the means 22 forms the result C from the intermediate results of these means. The formation of the result C may, for example, consist only of joining one bit representation of the two intermediate results with a bit representation of the result C. In this case, the means 22 only manifests itself in that the result C is further processed in the further course of the crypto-algorithm execution, or in that the result C represents the result, such as the cipher, of the crypto-algorithm itself. However, the means 22 could further form the result also from the intermediate results by arithmetic or logical operations, such as by arithmetic or logical combination of the two intermediate results, such as a bitwise XOR operation of both intermediate results of the means 18 and 20.
The hardware on which the intermediate result determination means 18 and 20 are based, such as the processor or the memory which is accessed, as discussed in the following, gives away information on the input operands A and/or B to the outside and/or leaks information on the input operands A and/or B. This applies particularly when the operation executed by these means 18 and 20 is a substitution operation, i.e. looking up in a look-up table by a memory access to a stored look-up table. In order to reduce the leakage risk by DPA/DEMA attacks, the means 24 determines in advance, i.e. prior to the execution of the intermediate result determinations by the means 18 and 20, randomly a sequence in which the intermediate result determination means 18 and 20 will determine their respective intermediate result. In the present simple case of only two intermediate results to be determined, it is sufficient that the means 24 randomly determines one of the two values 0 and 1. Depending on which value has been determined randomly, the means 24 causes first one of the two intermediate result determination means 18, 20 to determine its intermediate result from the input date A or B supplied to and/or associated with the same, and only after that the other of the two intermediate result determination means 18, 20 to determine its own intermediate result based on the operand B or A, respectively, associated therewith, and to pass it on to the means 22. For this, the means 24, for example, drives appropriate registers to pass first A to 18 and then B to 20, or vice versa.
The advantage is that the attacker requires a higher number of averagings, in the present case a number of averagings increased by the factor 4, from the current profile and/or the emitted electromagnetic radiation to get to secret information regarding a cryptographic algorithm including the result C, such as a master key.
However, it is to be noted with respect to
As will be described with respect to the embodiment of
In the embodiment of
Depending on the randomly determined sequence, the means 24 drives the switching means 28 so that first the input operand and/or input operand set A and only then the input operand and/or input operand set B is forwarded to the intermediate result determination means 26, or vice versa. Effectively, the means 24 thus determines in a random way the sequence of the execution of the determination of the intermediate result obtained from A and the intermediate result obtained from B.
As explained with respect to the embodiment of
After the embodiments of
The substitution operation 918 of a DES algorithm includes eight independent S-box accesses to eight different S-boxes and/or look-up tables S1-S8. Input date to the substitution operation 918 constitutes the 48-bit data block encrypted with the round key and expanded from 32 to 48 bits, illustrated by way of example in
In order to implement the DES algorithm with regard to its substitution operation, the associated S-boxes and/or look-up tables may be arranged consecutively in a linear address space, as shown by way of example in
The access to one of the S-boxes S1-S8 to obtain the output value to the respective word WORD1-WORD8 therein may be performed, with a suitable arrangement of the base address 1 in the linear address space, by means of an address which, with respect to a smallest addressable unit of one half-byte, has the structure exemplarily shown in
According to an embodiment of the present invention, an algorithm code implementing the DES algorithm of
The pseudo code portion shown in
The function of the program code portion 34 is to determine first randomly by the determination of the random value j in step 36 with which S-box operation S1-S8 among the eight S-box operations S1-S8 the substitution operation is to be begun. After that, all eight S-box operations are performed in the loop 38, each loop 38 being passed through eight times. However, instead of using the loop counter value always beginning at the value 0 to determine the sequence in which the words WORD1-WORD8 are mapped to the corresponding 4-bit words, the value z is used. This means that what is laid down by the program loop 38 in the program code 34 is only a cycling through the S-box operations S1-S8, that, however, the S-box operation which the loop 38 is begun may be varied by setting the variable j prior to loop 38 which is done randomly. In other words, the program code 34 is split into two parts, i.e. a program code part 36 which lays down random information on a random sequence with respect to the execution of the S-box operations at a fixedly determined memory location, and a further program part which accesses this memory location to perform the S-box operations, i.e. accessing the address space, in a sequence indicated by the random information, depending on the random information. The second program part 38 and/or 38-46 accesses the input operands arranged at predetermined fixed positions and, in turn, writes what it reads at these positions in fixed associated memory positions. By lining up and representing the values out(0) . . . out(7) in a 4-bit representation, the array out(0) . . . out(7) forms the 32-bit data block which, in the DES algorithm, is then forwarded to the permutation means 920.
The embodiment of
In the embodiment of
Therefore, the present invention is even more effective when applied to an AES algorithm, in which a substitution operation of 16 independent byte substitutions is performed in the ten AES rounds using the same S-box and/or look-up table. The AES S-box is a mapping of an 8-bit input value to an 8-bit output value, and therefore has a size of 28×8 bits=28 bytes=256 bytes. In the AES algorithm, 16 8-bit words in a 128-bit data block are mapped independently of each other to 16 8-bit output words by the S-box within the substitution operation, the output words together again yielding a 128-bit output data block of the substitution operation.
The program code 34 of
With respect to the above description, the following is further to be noted. In the above embodiments, the intermediate results were always obtained based on different input operands A, B and/or WORD1-WORD8. Of course, it would also be possible to determine intermediate results in different sequences which themselves, in turn, are based on the same input operand(s), i.e. A=B and input 12 and input 14 in
The previous embodiments thus make use of the fact that block ciphers generally consist of several independent S-box accesses, whereby an effective reduction, which cannot be cancelled by external methods, of the averaged leakage information, which is needed for the DPA/DEMA, may be achieved in memory accesses. Thereby, this kind of attack is made significantly harder, if not prevented entirely. According to the embodiment of
The operation necessary for this consisted of loading “in(z)” the original date in(z), which was then used as offset to a base address “base address(z)” at 46 of the associated S-box to load the substitute “out(z)”. The sequence in which the S-boxes are processed was made random by choosing, for example in the AES algorithm, a random starting value between 0 through 15 and then loading the S-box in a loop which respectively increments modulo 16. Thus the averaged leakage information may be reduced to 1/16, with the noise remaining the same. This increases the number of necessary averagings by the factor 256 which may be decisive for success or failure of an attack. If some dummy accesses are added, in the AES algorithm for example further virtual S-box accesses 16-31, which are then addressed just as randomly by the pointer arithmetic as described above, the number of necessary averagings is again significantly increased, in the case of further 16 virtual S-box accesses by the factor 1,024.
It is further to be noted that also a complete permutation of the execution sequence could be achieved if, instead of the line 36, a program code portion would be provided in the code of
Further, the present invention is not limited to symmetrical block ciphers as used in the above embodiments, but may also be applied to asymmetrical algorithms.
As discussed above, the inventive scheme for result determination may also be implemented in software, depending on the circumstances. The implementation may be done on a digital storage medium, particularly a floppy disk or a CD with control signals that can be read out electronically, which may cooperate with a programmable computer system so that the corresponding method is performed. In general, the invention thus also consists in a computer program product with a program code stored on a machine-readable carrier for performing the inventive method, when the computer program product runs on a computer. In other words, the invention may thus be realized as a computer program with a program code for performing the method, when the computer program runs on a computer.
While this invention has been described in terms of several preferred embodiments, there are alterations, permutations, and equivalents which fall within the scope of this invention. It should also be noted that there are many alternative ways of implementing the methods and compositions of the present invention. It is therefore intended that the following appended claims be interpreted as including all such alterations, permutations, and equivalents as fall within the true spirit and scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
10 2004 018874.2 | Apr 2004 | DE | national |