Cryptanalysis with Cube Attack
Total Page:16
File Type:pdf, Size:1020Kb
Cryptanalysis with Cube Attack Vignesh Meenakshi Sundaram, Faculty of Mathematics and Computer Science, University of Tartu, Tartu, Estonia [email protected] Abstract. Cube Attack is a recent type of attack under algebraic cryptanalysis, proposed by Shamir et al. in EUROCRYPT 2009. It can be carried out on any cipher irrespective of the corresponding block and key lengths. Simplified DES, developed by Professor Edward Schaefer of Santa Clara University has similar properties and structure to DES with much smaller parameters. PRESENT is an ultra-lightweight block cipher, proposed by A. Bogdanov et al. in CHES 2007. In this report, section 1 gives an introduction to Cryptanalysis using Cube Attack, section 2 contains a brief description of Simplified DES; section 3 explains the PRESENT cipher, section 4 describes the Cube Attack in brief, while section 5 covers Cube Attack on the SDES cipher and section 6 discusses Cube Attack on the PRESENT cipher. Keywords: block cipher, lightweight, cryptanalysis, cube attack. 1 Introduction Of the various types of attacks under algebraic cryptanalysis, Cube Attack is a recent attack. In EUROCRYPT 2009, Itai and Shamir proposed this attack. Cube attack aids in deriving the key-bits of a key when used in a cipher. It can be used to attack any cryptosystem in which even a single bit can be represented by a low degree multivariate polynomial in the key and plaintext variables. It can be carried out on any cipher irrespective of the corresponding block and key lengths. Cube attack reduces the complexity of the attack, as even the knowledge of a single key bit can prove efficient as the rest of the key-bits can be obtained by brute-force. The Simplified DES or SDES is a lighter version of the Data Encryption Standard and is used for educational purposes. In this report, we perform the cube attack on SDES and also go to show how it can be implemented in the PRESENT cipher. The PRESENT cipher is an ultra-lightweight cipher which can be efficiently used in constrained environments which demand security guarantee such as RFID tags and sensor networks. As the popularity of these lightweight devices continues to rise, so will the security measures and guarantees and therefore, using lightweight ciphers is advisable and beneficial too. 2 Simplified DES Simplified Data Encryption Standard or Simplified DES, is also known as SDES. It was developed by Professor Edward Schaefer of Santa Clara University. SDES has similar properties and structure to DES (Data Encryption Standard) with much smaller parameters. It is an educational [1] rather than a secure encryption algorithm. 2.1 How SDES works SDES operates on an 8-bit plaintext, and a 10-bit key to yield an 8-bit ciphertext. The encryption algorithm involves five functions: 1. An initial permutation (IP). 2. A complex function labeled fK, which involves both permutation and substitution operations and depends on a key input. 3. A simple permutation function that switches (SW) the two halves of the data. 4. The function fK again. 5. A permutation function that is the inverse of the initial permutation (IP–1). The encryption algorithm can be written as follows: -1 ciphertext = IP ( fK2 ( SW ( fK1 ( IP ( plaintext ) ) ) ) ) K1 = P8 ( Shift ( P10 ( key ) ) ) K2 = P8 ( Shift ( Shift ( P10 ( key ) ) ) ) The decryption algorithm follows as: -1 plaintext = IP ( fK1 ( SW ( fK2 ( IP ( ciphertext ) ) ) ) ) Key Schedule: Let the 10-bit key be designated as (k1, k2, k3, k4, k5, k6, k7, k8, k9, k10) Step 1: The key is permuted according to Table 1: P10 3 5 2 7 4 10 1 9 8 6 Table 1: The SDES P10 Table P10 (k1, k2, k3, k4, k5, k6, k7, k8, k9, k10) = (k3, k5, k2, k7, k4, k10, k1, k9, k8, k6) Step 2: P8 is applied, which picks out and permutes 8 of the 10 bits according to the following rule (Table 2): P8 6 3 7 4 8 5 10 9 Table 2: The SDES P8 Table Encryption: Initial Permutation: The 8-bit block of plaintext is permuted using the IP function according to Table 3: IP 2 6 3 1 4 8 5 7 Table 3: The SDES IP Table The Function fK: This is the most complex component of SDES and consists of a combination of permutation and substitution functions, expressed as follows: Let L and R be the leftmost and rightmost bits of the input and let F be a mapping from 4-bit strings to 4-bit strings. Then FK(L, R) = ( L ⊕ F ( R, SK ), R ) where SK is a subkey and ⊕ is the bit-wise exclusive-OR function. The Switch Function: The left and right 4 bits are interchanged so that the second instance of fK operates on a different set of 4 bits. In this second instance, the key input is K2. Final Permutation: The 8-bit input is permuted using the IP-1 function according to Table 4: IP-1 4 1 3 5 7 2 8 6 Table 3: The SDES IP Table 10-bit key ENCRYPTION DECRYPTION P10 8-bit plaintext 8-bit plaintext Shift IP IP-1 P8 fK fK Shift SW SW P8 fK fK IP-1 IP 8-bit ciphertext 8-bit ciphertext Figure C.1 Simplified DES Scheme 2.2 Comparison between SDES and DES Parameter SDES DES Blocksize 8-bit 64-bit Key 10-bit 56-bit -1 -1 Encryption IP ( fK2 ( SW ( fK1 ( IP ) ) ) ) IP ( fK16 ( SW ( fK15 ( SW (…( SW ( Scheme fK1 ( IP ) ) )…) ) ) ) ) Inputs to F 4-bit (n1, n2, n3, n4) 32-bit (n1…n32) Table 4: SDES vs DES 3 The PRESENT Cipher In CHES 2007, A. Bogdanov et al. proposed an ultra-lightweight block cipher called PRESENT. The primary focus of PRESENT is to facilitate easy hardware optimization [2], such that constrained environments such as RFID tags and sensor networks can be easily implemented in the same. 3.1 How PRESENT works PRESENT operates on a 64-bit plaintext, and an 80-bit or a 128-bit key. In this report, we will be focusing on 80-bit key length. PRESENT consists of 31 rounds. Key Schedule: Step 1: The 80-bit key provided by the user is stored in the K, which is the key register. K = k79k78…k0. Step 2: For i = 1 to 32, do: th Set sub keys Ki as the round key for the i round, 63 62 0 Ki = Ki Ki …Ki = k79k78…k16. Update key register K = k79k78…k1k0 accordingly as: [k79k78…k1k0] = [k18k17…k20k19], [k79k78k77k76] = S [k79k78k77k76], [k19k18k17k16k15] = [k19k18k17k16k15] ⊕ roundcounter. Encryption: Each of the 31 rounds in PRESENT includes the following stages: i) addRoundKey: j bj → bj ⊕ Ki , where; j th bj, (0 ≤ j ≤ 63) is the current state bit and Ki , (1 ≤ i ≤ 32, 0 ≤ j ≤ 63) is the j subkey bit of round key Ki . ii) sBoxLayer: This layer consists of 16 parallel versions of a 4-bit to 4-bit S-Box as given in Table 4: X 0 1 2 3 4 5 6 7 8 9 A B C D E F S[x] C 5 6 B 9 0 A D 3 E F 8 4 7 1 2 Table 4: The PRESENT S-Box Table iii) pLayer : This is the bit permutation layer where the bit i is moved to the bit P(i) by the pLayer as given in Table 5: i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 P(i) 0 16 32 48 1 17 33 49 2 18 34 50 3 19 35 51 i 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 P(i) 4 20 36 52 5 21 37 53 6 22 38 54 7 23 39 55 i 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 P(i) 8 24 40 56 9 25 41 57 10 26 42 58 11 27 43 59 i 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 P(i) 12 28 44 60 13 29 45 61 14 30 46 62 15 31 47 63 Table 5: The PRESENT pLayer Table 4 Brief description of Cube Attack Cube attack is a recent type of attack, which falls under the category of algebraic cryptanalysis. In Cube attack, the cryptosystem is considered as a black box [2]. It exploits the fact that the cryptosystem comprises of low-degree equations in which even a single bit of ciphertext or inter-mediary bit can be represented as a low-degree multivariate polynomial of the key and plaintext variables. The attacker is given a black box that evaluates an unknown polynomial p over GF(2) of n + m inputs bits (x1,..,xn,v1,..,vm) and outputs a single bit. The polynomial is assumed to be in Algebraic Normal Form, namely, the sum of products of variables. The input bits x1,..,xn are the secret variables, while v1,..,vm are the public variables. Instead of distinguishing between the secret and public variables, we can denote 2 them by x1,..,xn. Since xi = xi modulo 2, a subset I belonging to the set {1,..,n} of the variables (multiplied together) can be formed, in which the terms tI in the polynomial can be indexed. Given a multivariate polynomial p and any index subset I, we can factor the common subterm tI out of some of the terms in p, and represent the polynomial as the sum of terms which are supersets of I and terms which are not supersets of I: p(x1,..,xn) = tI .