The Block Cipher SQUARE
Total Page:16
File Type:pdf, Size:1020Kb
The Block Cipher SQUARE Joan Daemen 1 Lars Knudsen 2 Vincent Rijmen .2 1 Banksys Haachtesteenweg 1442 B-1130 Brussel, Belgium Daemen. J@banksys. be 2 Katholieke Universiteit Leuven , ESAT-COSIC K. Mercierlaan 94, B-3001 Heverlee, Belgium lars. knudsen@esat, kuleuven, ac. be vincent, rijmen@esat, kuleuven, ac. be Abstract. In this paper we present a new 128-bit block cipher called SQUARE. The original design of SQUARE concentrates on the resistance against differential and linear cryptanalysis. However, after the initial design a dedicated attack was mounted that forced us to augment the number of rounds. The goal of this paper is the publication of the resulting cipher for public scrutiny. A C implementation of SQUARE is available that runs at 2.63 MByte/s on a 100 MHz Pentium. Our M68HC05 Smart Card implementation fits in 547 bytes and takes less than 2 msec. (4 MHz Clock). The high degree of parallellism allows hardware implementations in the Gbit/s range today. 1 Introduction In this paper, we propose the block cipher SQUARE. It has a block length and key length of 128 bits. However, its modular design approach allows extensions to higher block lengths in a straightforward way. The cipher has a new self-reciprocM structure, similar to that of THREEWAY and SHARK [2, 15]. The structure of the cipher, i.e., the types of building blocks and their in- teraction, has been carefully chosen to allow very efficient implementations on a wide range of processors. The specific choice of the building blocks themselves has been led by the resistance of the cipher against differential and linear crypt- analysis. After treating the structure of the cipher and its consequences for im- plementations, we explain the strategies followed to thwart linear and differential cryptanalysis. This is followed by a description of an efficient attack that exploits the particular properties of the cipher structure. We do not encourage anyone to use SQUARE today in any sensitive applic- ation. Clearly, confidence in the security of any cryptographic design must be based on the resistance against effective cryptanalysis after intense public scru- tiny. * F.W.O research assistant, sponsored by the Fund for Scientific Research - Flanders (Belgium). 150 Joan Daemen, Lars Knudsen, Vincent Rijmen A reference implementation of SQUARE is available from the following URL: http://www.esat.kuleuven.ac.be/,.~rij men/square. 2 Structure of SQUARE SQUARE is an iterated block cipher with a block length and a key length of 128 bits each. The round transformation of SQUARE is composed of four distinct transformations. It is however important to note that these four building blocks can be efficiently combined in a single set of table-lookups and exor operations. This will be treated later in the section on implementation aspects. The basic building blocks of the cipher are five different invertible transform- ations that operate on a 4 • 4 array of bytes. The element of a state a in row i and column j is specified as ai,j. Both indexes start from 0. 2.1 A Linear Transformation 0 0 is a linear operation that operates separately on each of the four rows of a state. We have 0 : b = O(a) ~ bi,j = cjai,o 9Cj-lai,1 ~ cj-2ai,2 ~ cj-3ai,3, where the multiplication is in GF(2 s) and the indices of c must be taken modulo 4. Note that the field GF(2 n) has characteristic 2 [9]. This means that the addition in the field corresponds to the bitwise exor. The rows of a state can be denoted by polynomials, i.e., the polynomial cor- responding to row i of a state a is given by ai(x) = ai,o @ ai,lx @ ai,2x2ai,3x 3. Using this notation, and defining c(x) = ~j cjxJ we can describe 0 as a modular polynomial multiplication: b = 6(a) r bi(x) = c(x)ai(x) mod 1 @ x 4 for 0 < i < 4. The inverse of 0 corresponds to a polynomial d(x) given by d(x)c(x) = 1 (mod 1 @ x4). 2.2 A Nonlinear Transformation ~, 7 is a nonlinear byte substitution, identical for all bytes. We have 7 :b = 7(a) r162bi,j = S~(ai,j), with S.~ an invertible 8-bit substitution table or S-box. The inverse of 7 consists of the application of the inverse substitution S~'1 to all bytes of a state. The Block Cipher Square 151 2.3 A Byte Permutation lr The effect of 7r is the interchanging of rows and columns of a state. We have ~r : b = 7r(a) r bi,j = aj,i. ~r is an involution, hence 7r-1 = 7r. 2.4 Bitwise Round Key Addition (r[k t] consists of the bitwise addition of a round key k t. We have cr[kt]: b = ~[kt](a) r b = a G k t. The inverse of cr[k t] is a[k t] itself. 2.5 The Round Key Evolution r The round keys k t are derived from the cipher key K in the following way. k ~ equals the cipher key K. The other round keys are derived iteratively by means of the invertible affine transformation r ~) : k t _- r t-l) 2.6 The Cipher SQUARE The building blocks are composed into the round transformation denoted by p[kt]: p[k ~1 = ~[k ~] o ~ o ~, o 0 (1) SQUARE is defined as eight rounds preceeded by a key addition cr[k~ and by 0-1: SQUARE [k] ~.~p[k 8 ] op[k 7] op[k 6] op[k 5] op[k 4] op[k 3] op[k 2]op[k ~] o c[k ~ o 0 -1 (~) 2.7 The Inverse Cipher As will be shown in Section 9, the structure of SQUARE lends itself to efficient implementations. For a number of modes of operation it is important that this is also the case for the inverse cipher. Therefore, SQUARE has been designed in such a way that the structure of its inverse is equal to that of the cipher itself, with the exception of the key schedule. Note that this identity in structure differs from the identity of components and structure in IDEA [10]. From (2) it can be seen that SQUARE-IN = o o ~-l[k~ p-ilk1] o p-ilk2] o p-~[k 3] o p-~[k 4] o p-1[k5] 0 p-l[k6] 0 p-1[kT] o p-l[kS] 152 Joan Daemen, Lars Knudsen, Vincent Rijmen --I 7~ I---11---I r---q I[., lII F~F-1F-I~ I [ s[a] [ s[.] F~F~ F-1F-1F-l~1 [,S[.] s[.] F~F~ 1 [s[.] s[.] F~F~ F-1F 1F-I~ 1 s[.] s[.] F~F~ a b C I Fig. 1. Geometrical representation of the basic operations of SQUARE. 8 consists of 4 parallel linear diffusion mappings. 3' consists of 16 separate substitutions. 7r is a transposition. The Block Cipher Square 153 with p-l[ktl --'z O-l o T-l o ff-l o o'-l[kt] --:0-1o7-1 o Tr o o[k t] (3) It may seem that the structure of the inverse cipher differs substantially from that of the cipher itself. By exploiting some algebraic properties of the building blocks, we can show this not to be the case. Since ~r only transposes the bytes ai,j and 7 only operates on the individual bytes, independent of their position (i, j), we have 7--10ff: ffO,~ -1. Moreover, since O-1(a) ~ k t = ~-l(a + ~(kt)), we have O'[k t] o 0 -1 -~ 0 -1 o o'[O(kt)], We now define the round transformation of the inverse cipher as p'[kt] = ~[kt] o ~ o 7 -1 o O-1, (4) which has the same structure as p itself, except that 7 and 0 are replaced by 7-1 and 0 -1 respectively. Using the algebraic properties above, we can derive 0 o ~[k ~ op-l[kl] = 0 o ~[k ~ o0 -1 o7 -1 o ~o ~[k 1] = 0 o O-1 o ~[0(k~ o ~ o V-1 o ~[k 1] = ~[0(k~ o ~ 07-' o ~[k 1] = ~[0(k~ o ~ o 7 -1 o ~[k 1] o 0 -1 o 0 = ~[0(k~ o ~ o 7 -1 o 0 -1 o ~[0(kl)] o 0 = d[0(k~ o ~[0(kl)] o 0 This equation can be generalized in a straightforward way to include more than one round. Now, with ~t = a(ks-t), we have SQUARE -1 : o d[[] o 6] o o 4] o o o 1] o o 0 Hence the inverse cipher is equal to the cipher itself with 7 replaced by 7 -1 , with 0 by tg-1 and different round key values. 2.8 First round The t9-1 before a[k ~ in SQUARE can be incorporated in the first round. We have p[k 1] o ~[k ~ o 0 -1 = ~[k 11 o ~ o 7 o 0 o ~[k ~ o e -1 = ~[k 11 ~ ~ ~ V ~ ~[0(k~ Hence the initial tg-1 can be discarded by omitting t9 in the first round and applying O(k ~ instead of k ~ The same simplification can be applied to the inverse cipher. 154 Joan Daemen, Lars Knudsen, Vincent Rijmen 3 Linear and Differential Cryptanalysis The resistance against linear cryptanalysis [12] and differential cryptanalysis [1] has been the rationale behind the criteria by which the S~ substitution and the multiplication polynomial e(x) have been chosen. A difference propagation along the rounds of an iterated block cipher is gener- ally called a differential characteristic.