Analysis of the Non-Linear Part of Mugi
Total Page:16
File Type:pdf, Size:1020Kb
Analysis of the Non-linear Part of Mugi Alex Biryukov1, and Adi Shamir2 1 Katholieke Universiteit Leuven, Dept. ESAT/SCD-COSIC, Kasteelpark Arenberg 10, B–3001 Heverlee, Belgium http://www.esat.kuleuven.ac.be/∼abiryuko/ 2 Department of Applied Mathematics and Computer Science, Weizmann Institute of Science, Rehovot 76100, Israel [email protected] Abstract. This paper presents the results of a preliminary analysis of the stream cipher Mugi. We study the nonlinear component of this cipher and identify several potential weaknesses in its design. While we can not break the full Mugi design, we show that it is extremely sensitive to small variations. For example, it is possible to recover the full 1216-bit state of the cipher and the original 128-bit secret key using just 56 words of known stream and in 214 steps of analysis if the cipher outputs any state word which is different than the one used in the actual design. If the linear part is eliminated from the design, then the secret non- linear 192-bit state can be recovered given only three output words and in just 232 steps. If it is kept in the design but in a simplified form, then the scheme can be broken by an attack which is slightly faster than exhaustive search. Keywords: Cryptanalysis, Stream ciphers, Mugi. 1 Introduction Mugi is a fast 128-bit key stream cipher [4] designed for efficient software and hardware implementations (achieves speeds which are 2-3 times faster than Rijndael in hardware and slightly faster in software). The cipher was selected for standardization by the Japanese government project CRYPTREC and is also one of the two proposed ISO stream cipher standards. Previous analysis of Mugi given by its designers in [1] concentrated on linear cryptanalysis and resynchronization attacks. A recent work by Golic [3] studied This author’s work was supported in part by the Concerted Research Action (GOA) Mefisto 2000/06 and Ambiorix 2005/11 of the Flemish Government and in part by the European Commission through the IST Programme under Contract IST-2002- 507932 ECRYPT. The information in this document reflects only the author’s views, is provided as is and no guarantee or warranty is given that the information is fit for any particular purpose. The user thereof uses the information at its sole risk and liability. H. Gilbert and H. Handschuh (Eds.): FSE 2005, LNCS 3557, pp. 320–329, 2005. c International Association for Cryptologic Research 2005 Analysis of the Non-linear Part of Mugi 321 only the linear component of the cipher. No security flaw of the full cipher has been reported so far. In this paper we study the non-linear component of this cipher, and identify several potential weaknesses in its design. However we do not make any claim as to the security of the full Mugi which remains unbroken. This paper is organized as follows: in Sect. 2 we describe the cipher Mugi, in Sect. 3 we describe two attacks on its non-linear component, and Sect. 4 concludes the paper. 2 Description of Mugi The design of Mugi is based on the design philosophy proposed by J. Daemen and C. Clapp in their stream cipher Panama [2]. The internal state of the cipher at time t consists of two parts: a linearly changed large buffer b(t), and a non- linearly evolving shorter state a(t). See Fig. 1 for a schematic description. The Output (t) (t) Buffer b State a λ ρ Fig. 1. The evolution of the Mugi state cipher works in steps called rounds. At each round the internal state is updated and one of its three 64-bit words is produced as output. The evolution of the buffer which consists of sixteen 64-bit words happens in a LFSR-like slow fashion, together with a 64-bit feedback from the nonlinear state at each round: b(t+1) = λ(b(t),a(t)), or more explicitly: b(t+1) b(t) j , , j = j−1( =0 4 10) b(t+1) b(t) ⊕ a(t) 0 = 15 0 b(t+1) b(t) ⊕ b(t) 4 = 3 7 b(t+1) b(t) ⊕ b(t) ≪ 10 = 9 ( 13 32) The evolution of the state a(t) is essentially a block cipher-like invertible process, in which two 64-bit words coming from the buffer are used as subkeys: 322 A. Biryukov and A. Shamir Buffer S S S S S S S S MDS MDS Fig. 2. The F-function a(t+1) = ρ(a(t),b(t)), or more explicitly: (t+1) (t) a0 = a1 (t+1) (t) (t) (t) a1 = a2 ⊕ F (a1 ,b4 ) ⊕ C1 (t+1) (t) (t) (t) a2 = a0 ⊕ F (a1 ,b10 ≪ 17) ⊕ C2 , where C1,C2 are known constants. The F function reuses an S-box and MDS of the AES as shown in Fig. 2. The output function of Mugi is very simple: Output t a(t), [ ]= 2 i.e. one of the three 64-bit words in the internal state is given as output prior to the evaluation of the round t. 3 Cryptanalysis of the Two Variants of Mugi In this section we cryptanalyse several variants of Mugi. 3.1 Change in the Output Function Mugi a(t) tth The output function of outputs the 64-bit word 2 before the round. In this section we show that Mugi is very sensitive to small changes in the a(t) output function. For example, if the output would consist of the same word 2 after t a(t+1) but the evaluation of the round (or equivalently the word 1 ), then the full cipher could be easily broken with practical complexity. In general, for any choice of a output word other than the one used in the actual design (i.e., a(t) a(t) either 0 or 1 ) the cipher can be easily broken. Analysis of the Non-linear Part of Mugi 323 α, β, γ, δ, a(t) We denote by the Greek letters an intermediate value 1 which is used as the input to the two F -functions in each round. Suppose that Output[t]= a(t) 1 . Let us make several important observations. The first observation is that a(t) a(t+1) 1 = 0 and thus we know the word that updates the buffer at each round. This would allow us to run the buffer update function λ(·) symbolically and write linear equations for the buffer bits, including those that enter the non-linear ρ a(t) function as ”sub-keys”. The second observation is that the word 1 is used as the input to both F -functions of the round. The final observation is that we can write the following equation: α ⊕ δ F β,b(t+1)≪ ⊕ F γ,b(t+2) . = ( 10 17) ( 4 ) (1) In this equation α, β, γ and δ are words from the output stream and are thus known to the attacker (see also Fig. 3). Let us denote the inverse of the MDS α (t) (t) b10 b 4 (t) α a 0 F F (t+1) (t+1) b10 b 4 (t+1) β a 0 F F (t+2) (t+2) b10 b 4 γ a (t+2) 0 F F δ δ Fig. 3. The attack path and the byte swap layers by M −1 and the eight S-box layer by S. By applying the inverse of the linear layer of F to both sides of the equation we can get the simplified equation: M −1 α ⊕ δ S β ⊕ b(t+1)≪ ⊕ S γ ⊕ b(t+2) . ( )= ( ( 10 17)) ( 4 ) (2) which decomposes into 8 independent equations in the 8 bit values of each S-box. One of the possible ways to use this equation is to look for points in the output stream in which at least one of the bytes of M −1(α ⊕ δ) is zero. For a particular S-box this would lead to a simpler equation: 324 A. Biryukov and A. Shamir S β ⊕ b(t+1)≪ S γ ⊕ b(t+2) , ( ( 10 17)) = ( 4 ) (3) which further simplifies to: b(t+1)≪ ⊕ b(t+2) β ⊕ γ. ( 10 17) 4 = (4) This is an 8-bit linear constraint on the bits of the buffer. It is sufficient to gather about 1024/8 = 128 such equations in order to get a system of linear equations for all the buffer bits. The probability that at least one zero value occurs in each 64-bit block is 1 − (1 − 1/256)8 ≈ 2−5. Thus given about 25 · 128 = 212 output words the attacker would expect to obtain a solvable system of equations and reconstruct the full 1024-bit buffer. Knowing the buffer at some round t and the a(t−1),a(t),a(t+1) a(t) output words 1 1 1 the attacker can recover the state as follows: a(t),a(t),a(t) a(t−1),a(t),F a(t),b(t) ⊕ a(t+1) . ( 0 1 2 )=( 1 1 ( 1 4 ) 1 ) Since all the steps in the cipher are invertible, knowing the buffer and the state at some point t enables the attacker to run the cipher both forwards and backwards. By running the cipher backwards the attacker can recover the initial 128-bit secret key. The total complexity of this attack is O(212) words of known stream (about 215 bytes) and O(230) steps to solve a system of 210 equations. The same attack Output t a(t) would work for the case [ ]= 0 .