SIMD Is a Message Digest
Total Page:16
File Type:pdf, Size:1020Kb
SHA-3 submission { Tweaked version: 2009-09-15 SIMD Is a Message Digest Principal submitter: Ga¨etanLeurent Ecole´ Normale Sup´erieure D´epartement d'Informatique 45, rue d'Ulm 75005 Paris France [email protected] Tel: +33.1.44.32.20.47 Fax: +33.1.44.32.21.51 Auxiliary submitters: Charles Bouillaguet, Pierre-Alain Fouque Algorithm inventors/developers: Ga¨etanLeurent, Charles Bouillaguet, Pierre-Alain Fouque Backup contact: Pierre-Alain Fouque Ecole´ Normale Sup´erieure D´epartement d'Informatique 45, rue d'Ulm 75005 Paris France [email protected] Tel: +33.1.44.32.20.48 Fax: +33.1.44.32.21.51 Last revision: 2009-09-15 2 3 About the tweak This document defines the version 1.1 of SIMD. The following modifications have been made since version 1.0: • The permutations p(i) have been optimized to provide a better security. • The rotations r(i) and s(i) have been optimized to provide a better security. • We introduce a new family of strengthened versions SIMD+ with more rounds than SIMD. These versions can be used if strong security margins are needed. • We introduce a new family of reduced versions SISD which can be used in constrained environment when only a short tag is needed. These versions can also be useful to develop cryptanalysis techniques. • The IV and the test vectors have been updated. The tweak has essentially no effect on the performances of SIMD. This tweak is motivated by the discovery of a differential distinguisher on the compression function of SIMD-512 1.0 by Nad and Mendel [21]. This distinguishing attack has complexity 2427 and is a based on a differential trail where no difference is introduced in the message, but a −507 specific difference ∆in in the chaining value can go to a difference ∆out with probability 2 . The attack is possible because the diffusion in the compression function is relatively slow and the permutations and rotations of SIMD 1.0 have some bad properties that allow good differential paths. The tweak prevents the attack in its current form by removing unwanted properties of the permutations and rotations, but it is possible that future improvements give a distinguisher based on similar ideas. However, we decided to not increase the number of rounds of SIMD because we believe that such distinguishers do not threaten the security of SIMD. The compression function of SIMD was designed with the idea that the message input and the chaining value input of the compression function have a different role. An attacker can easily control the message input, but the chaining value can only be chosen by hashing a previous block. That is why we use a strong message expansion step, and the chaining value undergoes less transformations. Moreover, since SIMD is using a wide-pipe design, attacks on the compression function which require control of the chaining value are very unlikely to be transferable to the full hash function. For instance a free-start preimage attack on the compression compression can not be used to break the hash function, even if it is only has unit cost. Therefore, we believe that it not worth increase the number of rounds to avoid potential free- start distinguishers, but we provide a strengthened version SIMD+ for those who feel otherwise. 4 5 Introduction The SIMD hash function is quite similar to members of the MD/SHA family. It is based on a familiar Merkle-Damg˚arddesign, where the compression function is built from a Feistel-like cipher in Davies-Meyer mode. However there are some innovations in this design: the internal state is twice as big as the output size, we use a strong message expansion, and we use a modified feed-forward in the compression function. The main design criteria was to follow the MD/SHA designs principle which are quite well understood, and to add some elements to avoid all known attacks. SIMD is particularly efficient on platforms with vector instructions (SIMD) which are available on many processors. Such instructions have been proposed since 1997 and are now widely deployed. Moreover, it is also possible to use two cores on multicore processors to boost the performance with a factor 1.8 by splitting the message expansion function and the hashing process. 6 Contents 1 Algorithm Specification and Rationale 9 1.1 Mathematical Preliminaries and Notations . .9 1.1.1 The Field F257 .................................9 1.1.2 The Number-Theoretic Transform . .9 1.1.3 The Rings Z216 and Z232 ............................ 10 1.1.4 Superscripts and Subscripts . 10 1.2 Description of the Algorithm . 10 1.2.1 Mode of Operation . 11 1.2.2 The Message Expansion . 12 1.2.3 The Feistel Ladder . 15 1.2.4 The Final Compression Function . 19 1.2.5 Initialization Vector . 21 1.2.6 Input and Output . 21 1.3 Rationale . 24 1.3.1 Iteration Mode . 24 1.3.2 Davies-Meyer . 24 1.3.3 The Message Expansion . 26 2 Implementation Aspect and Performances 27 2.1 Software Implementation . 27 2.1.1 SIMD Instructions . 27 2.1.2 Optimized Implementation . 28 2.1.3 Multi-core . 29 2.1.4 Performance . 29 2.2 8-bit Implementation . 30 2.3 Hardware Implementation . 30 3 Expected Strength 31 3.1 Security of the compression function . 31 4 Security Analysis 33 4.1 Mode of Operation . 33 4.1.1 Mode of Operation for the Hash Function . 33 4.1.2 Security Results for Some Hash Based Constructions . 33 4.1.3 Mode of Operation for the Compression Function . 34 4.2 Security of the Compression Function . 34 4.2.1 Resistance to Differential Cryptanalysis . 34 4.2.2 The Step Update Function . 34 7 8 CONTENTS 4.3 Reduced Versions . 35 4.3.1 SISD-n ...................................... 35 4.3.2 SIMD-n/2:k ................................... 36 4.3.3 SIMD-n/k .................................... 36 4.4 Strengthened Versions . 37 5 Advantages and Limitations 39 5.1 Parallelism . 39 5.2 Security . 39 5.3 Performance . 39 A Test Vectors 43 A.1 SIMD-224 ........................................ 44 A.1.1 Empty Message . 44 A.1.2 One-block Message . 51 A.1.3 Two-block Message . 64 A.2 SIMD-256 ........................................ 85 A.2.1 Empty Message . 85 A.2.2 One-block Message . 92 A.2.3 Two-block Message . 106 A.3 SIMD-384 ........................................ 127 A.3.1 Empty Message . 127 A.3.2 One-block Message . 139 A.3.3 Two-block Message . 163 A.4 SIMD-512 ........................................ 198 A.4.1 Empty Message . 198 A.4.2 One-block Message . 210 A.4.3 Two-block Message . 234 Chapter 1 Algorithm Specification and Rationale This document defines the SIMD family of hash functions. This family is based on two functions SIMD-256 and SIMD-512; we define SIMD-n with n ≤ 256 as a truncation of SIMD-256, and SIMD-n with 256 < n ≤ 512 as a truncation of SIMD-512. Each function SIMD-n takes as input a message of arbitrary size, and outputs a digest of n bits. 1.1 Mathematical Preliminaries and Notations The design of SIMD uses a number of different operations with useful mathematical properties. In this section, we introduce the operations that will be used through this document, and detail their properties. 1.1.1 The Field F257 Since 257 is a prime, the ring Z257 of the integers modulo 257 is a field F257. The operations in this field are denoted with (mod 257). We chose this field because we can easily map a byte to an element of the field, and the operations in F257 can be computed efficiently in software and in hardware. 1.1.2 The Number-Theoretic Transform The Number-theoretic transform of size n in F257 is defined as: n n NTTn : F257 ! F257 n−1 n−1 n−1 X ij (xj)j=0 7! (yi)i=0 : yi = xj! (mod 257): j=0 where n ≤ 256, and ! is a n-th root of unity in F257. We can see it as a polynomial evaluation: n−1 Pn−1 j if the sequence (xj)j=0 is interpreted as a polynomial P (X) = j=0 xjX , then we have yi = P (!i). 9 10 CHAPTER 1. ALGORITHM SPECIFICATION AND RATIONALE This transform is identical to the Discrete Fourier Transform but it operates on a finite field n instead of the field of complex numbers. It is a bijection of F257. It can be computed efficiently by the same algorithm as the Fast Fourier Transform, which has a complexity of O(n log n) field operations. 1.1.3 The Rings Z216 and Z232 16 32 Z216 denotes the ring of integers modulo 2 , and Z232 denotes the ring of the integers modulo 2 . We use and to represent the modular addition and multiplication in these rings. (Actually, we only use in Z232 and in Z216 ). We can represent elements of Z216 by 16-bit words, and elements of Z232 by 32-bit words. Thus, we define the following bitwise boolean functions on 32-bit words: IF(A; B; C) = (A ^ B) _ (:A ^ C) MAJ(A; B; C) = (A ^ B) _ (A ^ C) _ (B ^ C) where _ denotes the boolean OR, ^ denotes AND, and : denotes NOT. We also use ⊕ for the exclusive or (XOR). IF acts as a conditional, and MAJ is the majority function. These function are already used in some hash functions because they have good properties: the output is unbiased, and no input bit has a linear effect on the output.