Cryptanalysis of Streebog, the New Russian Hash Function Standard
Total Page:16
File Type:pdf, Size:1020Kb
Cryptanalysis of Streebog, the new Russian hash function standard Jérémy Jean1 joint work with: Jian Guo1 Gaëtan Leurent2 Thomas Peyrin1 Lei Wang1 1Nanyang Technological University, Singapore 2INRIA, France ASK 2014 – December 21, 2014 Introduction Streebog Diamond attack Expandable message attack Conclusion Outline 1. Introduction 2. Streebog 3. Diamond attack 4. Expandable message attack 5. Conclusion ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 2/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Outline 1. Introduction Cryptographic hash functions Security notions Design strategies Generic attacks on Merkle-Damgård HAIFA framework 2. Streebog 3. Diamond attack 4. Expandable message attack 5. Conclusion ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 3/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Cryptographic hash functions A hash function is a function H in the mathematical sense: H : f0; 1g∗ −! f0; 1gn. H 50697fb42e88f27b0d19b625b18ae016 A cryptographic hash function is a hash function securely reducing an input of arbitrary length to an output of fixed length. ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 4/36 H 6= 50697fb42e88f27b0d19b625b18ae016?50697fb42e88f27b0d19b625b18ae016 H Introduction Streebog Diamond attack Expandable message attack Conclusion Security notions for cryptographic hash functions H : f0; 1g∗ −! f0; 1gn. H 50697fb42e88f27b0d19b625b18ae016 Expected behavior I Public random oracle. I Behave as a random function. I Public function with no structural property. ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 5/36 H 6= 50697fb42e88f27b0d19b625b18ae016?50697fb42e88f27b0d19b625b18ae016 H Introduction Streebog Diamond attack Expandable message attack Conclusion Security notions for cryptographic hash functions H : f0; 1g∗ −! f0; 1gn. H 50697fb42e88f27b0d19b625b18ae016 Security notions n I Preimage resistance 2 n I Second-preimage resistance 2 n=2 I Collision resistance 2 ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 5/36 H 6= H ?50697fb42e88f27b0d19b625b18ae016 H Introduction Streebog Diamond attack Expandable message attack Conclusion Security notions for cryptographic hash functions H : f0; 1g∗ −! f0; 1gn. H 6= 50697fb42e88f27b0d19b625b18ae016 H Security notions n I Preimage resistance 2 n I Second-preimage resistance 2 n=2 I Collision resistance 2 ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 5/36 H 6= H 50697fb42e88f27b0d19b625b18ae01650697fb42e88f27b0d19b625b18ae016 H Introduction Streebog Diamond attack Expandable message attack Conclusion Security notions for cryptographic hash functions H : f0; 1g∗ −! f0; 1gn. H 6= ? H Security notions n I Preimage resistance 2 n I Second-preimage resistance 2 n=2 I Collision resistance 2 ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 5/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Iterated functions I H takes input M of any length ) Difficult to handle. I Use fixed-size input function called compression function f : f0; 1gn × f0; 1gb −! f0; 1gn. I Mode of operation to handle messages longer (or shorter) than b bits. I Chain the successive outputs hi of f . I First chaining value h0 initialized to some IV (initialization vector). I Split M into b-bit chunks M = M1jjM2jj · · · . Mn f hn hn−1 Compression function f : f0; 1gn × f0; 1gb −! f0; 1gn: ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 6/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Merkle-Damgård mode: construction f ∗ n I Construction of a hash function H : f0; 1g −! f0; 1g . I Domain extension (mode) from a given compression function f : f0; 1gn × f0; 1gb −! f0; 1gn. I Initial message M is padded by 1, as few 0 as possible and the length jMj to reach jpad(M)j = m · b being a multiple of b. That is: pad(M) = M jj 1 jj 0∗ jj jMj. I Merkle-Damgård strengthening: pad(M) ends with jMj. I Set h0 = IV , and for k 2 f0;:::; m − 1g, do hk+1 = f (hk ; Mk ). f I Output the last chaining value hm as H (M). Domain extension by Merkle-Damgård pad(M) = M1 M2 M3 M4 h0 = IV f f f f ··· h1 h2 h3 ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 7/36 I Assume f is collision-resistant. f f 0 I Suppose we have a collision in the hash function: H (M) = H (M ). I We can show that we can also find a collision in f . 0 I If jMj 6= jM j, the last block containing the length in the padding is 0 0 different. So: f (hjM|−1; MjMj) = f (hjM0|−1; MjM0j). 0 I If jMj = jM j, we search for collision backwards in the chains until we find the collision. f I Therefore: if f is collision-resistant, then H is collision-resistant. Introduction Streebog Diamond attack Expandable message attack Conclusion Merkle-Damgård mode: security I Construction to build a collision-resistant hash function from a collision-resistant compression function. ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 8/36 I We can show that we can also find a collision in f . 0 I If jMj 6= jM j, the last block containing the length in the padding is 0 0 different. So: f (hjM|−1; MjMj) = f (hjM0|−1; MjM0j). 0 I If jMj = jM j, we search for collision backwards in the chains until we find the collision. f I Therefore: if f is collision-resistant, then H is collision-resistant. Introduction Streebog Diamond attack Expandable message attack Conclusion Merkle-Damgård mode: security I Construction to build a collision-resistant hash function from a collision-resistant compression function. I Assume f is collision-resistant. f f 0 I Suppose we have a collision in the hash function: H (M) = H (M ). ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 8/36 f I Therefore: if f is collision-resistant, then H is collision-resistant. Introduction Streebog Diamond attack Expandable message attack Conclusion Merkle-Damgård mode: security I Construction to build a collision-resistant hash function from a collision-resistant compression function. I Assume f is collision-resistant. f f 0 I Suppose we have a collision in the hash function: H (M) = H (M ). I We can show that we can also find a collision in f . 0 I If jMj= 6 jM j, the last block containing the length in the padding is 0 0 different. So: f (hjM|−1; MjMj) = f (hjM0|−1; MjM0j). 0 I If jMj = jM j, we search for collision backwards in the chains until we find the collision. ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 8/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Merkle-Damgård mode: security I Construction to build a collision-resistant hash function from a collision-resistant compression function. I Assume f is collision-resistant. f f 0 I Suppose we have a collision in the hash function: H (M) = H (M ). I We can show that we can also find a collision in f . 0 I If jMj= 6 jM j, the last block containing the length in the padding is 0 0 different. So: f (hjM|−1; MjMj) = f (hjM0|−1; MjM0j). 0 I If jMj = jM j, we search for collision backwards in the chains until we find the collision. f I Therefore: if f is collision-resistant, then H is collision-resistant. ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 8/36 1=r n(r−1)=r I Random function: about (r!) · 2 function evaluations. f n=2 I MD hash function H : about r · 2 function evaluations. I Idea: I Rely on the iterated structure of Merkle-Damgård. I Construct internal f -collisions on the chaining variables. r I Reach 2 colliding messages from only r internal collisions. m1 m2 m3 mr h0 f f f f hr h1 h2 h3 hr−1 0 0 0 0 m1 m2 m3 mr Introduction Streebog Diamond attack Expandable message attack Conclusion Multi-collision attack I Technique by Antoine Joux (2004). I What is the cost of constructing fM1;:::; Mr g such that f f 8i; j; H (Mi ) = H (Mj )? ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 9/36 Introduction Streebog Diamond attack Expandable message attack Conclusion Multi-collision attack I Technique by Antoine Joux (2004). I What is the cost of constructing fM1;:::; Mr g such that f f 8i; j; H (Mi ) = H (Mj )? 1=r n(r−1)=r I Random function: about (r!) · 2 function evaluations. f n=2 I MD hash function H : about r · 2 function evaluations. I Idea: I Rely on the iterated structure of Merkle-Damgård. I Construct internal f -collisions on the chaining variables. r I Reach 2 colliding messages from only r internal collisions. m1 m2 m3 mr h0 f f f f hr h1 h2 h3 hr−1 0 0 0 0 m1 m2 m3 mr ASK 2014 – J. Guo, J. Jean, G. Leurent, T. Peyrin, L. Wang – Cryptanalysis of Streebog 9/36 , but Kelsey and Schneier have shown (2005) that we can actually construct expandable messages to arbitrarily choose the length of the prefix of the second message. IV Introduction Streebog Diamond attack Expandable message attack Conclusion Generic second-preimage attack k I For very long message of2 blocks, one can construct a second preimage of Hf (M) in2 n−k computations( k ≤ n=2).