a key-recovery attack on 855-round trivium key-recovery... · introduction to trivium outline 1...

24
A Key-recovery Attack on 855-Round Trivium Ximing Fu, Xiaoyun Wang, Xiaoyang Dong, Willi Meier Tsinghua University, Beijing, China FHNW, Windisch, Switzerland June 6,2018

Upload: others

Post on 30-Jan-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

A Key-recovery Attack on 855-Round Trivium

Ximing Fu, Xiaoyun Wang, Xiaoyang Dong, Willi Meier

Tsinghua University, Beijing, ChinaFHNW, Windisch, Switzerland

June 6,2018

Page 2: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Introduction to Trivium

Outline

1 Introduction to Trivium

2 Related Works

3 Basic Ideas

4 Attack on 855-round Trivium

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 2 / 24

Page 3: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Introduction to Trivium

Trivium

Initialization:(s1, s2, . . . , s93)← (K0, . . . ,K79, 0, . . . , 0)(s94, s95, . . . , s177)← (IV0, . . . , IV79, 0, . . . , 0)(s178, s179, . . . , s288)← (0, . . . , 0, 1, 1, 1).for i← 1 : 4 · 288 do

t1 ← s66 + s91 · s92 + s93 + s171t2 ← s162 + s175 · s176 + s177 + s264t3 ← s243 + s286 · s287 + s288 + s69(s1, s2, . . . , s93)← (t3, s1, . . . , s92)(s94, s95, . . . , s177)← (t1, s94, . . . , s176)(s178, s179, . . . , s288)← (t2, s178, . . . , s287)

end for

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 3 / 24

Page 4: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Introduction to Trivium

Trivium

Generate the keystreams:for i← N dot1 ← s66 + s91 · s92 + s93 + s171t2 ← s162 + s175 · s176 + s177 + s264t3 ← s243 + s286 · s287 + s288 + s69oi ← s66 + s93 + s162 + s177 + s243 + s288(s1, s2, . . . , s93)← (t3, s1, . . . , s92)(s94, s95, . . . , s177)← (t1, s94, . . . , s176)(s178, s179, . . . , s288)← (t2, s178, . . . , s287)

end for

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 4 / 24

Page 5: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Introduction to Trivium

Trivium

Iterative expression: let srw (0 ≤ w ≤ 2) denote s1, s94 and s178 at roundr.

sr0 = sr−662 + sr−1092 sr−1102 + sr−1112 + sr−690 ,

sr1 = sr−660 + sr−910 sr−920 + sr−930 + sr−781 ,

sr2 = sr−691 + sr−821 sr−831 + sr−841 + sr−872 .

(1)

Output: zr = sr−650 + sr−920 + sr−681 + sr−831 + sr−652 + sr−1102

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 5 / 24

Page 6: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Related Works

Outline

1 Introduction to Trivium

2 Related Works

3 Basic Ideas

4 Attack on 855-round Trivium

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 6 / 24

Page 7: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Related Works

Cube-like Attack

ANF: The output bit or state bit for a stream cipher over m IV bits andn key bits is

s =∑I,J

∏i∈I

vi∏j∈J

kj . (2)

IV term: tI =∏

i∈I viCoefficient function: gI(k) =

∏j∈J kj

Theorem 1

Cube sum of s over set I is gI(k), i.e.,∑i∈I

s = gI(k), (3)

where the IV bits vk (k /∈ I) are fixed.

1 gI(k) is linear or of low degree over partial key bits (key-recovery)2 gI(k) = 0: tI(k) is a missing IV term (distinguisher)

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 7 / 24

Page 8: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Outline

1 Introduction to Trivium

2 Related Works

3 Basic Ideas

4 Attack on 855-round Trivium

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 8 / 24

Page 9: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

A new polynomial reduction technique

Lemma 2

Suppose z is the output polynomial of a cipher, and

z = P1P2 + P3. (4)

Then the polynomial can be reduced to a simpler one(1 + P1)z = (1 + P1)P3 by multiplying 1 + P1 in both sides of Eq. (4) ifdeg(P1P2) > deg((1 + P1)P3).

How to distinguish right and wrong key guesses

1 Right guess: (1 + P1)z = (1 + P1)P3

2 Wrong guesses: (1 + P ′1)z = (1 + P ′1)P1P2 + (1 + P ′1)P3

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 9 / 24

Page 10: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Outline of our attack

Preprocess phase

1 Determine P1 and obtain the reduced polynomial (1 + P1)P3. Thereare 3 criteria for choice of P1: (1) the frequency of P1 in highdegree state terms is high; (2) the degree of P1 is low; (3) theequivalent key guesses in P1 are minimized.

2 Compute the degree bound of (1 + P1)P3 as d, thend+ 1-dimensional cubes can serve as distinguishers.

