Differential Cryptanalysis
Total Page:16
File Type:pdf, Size:1020Kb
Differential Cryptanalysis The first method which reduced the complexity of attacking DES below (half of) exhaustive search. Differential Cryptanalysis Note: In all the following discussion we ignore the existence of the initial and the final permutations, since they do not affect the analysis. Motivation: 1. All the operations except for the S boxes are linear. 2. Mixing the key in all the rounds prohibits the attacker from knowing which entries of the S boxes are actually used, and thus he cannot know their output. See: Biham and Shamir, Differential Cryptanalysis of the Data Encryption Standard, Springer Ver- lag, 1993. c Eli Biham - May 3, 2005 520 Differential Cryptanalysis (18) c Eli Biham - May 3, 2005 521 Differential Cryptanalysis (18) Differential Cryptanalysis (cont.) Differential Cryptanalysis (cont.) How can we inhibit the key from hiding the information? Advantages: It is easy to predict the output difference of linear operations The basic idea of differential cryptanalysis: Study the differences given the input difference: between two encryptions of two different plaintexts: P and P . ∗ Unary operations (E, P, IP): Notation: For any value X during the encryption of P , and the corresponding • ∗ 0 ∗ (P (X))0 = P (X) P (X∗) = P (X0) value X during encryption of P ∗, denote the difference by X = X ⊕ X . ⊕ Binary operations (XOR): • (X Y )0 = (X Y ) (X∗ Y ∗) = X0 Y 0 ⊕ ⊕ ⊕ ⊕ ⊕ Mixing the key: • (X K)0 = (X K) (X∗ K) = X0 ⊕ ⊕ ⊕ ⊕ We conclude that the differences are linear in linear operations, and in partic- ular, the result is key independent. c Eli Biham - May 3, 2005 522 Differential Cryptanalysis (18) c Eli Biham - May 3, 2005 523 Differential Cryptanalysis (18) Differences and the S Boxes The Difference Distribution Table of S1 Assume we have two inputs X and X for the same S box, and that we know ∗ Input Output XOR 0 only their difference X . XOR 0x 1x 2x 3x 4x 5x 6x 7x 8x 9x Ax Bx Cx Dx Ex Fx 0x 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1x 0 0 0 6 0 2 4 4 0 10 12 4 10 6 2 4 2x 0 0 0 8 0 4 4 4 0 6 8 6 12 6 4 2 Denote Y = S(X). 3x 14 4 2 2 10 6 4 2 6 4 4 0 2 2 2 0 4x 0 0 0 6 0 10 10 6 0 4 6 4 2 8 6 2 0 5x 4 8 6 2 2 4 4 2 0 4 4 0 12 2 4 6 What do we know about Y ? 6x 0 4 2 4 8 2 6 2 8 4 4 2 4 2 0 12 7x 2 4 10 4 0 4 8 4 2 4 8 2 2 2 4 4 8x 0 0 0 12 0 8 8 4 0 6 2 8 8 2 2 4 0 0 9x 10 2 4 0 2 4 6 0 2 2 8 0 10 0 2 12 The simple case: when X = 0: S(X) = S(X∗) for any X, and Y = 0. Ax 0 8 6 2 2 8 6 0 6 4 6 0 4 0 2 10 Bx 2 4 0 10 2 2 4 0 2 6 2 6 6 4 2 12 Cx 0 0 0 8 0 6 6 0 0 6 6 4 6 6 14 2 0 Dx 6 6 4 8 4 8 2 6 0 6 4 6 0 2 0 2 If X =6 0: we do not know the output difference. Ex 0 4 8 8 6 6 4 0 6 6 4 0 0 4 0 8 Fx 2 0 2 4 4 6 4 2 4 8 2 2 2 6 8 8 10x 0 0 0 0 0 0 2 14 0 6 6 12 4 6 8 6 . Definition: Lets look on the distribution of the pairs (X 0; Y 0) of all the pos- . 27x 10 4 2 0 2 4 2 0 4 8 0 4 8 8 4 4 28x 12 2 2 8 2 6 12 0 0 2 6 0 4 0 6 2 sible inputs X. We call the table containing this information difference dis- 29x 4 2 2 10 0 2 4 0 0 14 10 2 4 6 0 4 2Ax 4 2 4 6 0 2 8 2 2 14 2 6 2 6 2 2 tribution table of the S box. 2Bx 12 2 2 2 4 6 6 2 0 2 6 2 6 0 8 4 2Cx 4 2 2 4 0 2 10 4 2 2 4 8 8 4 2 6 2Dx 6 2 6 2 8 4 4 4 2 4 6 0 8 2 0 6 2Ex 6 6 2 2 0 2 4 6 4 0 6 2 12 2 6 4 2Fx 2 2 2 2 2 6 8 8 2 4 4 6 8 2 4 2 30x 0 4 6 0 12 6 2 2 8 2 4 4 6 2 2 4 31x 4 8 2 10 2 2 2 2 6 0 0 2 2 4 10 8 32x 4 2 6 4 4 2 2 4 6 6 4 8 2 2 8 0 33x 4 4 6 2 10 8 4 2 4 0 2 2 4 6 2 4 34x 0 8 16 6 2 0 0 12 6 0 0 0 0 8 0 6 35x 2 2 4 0 8 0 0 0 14 4 6 8 0 2 14 0 36x 2 6 2 2 8 0 2 2 4 2 6 8 6 4 10 0 37x 2 2 12 4 2 4 4 10 4 4 2 6 0 2 2 4 38x 0 6 2 2 2 0 2 2 4 6 4 4 4 6 10 10 39x 6 2 2 4 12 6 4 8 4 0 2 4 2 4 4 0 3Ax 6 4 6 4 6 8 0 6 2 2 6 2 2 6 4 0 3Bx 2 6 4 0 0 2 4 6 4 6 8 6 4 4 6 2 3Cx 0 10 4 0 12 0 4 2 6 0 4 12 4 4 2 0 3Dx 0 8 6 2 2 6 0 8 4 4 0 4 0 12 4 4 3Ex 4 8 2 2 2 4 4 14 4 2 0 2 0 8 4 4 3Fx 4 8 4 2 4 0 2 4 4 2 4 8 8 6 2 2 c Eli Biham - May 3, 2005 524 Differential Cryptanalysis (18) c Eli Biham - May 3, 2005 525 Differential Cryptanalysis (18) The Difference Distribution Table of S1 (cont.) Differences and the S Boxes (cont.) Observe that: Definition: If the entry of the input difference X 0 and the output difference 0 0 Y 0 is greater than zero, we say that X may cause Y by the S box, and 0 0 In the first line X0 = 0 and thus all the 64 pairs satisfy Y 0 = 0. Y 0 = 0 denote X ! Y . • 6 is impossible. Definition: The probability of X0 ! Y 0 is the probability that for a pair with the input difference X , the output difference is Y , among all In the rest of the lines: The average value is 4, the sum in each line is 64. 0 0 the possible pairs. In DES, the probability is the corresponding value in the • The values are all even in the range 0{16. difference distribution table divided by 64. The entries with value 16 mean that for a quarter of the pairs with this Similarly we define X0 ! Y 0 by the F -function, and define the probability input difference X , the output difference is the particular Y . 0 0 as the product of the probabilities by the eight S boxes. The entries with value 0 mean that there are no pairs with the corre- sponding input difference X0 and the corresponding output difference Y 0. c Eli Biham - May 3, 2005 526 Differential Cryptanalysis (18) c Eli Biham - May 3, 2005 527 Differential Cryptanalysis (18) Differences and the S Boxes (cont.) Observation Differential cryptanalysis uses the entries with large values, and in particular Given an input and output differences of an S box, it is possible to list all the the 0 0 entry and the entries with value 16, and other large values. pairs with these differences. ! Example: For the entry 09 1 the 2 pairs are: x ! x 1. 33x, 3Ax 2. 3Ax, 33x For the entry 01 F the 4 pairs are: x ! x 1. 1Ex, 1Fx 2. 1Fx, 1Ex 3. 2Ax, 2Bx 4. 2Bx, 2Ax The lists of pairs of all the differences can easily be computed in advance. c Eli Biham - May 3, 2005 528 Differential Cryptanalysis (18) y c Eli Biham - May 3, 2005 529 Differential Cryptanalysis (18) Example of a Simple Attack Example of a Simple Attack (cont.) Assume a 3-round DES, in which for some pair of plaintexts Then, the differences in the various rounds are P 0 = 01 96 00 18 00 00 00 00x, and T 0 = 41 96 40 1A 48 00 00 00x. 0 We also assume that T = 00 00 00 00 08 00 00 00x and P = 01 96 00 18 00 00 00 00x T ∗ = 41 96 40 1A 40 00 00 00x. 0 0 (We use the notation T for the ciphertexts, as we use C for the third round A = 00 00 00 00x F a = 00 00 00 00x intermediate values.) 0 0 B = 48 00 00 00x F b = 01 96 00 18x = P (02 00 00 08x) 0 0 C = 40 00 40 02x F c = 48 00 00 00x = P (13 00 00 00x) T 0 = 41 96 40 1A 48 00 00 00x c Eli Biham - May 3, 2005 530 Differential Cryptanalysis (18) c Eli Biham - May 3, 2005 531 Differential Cryptanalysis (18) Example of a Simple Attack (cont.) Characteristics ( ¢¡¤£¥¡§¦¨ ) We identify that S1 in the third round accepts difference 09x in the input and In differential cryptanalysis we wish to know some statistical information on the outputs difference 1x in the output.