Differential Cryptanalysis Outline Differential cryptanalysis

advertisement
Outline
Differential Cryptanalysis
ƒ Basic
ƒ Differential Cryptanalysis of 3 rounds of DES
ƒ Differential Cryptanalysis of 6 rounds of DES
ƒ Advanced
Vincent Rijmen
ƒ Probabilityy
ƒ Differentials and characteristics
ƒ Markov ciphers
ƒ Decorrelation theory
ƒ Key-alternating ciphers
ƒ AES (Wide trail design strategy)
Thanks to Stefan Mangard, Joan Daemen
.
Block ciphers and cryptographic hash functions
Differential cryptanalysis
2
Difference propagation
ƒ Notation:
ƒ Pair of values X, X*
ƒ Difference X’ = X* - X = X* + X
ƒ Biham and Shamir, 1991
ƒ Chosen plaintext attack
ƒ Linear map
p L,, by
y definition:
L(X*) + L(X) = L(X* + X) = L(X’)
ƒ Addition with constant (key)
(X* + K) + (X + K) = X* + X = X’
ƒ Nonlinear map S
ƒ Goal: Determine the secret key
ƒ Exploits mapping properties of differences within DES
ƒ If X* == X then S(X*) - S(X) = 0
ƒ Else S(X*) - S(X) = ?
3
Block ciphers and cryptographic hash functions
The DES “F” function: notation
C
Block ciphers and cryptographic hash functions
4
The set of possible inputs to an Sbox
B E
ƒ The set of possible inputs for given input- and output
differences for Sbox j:
IN(Bj’,Cj’) = { Bj : Sj(Bj) + Sj(Bj + Bj’) = Cj’}
ƒ Important observation: Not every input difference can
produce every output difference
Block ciphers and cryptographic hash functions
5
Block ciphers and cryptographic hash functions
6
1
The set of possible inputs to an Sbox
The key XOR
B’ = B + B* = (E + K) + (E* + K) = E + E* = E’
ƒ The input difference of the Sboxes of a round does not
p
on the round key
y
depend
Example:
IN(110100,0100) = {010011,100111}
ƒ Important observation: Ej + Kj ∈ IN(Ej’, Cj’)
IN(Bj’,Cj’) = { Bj : Sj(Bj) + Sj(Bj + Bj’) = Cj’}
7
Block ciphers and cryptographic hash functions
The set of all keys that are possible
Attack on 3 rounds of DES
ƒ The set of possible input values
L0
IN(Bj’,Cj’) = { Bj : Sj(Bj) + Sj(Bj + Bj’) = Cj’}
R0
E and E* of the last round are known!
L1
ƒ The set of possible keys:
Testj(Ej, Ej*,
8
Block ciphers and cryptographic hash functions
Cj’) = { Ej + Bj : Bj ∈ IN(Ej’, Cj’)}
The important question is: What is C´?
L2
L3
9
Block ciphers and cryptographic hash functions
Attack on 3 rounds of DES
L0
R3 = L0 + f(R0,K1) + f(R2,K3)
The differences can be expressed
as follows, if R’0= 0:
R3’ = L0‘ + f(R2,K3) +
L1
K2
f
K3
R2
R3
Block ciphers and cryptographic hash functions
10
R0
f
K1
f
K2
R1
ƒ Last round key can be determined by using several pairs of
plaintexts with R’0 =0:
ƒ Keyy is in intersection of the sets of possible
p
values
ƒ Then we know 48 bits of the 56-bit key
C’
’
L2
R2
f
The set of possible values for K3
can be determined:
Block ciphers and cryptographic hash functions
f
Attack on 3 rounds of DES
f(R2*,K3)
testj (Ej, Ej*, Cj’)
K1
R1
Kj = Bj + Ej
ƒ Given E, E* and C’, we can narrow down the key space
f
L3
K3
ƒ Remaining 8 key bits: try out all possibilities
R3
11
Block ciphers and cryptographic hash functions
12
2
Attack on 6 rounds of DES
L0
ƒ C’ cannot be calculated as easily
as before
ƒ Hence, a probabilistic approach is
pursued
Attack on 6 rounds of DES
R0
K1
L1
R1
L2
R2
L3
R3
L4
R4
L5
R5
L6
R6
f
ƒ Definition of a characteristic:
K2
K4
K5
What is C´?
13
Block ciphers and cryptographic hash functions
L’0 = anything
L’1 = 00000000
R’0 = 00000000
R’1 = L’0
p1 = 1
p1 = 0.25
p2 = 1
p3 = 0.25
L4
R4
L5
R5
L6
R6
K5
K6
14
L0
R0
L1
R1
L2
R2
L3
R3
L4
R4
L5
R5
L6
R6
K1
K2
K5
K6
15
Attack on 6 rounds of DES
= 04000000
= 00000000
= 04000000
= 40080000
R3
K4
Block ciphers and cryptographic hash functions
= 40080000
= 04000000
= 00000000
= 04000000
L3
K3
ƒ Standard description of the differential attack assumes:
different plaintexts, same key
ƒ Most theory assumes: different key
ƒ Implicit ergodicity assumption
R’0
R’1
R’2
R’3
R2
K4
ƒ 1-round characteristic:
ƒ Experiment: encrypt 1 pair of plaintexts under 1 key
ƒ Repeating: different plaintexts and/or different key
L’0
L’1
L’2
L’3
L2
K1
Attack on 6 rounds of DES
ƒ Frequentist definition: probability denotes the relative
frequency of occurrence of a certain outcome of an
experiment, when repeating the experiment.
ƒ 3-round characteristic:
R1
Block ciphers and cryptographic hash functions
Probability in differential cryptanalysis
L0
L1
K3
ƒ pi is the probability that L’i-1, R’i-1 is
mapped to L’i, R’i
K6
R0
K2
L’0, R’0
L’1, R’1, p1
L’2, R’2, p2
…
L’n, R’n, pn
K3
L0
16
Block ciphers and cryptographic hash functions
Attack on 6 rounds of DES
R0
K1
L1
R1
L2
R2
L3
R3
L4
R4
L5
R5
L6
R6
With probability 1/16:
L’3 = 04000000
R’3 = 40080000
K2
In that case:
Input and Output difference
for S3,S5,S6,S7 and S8 = 0
K3
K4
L0
R0
L1
R1
L2
R2
L‘3
R‘3
L4
R4
L5
R5
L6
R6
K1
K2
K3
K4
K5
K5
K6
Block ciphers and cryptographic hash functions
K6
17
Block ciphers and cryptographic hash functions
18
3
Attack on 6 rounds of DES
Wrong pairs
L0
R0
L1
R1
L2
R2
We can compute C’ for the 5 S-boxes
L‘3
where R3’ = 0
R‘3
L4
R44
R‘
L55
L‘
R5
L6
R6
ƒ 15 out of 16 times, the pair doesn’t follow the characteristic
ƒ 10 out of these 15 times we get at least one empty testi
ƒ We can filter this pair
ƒ 5/15 of the wrong pairs can’t be filtered ⇒ random key
gg
= noise
suggestions
K1
R6’ = C’ + L5’
R6’ = C’ + L3’ + f(K4,R3) + F(K4, R3*)
The keys J3,J5,J6,J7 and J8 can be
determined!
K2
K3
ƒ Keys in test set are suggested keys
ƒ After some time the right key should be among the most
suggested values
K4
K5
K6
Block ciphers and cryptographic hash functions
19
Signal-to-noise ratio
20
Block ciphers and cryptographic hash functions
Summary of the attack
ƒ Let α = average number of keys in test set
ƒ β = fraction of unfiltered wrong pairs
ƒ 2k = number of keys
S/N = p/(αβ / 2k) = 2k p/(αβ)
ƒ We need at least 2/p pairs to discover the right key
ƒ Make k as large as possible (memory constraints)
L0
R0
ƒ It is necessary to determine the
output differences of the
Sboxes in the last round
L1
R1
L2
R2
ƒ A “good” characteristic needs to
be found in order to get there
L3
R3
L4
R4
L5
R5
L6
R6
K1
K2
K3
K4
K5
K6
Block ciphers and cryptographic hash functions
21
Security against differential attacks
ƒ
ƒ
22
Computing bounds for DES
Make prediction of differences difficult
Ensure that there are no high-probability characteristics
ƒ
ƒ
ƒ
Block ciphers and cryptographic hash functions
ƒ Done by determining the best characteristics
ƒ A* algorithm: branch and prune, depth-first
ƒ Determine iteratively the best characteristic over 1, 2, 3, …
rounds
Compute bounds for existing ciphers
Design ciphers with low bounds on the probability
g ciphers
p
with easily
y computable
p
bounds
Design
ƒ Prune: if cost of current path over t rounds + cost of best
path over (R-t)-rounds ≥ cost of currently best path over R
rounds, then abandon the current path
Block ciphers and cryptographic hash functions
23
Block ciphers and cryptographic hash functions
24
4
A* algorithm
1st round
2nd round
Results for DES
ƒ The best characteristics
over 8 rounds or more, are
iterative characteristics
ƒ Two values for A possible
ƒ With 3 active S-boxes
Rth round
A
00000000
f
00000000 A
ƒ Probability = 1/234 for
every two rounds
f
A
Block ciphers and cryptographic hash functions
25
00000000
26
Block ciphers and cryptographic hash functions
Differential strengthening of DES
Technical problems
ƒ The S-box design criteria (+ expansion) ensure that
iterative characteristics have at least 3 active S-boxes
ƒ Any re-ordering of the S-boxes would increase the
probability of the best characteristic
Computing the probability
1. Characteristics and differentials
2. Independence of rounds
ƒ DES designers knew about differential cryptanalysis
ƒ On the other hand, it is possible to find S-boxes that
behave better in this respect
Block ciphers and cryptographic hash functions
27
Predicting a difference
28
Block ciphers and cryptographic hash functions
Characteristics and differentials
A’
A’
Pr(A’ → D’) =
P1 = Pr(A’ → B’)
B’
B’
P2 = Pr(B’ → C’)
+ Pr(A’ → B1’ → C1’ → D’)
+…
C’
C’
P3 = Pr(C’ → D’)
D’
D’
= ΣB’ΣC’ Pr(A’ → B’ → C’ → D’)
(A’,D’): differential
(A’,B’,C’,D’): characteristic (trail, path)
Pr(A’ → D’) = p1p2p3 ???
Block ciphers and cryptographic hash functions
Pr(A’ → B’ → C’ → D’)
29
Block ciphers and cryptographic hash functions
30
5
Computing Pr(A’ → B’ → C’ → D’)
Characteristic and differential probabilities
ƒ Pr(A’,D’) ≥ Pr(A’,B’,C’,D’)
ƒ Pr(A’ → B’) × Pr(B’ → C’) × Pr(C’ → D’) ??
ƒ Computing Pr(A’,D’) is more difficult than computing
Pr(A’,B’,C’,D’)
ƒ Actually:
Pr(A’ → B
Pr(A
B’)) × Pr(B
Pr(B’ → C
C’ | A
A’)) × Pr(C
Pr(C’ → D
D’ | A
A’, B
B’))
ƒ In a ‘weak’ cipher, usually one characteristic dominates the
probability: Pr(A’,D’) ≈ Pr(A’,B’,C’,D’)
ƒ Theory of Markov ciphers [Lai,Massey,Murphy]
ƒ In many ‘strong’ ciphers: open problem
Block ciphers and cryptographic hash functions
31
Markov cipher
Hypothesis of stochastic equivalence
ƒ EDP ≈ E[Pr(A’→B’→C’→D’)]
ƒ Definition: cipher such that over one round:
Pr(A’ → B’) = Pr(A’ → B’ | X)
ƒ With X: input value
ƒ Given 1 pair with input difference A’, the probability that it has
differences B’, C’, and D’
ƒ Obviously, Pr here is computed over different keys
ƒ Related quantity: DP[k]
ƒ Given q pairs with input difference A’, the fraction that will
have differences, B’, C’, D’
ƒ Probability computed with fixed key
ƒ Definition of EDP:
EDP(A’→B’→C’→D’) = Pr(A’→B’) × Pr(B’→C’) × Pr(C’→D’)
ƒ Fundamental Theorem: EDP(A’→B’→C’→D’) equals
‘probability’ if all rounds use independent keys.
Block ciphers and cryptographic hash functions
32
Block ciphers and cryptographic hash functions
ƒ Hypothesis [Lai,Massey,Murphy]:
For almost all keys k:
DP[k](A’→B’→C’→D’) ≈ EDP(A’→B’→C’→D’)
33
Problems with the hypothesis of S.E.
Block ciphers and cryptographic hash functions
34
34
Hypothesis of S.E. can’t hold
1. Computing EDP of a differential remains a problem
ƒ DP[k](A’→B’→C’→D’) is always a multiple of (No. of pairs)-1
2. The hypothesis doesn’t hold
ƒ Example: DES:
y of the best characteristic: 2 rounds EDP = 1/234
ƒ Probability
ƒ For 13 rounds (used in attack), EDP = 2-47
ƒ EDP can become much smaller:
(N off pairs)
(No.
i )-11 × (No.
(N off kkeys))-11
ƒ For modern ciphers, EDP < (No. of pairs)-1
ƒ 2 rounds DP[k] = 1/146 or 1/585
ƒ For 13 rounds, this gives 2-43 ≤ DP[k] ≤ 2-55
ƒ Impact on DP[k] ???
ƒ Nevertheless, we continue with EDP
Block ciphers and cryptographic hash functions
35
Block ciphers and cryptographic hash functions
36
6
Provable security (Knudsen/Nyberg)
Decorrelation theory (Vaudenay)
ƒ Developed for Feistel ciphers
ƒ Prove upper bounds on the EDP of a differential through
the cipher
Theorem:
If for 2 rounds EDP(A’,D’)
( , )≤p
Then for 4 or more rounds EDP(A’,D’) ≤ 2p2
ƒ Borrows techniques from universal hash function design
ƒ Example: F(X,K) = K1× X + K2
ƒ F(X, K) + F(X
F(X+A’,K)
A ,K) = (K1× X + K2) + (K1× (X
(X+A’)
A ) + K2)
= A’ × K1
ƒ DP[k](A’ → B’) = 1 if B’ = A’ × K1
= 0 otherwise
ƒ EDP(A’ → B’) = (No. of keys)-1
ƒ Extension: ≤ p2 if f-function is bijective
ƒ Examples: Misty, KASUMI
ƒ Very good bound on EDP
ƒ Problem: doesn’t improve after 4 rounds
37
Block ciphers and cryptographic hash functions
Attack
38
Block ciphers and cryptographic hash functions
Wide trail design strategy
ƒ Example: F(X,K) = K1× X + K2
ƒ Consider X, X+A’, X+B’, X+A’+B’
F(X, K) + F(X+A’, K) + F(X+B’, K) + F(X+A’+B’,K) =
A’ × K1 + A’ × K1 = 0
ƒ Compute bounds for 1 S-box:
d = maxA’ ≠ 0, B’ Pr(A’ → B’)
ƒ Characteristic with EDP 1!
ƒ Compute bound on number of active S-boxes
z = minimum number of active S-boxes
ƒ Demonstrates problem of this notion of provable security
ƒ Together: EDP ≤ dz
ƒ Bound valid for characteristics, not differentials
39
Block ciphers and cryptographic hash functions
Iterative cipher
40
Block ciphers and cryptographic hash functions
Single-Round Optimization
A’
S
round
S
S
S
S
Key Schedule
Mixing transformation
round
S
S
S
S
S
round
Mixing transformation
S
S
S
S
S
S
S
EDP(A’,B’)
B’
Relevant:
ƒ Number of active components in A
ƒ Worst-case difference propagation probability in S-box
Provides a bound of 1 active S-box per round
¾ Small d ⇒ Low bound requires large S-boxes
...
..
round
Block ciphers and cryptographic hash functions
S
41
Block ciphers and cryptographic hash functions
42
7
Two-Round Optimization
Designing the Mixing Transformation
A’
S
S
S
S
S
S
S
S
S
S
S
S
S
X
Mixing transformation
Mixing transformation
B’
S
S
S
S
S
Y
ƒB ≤ number
b off components
t off X plus
l 1
Mi i ttransformation
Mixing
f
ti
ƒ (x,y) with y = m(x) can be seen as an error-correcting code
C’
ƒB corresponds with the minimum distance of this code
ƒ Maximum B: take a Maximum Distance Separable (MDS)
ƒ Relevant: number of active components in (A’,B’)
ƒ Diffusion criterion for mixing transformation y = m(x)
ƒ
ƒ Branch number B: minimum number of active comp. in (A’,B’)
B depends only on the mixing transformation
code
X
43
Block ciphers and cryptographic hash functions
Shark
Y
Four-Round Optimization (1)
ƒ Compose linear part of local mixing transformation and
diffusion optimal component permutation
A’
ƒ Block length of 64 bits = 8 bytes
ƒ 8-bit S-box
ƒ MDS code over GF(256), length 16, dimension 8
ƒ Optimal 2-round
2 round mixing
ƒ Sub-optimal performance
45
Block ciphers and cryptographic hash functions
S S
Mixing
S
S S
Mixing
S
S S S
Mixing
S S
Mixing
S
S S
Mixing
S
S S S
Mixing
S S
Mixing
S
S S
Mixing
S
S S S
Mixing
S S
Mixing
S
S S
Mixing
S
S S S
Mixing
S S S
Mixing
S S S
S S S
Mixing
S S S
Mixing
S S S
Mixing
S S S
S S S
Mixing
S S S
C’
D’
Square
A’
ƒ Block length of 128 bits = 16 bytes = 4 × 4
ƒ 8-bit S-box
ƒ MDS code over GF(256), length 8, dimension 4
ƒ Diffusion optimal permutation: transpose
B’
Mixing
B’
B
46
Block ciphers and cryptographic hash functions
Four-Round Optimization (2)
S S S
Mixing
S S S
44
Block ciphers and cryptographic hash functions
Mixing
S S S
Mixing
S S S
C’
ƒ 4-round mixing: 25 active S-boxes per 4 rounds
ƒ S-box: EDP ≤ 2–6
D’
ƒ EDP of 4-round characteristic ≤ 2–150
ƒ Reorder transformations ⇒ Super-boxes
2
ƒ Apply two-round theorem recursively: B active S-boxes
Block ciphers and cryptographic hash functions
47
Block ciphers and cryptographic hash functions
48
8
Rijndael
Remark
ƒ Preliminary AES call asked for variable block length
ƒ MDS codes require byte-level approach
ƒ Needed rectangular input arrays
ƒ Replace transpose by row shift
ƒ Similar approach, but on bit level, by Tavares et al. [1998]
ƒ Diffusion on bit level
ƒ Increase number of rounds (improved cryptanalysis)
ƒ Also within the S
S-boxes
boxes (Avalanche criteria)
ƒ PR
ƒ More complicated key schedule
ƒ Use ObjectOriented names for different components
Block ciphers and cryptographic hash functions
49
Block ciphers and cryptographic hash functions
50
Conclusions
ƒ Differential cryptanalysis
ƒ Basic method
ƒ Several theories to secure designs
ƒ Simple AES structure allows for easier computation of bounds
Block ciphers and cryptographic hash functions
51
9
Download