Online attack phase

Guess the partial key bits in P1 and compute the sum of (1 + P1)z overd+ 1 cubes:

1 For right guess, the result is always 0.

2 For wrong guesses, the results are 0-1 balanced.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 10 / 24

Page 11: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

The preprocessing phase

1 80 1 80( ,..., , ,..., )k k v v Forward

Internal State bits

jis

IV Representation

discarding monomials

Step 1 Step 3

jis

Internal State bits

Step 2

1 3(1 )P P

1 Compute the state bits sji (j ∈ [0, 2]) for i ∈ [0, 340] over key andIV bits.

2 Decompose the output bit and obtain (1 + P1)P3 over state bits atrounds less than 450.

3 ”Meet-in-the-middle”: decomposition & IV representation

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 11 / 24

Page 12: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Key techniques

In Step 2 and Step 3, repeated-term removing algorithm and fastdiscarding techniques are used during decomposition, including degreeevaluation and degree reduction techniques, set a bound d:

1 if the evaluated degree of a state term deg Ti, then Ti can bedeleted;

2 if deg(Ti)− dt(Ti) < d, then Ti can be deleted, where dt(Ti) is thedegree reduction of Ti.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 12 / 24

Page 13: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Repeated-(state)term Removing Algorithm

Algorithm 1 Repeated-(state)term Removing Algorithm

Input: The vector ~T with n terms, i.e., T1, T2, . . ., Tn.Output: Updated ~T with m terms, where m ≤ n.1: Initialize an empty Hash Set H.2: for i← 1 : n do3: Compute the Hash value of Ti, i.e., H(Ti)4: if H.contains(Ti) is true then5: H.delete(Ti)6: else7: H.insert(Ti)8: end if9: end for

The complexity of Algorithm 1 is O(n) for processing n state terms.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 13 / 24

Page 14: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Degree evaluation algorithm

Algorithm 2 Degree Evaluation Algorithm (DEG) of State Bit

Input: The value t and r which indicates the state bit srt .Output: DEG(srt )=d.1: Initialize the degree bound d similar to the above Step 2., the end point end.2: len← 03: while len = 0 do4: Iteratively express srt using state bits sji , where 0 ≤ j ≤ 2 and 0 ≤ j < end. During

each expression, discard the state terms of degree lower than d. Let len be the numberof remaining state terms.

5: if len = 0 then6: d← d− 17: end if8: end while9: return d

Where end = b r32c × 32− 128 in the cryptanalysis of Trivium.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 14 / 24

Page 15: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Degree evaluation: example

Degree evaluation of s3411 (end = b r32c × 32− 128 = 192):

