The present invention relates generally to cryptography, and more particularly to an algorithm for encryption and/or decryption of data.
This section is intended to introduce the reader to various aspects of art, which may be related to various aspects of the present invention that are described and/or claimed below. This discussion is believed to be helpful in providing the reader with background information to facilitate a better understanding of the various aspects of the present invention. Accordingly, it should be understood that these statements are to be read in this light, and not as admissions of prior art.
A copy protection system intended to run on a malicious host is, by definition, prone to reverse engineering attacks because the adversary is able to view the programs execution and intermediate results generated during computation. The so-called white-box attack context was introduced as a setting where the adversary is allowed to make observations about the software and to examine or alter the software intermediate results; see S. Chow, P. Eisen, H. Johnson, P. C. van Oorschot, “A White-Box DES Implementation for DRM Application”, Digital Rights Managerment WorkShop-DRM 2002, Lecture Notes in Computer Science, vol. 2696, 2003, pp. 1-15.
In order to protect the Advanced Encryption Standard (AES) in such a context, Chow et al. implemented a white-box AES encryption algorithm; see S. Chow, P. Eisen, H. Johnson, P. C. van Oorschot, “White-Box Cryptography and an AES Implementation”, Selected Areas in Cryptography-SAC 2002, Lecture Notes in Computer Science, vol. 2595, 2003, pp. 250-270. However, Billet et al. showed that the secret key can be extracted from Chow's implementation with time complexity of 230; see O. Billet, H. Gilbert, C. Ech-Chatbi, “Cryptanalysis of a White Box AES Implementation”, Selected Areas in Cryptography-SAC 2004, Lecture Notes in Computer Science, vol. 3357, In H. Handschuh, A. Hasan (eds.), 2005, pp. 227-240.
It can therefore be appreciated that there is a need for a solution that provides a white-box version of AES that is less vulnerable to Billet's attack. The present invention provides such a solution. The skilled person will appreciate that while the invention was made for AES, it may also be used in other iterative block cipher encryption algorithms.
In order to facilitate understanding of the present invention, AES, its white-box implementation and Billet's attack will now be described.
AES is a standard for data encryption, at present with three versions, depending on the key length: 128 bits, 192 bits or 256 bits. The block length, i.e. the length of a basic unit of cleartext and later ciphertext, is 128 bits, and a block is represented as a (4×4) matrix of bytes, called a state. AES operates over the algebraic Galois field GF(28). The reason is computational efficiency, as GF(28) elements can be represented by bytes, which can be easily processed by computers. Without loss of generality, the description hereinafter will focus on the 128-bit version of AES, i.e. AES-128.
The AES-128 algorithm comprises 10 iterations, called rounds, that each performs four transformations:
SubBytes: This transformation takes the multiplicative inverse of the input in GF(28) modulo the irreducible polynomial of AES x8+x4+x3+x+1, the output of which is transformed by the affine transformation:
ShiftRows: This transformation is a byte transposition that cyclically shifts each row of the state by respectively 0, 1, 2 and 3 positions to the left.
MixColumns: This transformation operates on the columns of the state. It is a multiplication of the column by the polynomial mc(x)=03.x3+01.x2+01.x+02 in GF(28)4 modulo the polynomial x4+1. This can be described by a matrix multiplication (the matrix being denoted MC):
AddRoundKey: This transformation is an XOR operation with the round key, i.e. the key used for the particular round.
Put another way, if Xis the state, each round consists of:
The AES−1 algorithm, i.e. the corresponding decryption algorithm, works in the reverse direction by using the inverses of the steps: InvSubBytes, InvShiftRows, InvMixColumns and AddRoundKey. A complete description (including test vectors) can be found in National Institute of Standards and Technology (NIST): Advanced Encryption standard (AES), FIPS Publication 197, 2001. Available at URL http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf.
The strategy of the white-box implementation of AES, WB-AES, is to convert AES into a series of look-ups in key-dependent look-up tables and to hide the secret keys in these tables. Each table is composed of several steps of the AES and encoded with random bijections.
r
T
i,j(x)=S(x⊕rKi,j) r≦1, . . . ,9 i,j=0, . . . ,3
10
T
i,j(x)=S(x⊕9Ki,j)⊕10Ki,j i,j=0, . . . ,3 (13
where S is the AES S-box and K is the AES subkey.
MixColumns operates on the AES state one column at a time. This can be implemented by multiplying a 32×32 matrix MC (thereafter MixColumns matrix) and a 32×1 vector. Multiplication of a 32-bits vector by MC is done by four separate multiplications and three 32-bits XORs. ShiftRows is implemented by providing shifted input data to the generated tables.
WB-AES generally uses external and internal encodings. External encoding permits the shielding of the implementation:
G∘E
K
∘F
−1
F∘E
K
−1
∘G
−1
If external encoding is applied to the encryption operation, inverse encoding should be applied to the decryption operation and vice-versa. Otherwise, decryption cannot be possible.
Internal encoding randomizes the data flow between consecutive look-up tables. For the sake of clarity, the description only considers internal encodings to give the general idea and to provide information necessary for the understanding of Billet's attack.
Let us consider AES as a composition of 10 functions as follows:
E=R
1
∘R
2
∘ . . . ∘R
9
∘R
10
where Ri represents the operations of an entire AES round coded as a look-up table. A table is delinearized using random permutations Pi. The idea is to compose a round of AES operations by inserting a Pi that is annihilated in the next round:
AES then becomes a composition of 10 obfuscated tables OTi.
This delinearization step prevents an adversary from viewing the contents of each table. It is then more difficult to extract the keys by inspecting the obfuscated tables OT.
In detail, the obfuscation, illustrated in
r
Q
i,j
=inv(r+1Pi,j) i,j=0, . . . 3
A full description of the attack is found in the paper mentioned hereinbefore. What follows is a simplified description that allows an understanding of the present invention.
Since it is difficult to extract the keys by local inspections of the obfuscated tables, it is more convenient to look at the input and the output of the composition of tables for a round. The attack comprises 5 steps:
To recover the affine mappings rQi,j, it is first necessary to retrieve the affine mappings rQi,0=Ai⊕qi, where Ai is linear and qi is a constant. The mappings rQi,0 for a vector (x,0,0,0) can be written as:
r
Q
i,0(x,0,0,0)=yi(x,0,0,0)=Ai(αi,0rTi,0(rPi,0(x))⊕rKi,0)⊕qi i=0, . . . ,3
where αi,0, with i=0, . . . , 3 are MixColumns coefficients.
This can be rewritten as an x function, and for i=0 this gives:
x
(
S
−1∘Λδ
where S is the AES S-Box. Λδ is the matrix over GF(28) of multiplication by δ. (δj, cj) are unknown constants. The value of δj−1 depends on MixColumns coefficients.
The unique pair (δj, cj) in these mappings can be computed with a time complexity of 224, provided that the inverse AES S-box and MixColumns coefficients are known. Indeed, given that two of αj,0 are 01, the other one is 02 and the last is 03, exactly two of δj−1 are equal. It is thus possible to get Λδj and then A0. The constant qi of the affine mapping rQi,0 can be recovered at the same time.
All rQi,j can be recovered thanks to the mappings described above. As rQi,j=inv(r+1Pi,j), r+1Pi,j is recovered at the same time. The subkey embedded in the T-box can then be extracted.
In a first aspect, the invention is directed to a method for encrypting digital data using an iterative block cipher algorithm that is based on a Feistel network or on a substitution-permutation network. A device receives the digital data and performs a plurality of rounds of alterations on input data, wherein the plurality of rounds comprise a first round and a final round. Each round produces output data, and the input data for the first round is the digital data and the input data for any subsequent round is the output data of the round that precedes the subsequent round. Each round comprises: applying a first transformation function to the round input, wherein the first transformation function is a function that transforms at least one byte state of the round from a first representation to an equivalent cipher representation;
encrypting the round input using the equivalent cipher representation and a key to obtain an encrypted value; and applying a second transformation function to the encrypted value to obtain the output data of the round, the second transformation function being the inverse of the first transformation function. Finally, the round output of the final round is
output.
It will be appreciated that in a symmetrical encryption algorithm, encryption is the same as decryption.
In a first preferred embodiment, the iterative block cipher algorithm is implemented in the device as a white-box implementation.
In a second preferred embodiment, the dual cipher has been randomly chosen from a predefined set of dual ciphers. It is advantageous that the iterative block cipher algorithm is AES and wherein, for at least one round, an S-box non-linear operation has been transformed using the first transformation function. Preferably, for at least one round, at least one of the linear or permutation operation has been transformed using the first transformation function. For at least one round, at least one round: sub-key may have been transformed using the first transformation function; at least one round sub-key may have been obtained from a main key represented in the dual cipher representation; and at least one round sub-key may have been obtained from a main key represented in the dual cipher representation.
In a second aspect, the invention is directed to a device for performing a cryptographic computation on digital data, the cryptographic computation being encryption or decryption performed using an iterative block cipher algorithm based on a Feistel network or on a substitution-permutation network. The device comprises a processor adapted to: receive the digital data and perform a plurality of rounds of alterations on input data, wherein the plurality of rounds comprise a first round and a final round, wherein each round produces output data, and wherein the input data for the first round is the digital data and the input data for any subsequent round is the output data of the round that precedes the subsequent round. Each round comprises: applying a first transformation function to the round input, wherein the first transformation function is a function that transforms at least one byte state of the round from a first representation to an equivalent cipher representation; encrypting the round input using the equivalent cipher representation and a key to obtain an encrypted value; and applying a second transformation function to the encrypted value to obtain the output data of the round, wherein the second transformation function is the inverse of the first transformation function. The round output of the final round is then output.
In a third aspect, the invention is directed to a computer program product storing thereon instructions that, when executed by a processor, performs the method the first aspect.
Preferred features of the present invention will now be described, by way of non-limiting example, with reference to the accompanying drawings, in which
Billet's attack supposes that classical AES constants such as S-box values or MixColumns coefficients are known. In for example the MixColumns matrix, each column consists of the four numbers 01, 01, 02, 03, which is helpful in removing the obfuscations. A main inventive idea of the present invention is thus to make the S-box values and the MixColumns coefficients unknown to the attacker. The present invention can then thwart Billet's attack.
AES is a block cipher system based on simple algebraic operations over the algebraic finite field GF(28). If we replace all the constants in Rijndael—of which AES is a subgroup—including replacement of the irreducible polynomial, coefficients of the MixColumns matrix, and affine transformation in the SubBytes, it is possible to create new dual ciphers of AES. It is mentioned by E. Barkan and E. Biham in “In How Many Ways Can You Write Rijndael?” Asiacrypt 2002, pp. 160-175, 2002, that 240 new dual ciphers of AES can be created. Although the intermediate values of a dual cipher during encryption or decryption are different from those of AES, a dual cipher has a security equivalent to that of AES. While these dual ciphers have been known for quite some time, they have, until now, been regarded as a kind of scientific curiosity without any real practical use.
The outputs of AES and dual AES are also different but correlated, as shown in
A dual cipher for AES can be created either by modifying original AES constants or by changing the irreducible polynomial. An example of modification of constants is to raise the constants to their second power: affine transformation A.x+b of SubBytes operation is replaced by A2.x+b2. The polynomial mc(x)=03.x3+01.x2+01.x+02 of MixColumns can be replaced by mc(x)=05.x3+01.x2+01.x+04. There are eight possible modifications for a given irreducible polynomial, they raise constants to power 2, 4, 6, 16, 32, and 64.
The irreducible polynomial in AES is used for the inverse computation in the S-box and also in the multiplication in MixColumns. There are 30 irreducible polynomials in GF(28). Due to the isomorphism of all fields of GF(28), AES can use any of the 30 irreducible polynomials. There are therefore 30*8=240 AES dual ciphers. To be compatible with original AES, the cleartext, the ciphertext and key must be modified trough a linear transformation f. This transforms an AES under an irreducible polynomial to another AES with another polynomial. The transformation is generally represented by a matrix R (f(x)=R.x where x is a vector representation under original AES polynomial). For example, if AES polynomial x8+x4+x3+x+1 is replaced by x8+x4+x3+x2+1 the invertible matrix R is:
The inverse transformation is defined by f1(y)=R−1.y
The choice of irreducible polynomial in AES is arbitrary and from security perspective there is no advantage of using the original polynomial rather than any other existing polynomial.
To counter Billet's attack, the idea is to choose randomly one of the 240 cipher dual AES to implement instead of the classical AES. This means that the values of the S-box and MixColumns coefficients are not fixed but vary depending on which dual cipher is used.
In a first preferred embodiment, this is implemented by including f in the construction of the T-boxes. Random bijections are next added on top of the newly created T-boxes called fTi,j. As the function ƒ operates on bytes, this gives the following relations:
x←f(x)
f
r
T
i,j(x)=Sf(x⊕frKi,j) r=1, . . . ,9 i,j=0, . . . ,3
f
10
T
i,j(x)=Sf(x⊕f9Ki,j)⊕f10Ki,j i,j=0, . . . ,3
In the prior art white-box implementation, i.e. the one provided by Chow et al., the unique pair (δj, cj) can be computed with time complexity of 224. When a random dual cipher is used, to compute (βj, cj), all 240 possible values of S-box and MixColumns coefficients have to be tested. This raises the complexity to 232.
While the solution of the first preferred embodiment increases the complexity of the attack, it does not prevent recovery of the AES master key, as the operation in step 5 of the attack still is possible. The second preferred embodiment described hereinafter provides a better countermeasure.
To be more resistant to Billet's attack, it is possible to use a plurality of dual AES and integrate their parameters into the same white-box AES implementation. This may be done using a different dual AES for each round of the encryption process. In the following, a round of a dual AES is called a “dual round”.
As in the first preferred embodiment, a main idea is to choose randomly 10 dual ciphers amongst the 240 available. Let (f1, f2, . . . , f10) be the linear transformations associated with the chosen dual AES.
Also, consider AES as a composition of 10 rounds as follows:
E=R
1
∘R
2
∘ . . . ∘R
9
∘R
10
The idea is thus to compose 10 dual rounds in the same AES implementation wherein the rounds preferably are different. This may be done by first taking a round operations Ri in each dual cipher E(k). Let kRi be round i of dual cipher E(k). The idea is to apply a state transformation for a round in the previous round. The mechanism is based on an input-decoding-output-encoding paradigm, performed by applying the inverse transformation of a round output followed by the linear transformation for the input of next dual round. Therefore, both the inverse transformation fk−1 and the transformation fk+1 are applied in round kRi:
AES then becomes a composition of 10 dual look-up tables DTi.
The implementation of the white-box is preferably performed by including fk in the construction of the T-boxes.
x←f
1(x)
k
r
T
i,j(x)=fk+1(fk−1(Sk(x⊕krKi,j))) r=1, . . . ,9 i,j=0, . . . ,3, k=1
10
10
T
i,j(x)=f10(f9−1(S9(x⊕99Ki,j)⊕1010Ki,j i,j=0, . . . ,3
Random bijections are then added on top of the newly created Ti,j boxes.
One of the advantages of this solution is that the keys of two consecutive rounds are not correlated. The AES key schedule is based on the S-box value and other constants, and each dual cipher has its own different constants. From the same master key, different subkeys are thus derived for the different dual AES.
Supposing that an attacker manages to guess one dual round, i.e. he knows the S-box and MixColumns coefficients. Then he is able to perform step 1 to step 4 of the attack (with time complexity of at least 224) and get a shuffled subkey. However, the bytes of a subkey round cannot be reconstructed correctly as the attacker has no way of testing it (since the subkeys of two consecutive rounds are not correlated). To obtain the correct subkey, the attacker has to repeat the attack of Billet twice for all possible combinations of dual ciphers. Billet's attack would hence require at least 216 more computation steps and thus the complexity of the entire attack becomes 246.
It has thus been shown how to implement 10 different dual rounds in the same white-box AES. The skilled person will appreciate that it is possible to use even more dual ciphers.
In the following is provided a generalization of the construction that provides a better resistance against the attacks. It has been shown hereinbefore how to implement 10 different dual ciphers in the same white-box implementation. Indeed, the dual cipher was changed at the round level (to ease the description). It is however possible to use even more dual ciphers. Since each 4 byte round output depends only on the 4 byte round input, a different dual AES cipher may be used for each of the four mappings in a round, which means that up to 4*10=40 different dual ciphers can be used in a given white-box AES implementation. If yi is the i-th output byte of round r, then:
y
0
,y
4
,y
8
,y
12, depend on x0,x1,x2,x3
y
1
,y
5
,y
9
,y
13, depend on x4,x5,x6,x7
y
2
,y
6
,y
10
,y
14, depend on x8,x9,x10,x11
y
3
,y
7
,y
11
,y
15, depend on x12,x13,x14,x15
Without loss of generality, fσ
r
T
i,j(x4i+j)=fσ
10
T
i,j(x4i+j)=fσ
where rKi,j=fσ
In the case of Billet et al. attack, an attacker would need to put each 4 bytes output in the standard AES state. To do so, he has to check 2404 combinations. The complexity for recovering mixing bijections for a round would then be 4*4*225*231=260. For two rounds, the complexity is bounded by 261 computation steps.
It will thus be appreciated that the present invention can offer a white-box AES implementation that is more secure than the prior art solutions. It will also be appreciated that the present invention is limited to neither white-box implementations nor AES, but that other implementations and encryption algorithms may also be used.
While the invention has been described for AES as a non-limitative, preferred example, the skilled person will appreciate that while the invention may also be used in other iterative block cipher encryption algorithms, such as those based on a Feistel network (e.g. DES, IDES, RC5 and IDEA) or, like AES, on a substitution permutation network (e.g. Serpent).
Each feature disclosed in the description and (where appropriate) the claims and drawings may be provided independently or in any appropriate combination. Reference numerals appearing in the claims are by way of illustration only and shall have no limiting effect on the scope of the claims.
Number | Date | Country | Kind |
---|---|---|---|
09305823.8 | Sep 2009 | EP | regional |
10305196.7 | Feb 2010 | EP | regional |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/EP2010/062771 | 8/31/2010 | WO | 00 | 2/24/2012 |