Step 1. First, we decompose s3412 = s2721 + s2591 s2581 + s2571 + s2542 .Step 2. Letd = max{deg(s2721 ), deg(s2591 )+deg(s2581 ),deg(s2571 ),deg(s2542 } = 10.Step 3. Discarding the state terms of degree lower than 10, we gets341∗2 = s2591 s2581 . Decompose and discard again, there is no stateterm surviving. Reset d = d− 1 = 9 and repeat the above process.We can get the result s341∗∗2 = s1660 s1670 s1930 + s1670 s1680 s1920 + ....Step 4. Continue to decompose and discard, and we get:

s341∗∗∗2 = s562 s572 s832 s842 s1012 + s572 s582 s832 s842 s1002 + ... (5)

Step 5. The decomposition ends and there are still state termssurviving. d = 9 is the estimated degree of s3412 .Step 6. Note that, if there is no state item in s341∗∗∗2 surviving,which means the degree must be less than 9. We reset d = 8 andcontinue the above steps 3-5.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 15 / 24

Page 16: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Degree reduction algorithm

Algorithm 3 Degree Evaluation Algorithm (DEG) of State Bit

Input: The value i, r, t which indicates the state term degree reduction.Output: The degree reduction dt =

∑l+t−1j=l deg(sji )− deg(

∏l+t−1j=l sji ).

1: Initialize the degree bound d =∑l+t−1

i=l DEG(sji ) , degree reduction dt = 0, end point endand number of survived state terms len.

2: while len = 0 do3: Express the state term

∏l+t−1j=l sji using state bits sji , where 0 ≤ i ≤ 2 and 0 ≤ j < end,

discard the state terms of degree lower than d−dt. Let len be the number of remainingstate terms.

4: if len = 0 then5: dt ← dt + 16: end if7: end while8: return dt

Where end = b r32c × 32− 128 in the cryptanalysis of Trivium.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 16 / 24

Page 17: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Degree reduction: example

Degree reduction of s3401 s3411 (end = b r32c × 32− 128 = 192):

Initialize d = DEG(s3401 ) +DEG(s3411 ) and dt = 0.

Express the s3401 s3411 , discard the state terms of degree lower thand− dt = d, there is no state term surviving.

Increase the dt by 1, such that dt = 1.

Express s3401 s3411 again and discard the state terms of degree lowerthan d− dt = d− 1, the result is s2490 s2500 s2621 + s2480 s2490 s2631 .

Continue to compute iteratively, the remaining state terms ares1700 s1710 s1800 s1402 s1412 + s1700 s1710 s1810 s1392 s1402 + s1710 s1720 s1790 s1392 s1402 +s1710 s1720 s1800 s1382 s1392 . There is no state bits sji with j bigger thanend = 192 in all the state terms, hence the expression ends.

Degree reduction dt = 1 is returned. Thusdeg(s3401 s3411 ) ≤ DEG(s3401 ) +DEG(s3411 )− dt = 7 + 7− 1 = 13.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 17 / 24

Page 18: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

IV representation

Definition 3

Given a Boolean polynomial s =∑I,J

∏i∈I

vi∏j∈J

kj , the corresponding IV

representation is sIV =∑I,J

∏i∈I

vi.

Example 4

For s = v0k1 + v0k0k2 + v1k1k2 + v0v1k2, the representation issIV = v0 + v0 + v1 + v0v1

Property 1

If an IV term exists in s, it must also exist in sIV , but not the opposite.If an IV term is not in sIV , it can be concluded that it is not in s.

Using IV representation can compute the missing IV terms, which canserve as distinguishers.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 18 / 24

Page 19: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Basic Ideas

Repeated-IV term Removing Algorithm

Algorithm 4 Repeated-IV term Removing Algorithm

Input: The vector ~T with n IV terms, i.e., T1, T2, . . ., Tn.Output: Updated ~T with m IV terms, where m ≤ n.1: Initialize an empty Hash set H.2: for i← 1 : n do3: Compute the Hash value of Ti, i.e., H(Ti).4: if H.contains(Ti) is false then5: H.insert(Ti).6: end if7: end for

The time complexity is O(n) for processing n IV terms.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 19 / 24

Page 20: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Attack on 855-round Trivium

Outline

1 Introduction to Trivium

2 Related Works

3 Basic Ideas

4 Attack on 855-round Trivium

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 20 / 24

Page 21: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Attack on 855-round Trivium

Attack on Trivium

Compute the exact Boolean polynomial of state bits srw (w ∈ [0, 2]) forr ≤ 340 and obtain the degree bound of the other state bits by applyingAlgorithm 2.

Determine P1 = s2101 : decompose the output bit of 855-roundTrivium and preserve the high degree state terms (1) s2101 occurs inabout 3

4 of all the preserved high state terms; (2) the degree of s2101

is 5 and can be reduced to 2 after nullifying the 5 IV bits; (3) thereare only 3 equivalent key bits to be guessed.

Nullify 5 IV bits to reduce the degree of s2101 and update theBoolean polynomials and degrees of state bits.

Determine the key bits in P1, i.e., k19, k20,k57 + k63 + k21 + k28k29 + k3 + k30 + k12 + k37k38 + k39.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 21 / 24

Page 22: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Attack on 855-round Trivium

Preprocessing Phase

State Terms

Repeated Term RemovingDegree EvaluationDegree Reduction

Discarding Monomials

Repeat (Algorithm 4)IV Representation

70-degree IV terms

Left State Terms

Deleted State Terms

degree evaluation: remove the state terms of degree lower than 70

degree reduction: remove the state terms of degree lower thand < 70+ dt, where dt is the corresponding degree reduction for stateterms

IV representation: compute the existent 70-degree IV terms

It is proved that deg((1 + s2101 )z855) < 70.X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 22 / 24

Page 23: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Attack on 855-round Trivium

Online Phase

Algorithm 5 On-line Attack

1: Initialize the possible key space KEY with size of 23.2: for i← 1 : 3 do3: for Each possible key in KEY do4: Compute the value s2101 , so that obtain the value of (1 + s2101 )z,5: Compute cube sums zsum of (1 + s2101 )z,6: if zsum = 1 then7: Delete key from KEY .8: end if9: end for

10: end for

Complexity analysis: the time complexity is (23 + 22 + 21)270 ≈ 274 bitoperations.

X Fu ( Tsinghua University, Beijing, China FHNW, Windisch, Switzerland )A Key-recovery Attack on 855-Round Trivium June 6,2018 23 / 24

Page 24: A Key-recovery Attack on 855-Round Trivium Key-recovery... · Introduction to Trivium Outline 1 Introduction to Trivium 2 Related Works 3 Basic Ideas 4 Attack on 855-round Trivium

Thanks for Your Attention