# A Secure Implementation of a Symmetric Encryption Algorithm in White-Box Attack Contexts

Authors: Yang Shi; Qin Liu; Qinpei Zhao
Journal: Journal of Applied Mathematics
 (2013)

---

## Abstract

In a white-box context, an adversary has total visibility of the implementation of the cryptosystem and full control over its execution platform. As a countermeasure against the threat of key compromise in this context, a new secure implementation of the symmetric encryption algorithm SHARK is proposed. The general approach is to merge several steps of the round function of SHARK into table lookups, blended by randomly generated mixing bijections. We prove the soundness of the implementation of the algorithm and analyze its security and efficiency. The implementation can be used in web hosts, digital right management devices, and mobile devices such as tablets and smart phones. We explain how the design approach can be adapted to other symmetric encryption algorithms with a slight modification.


---

## Body

## 1. Introduction

There are three main models of the capability of an adversary to attack a cryptosystem [1]. First is the black-box model. It is a traditional attack model where an adversary only has access to the input and corresponding output of a cryptosystem. The limited information available means that an attack is usually difficult and time consuming. The second model is the grey-box model, where a leakage function is present. In such an attack model, the adversary can deploy side-channel cryptanalysis techniques. Several grey-box models can be defined because of the large variety of leakage functions. Third is the white-box model where the adversary has total visibility of the cryptographic software implementation and full control over its execution. One could refer to the white-box model as the worst-case model. The white-box model is used to analyze algorithms that are running in an untrustworthy environment, that is, an environment in which applications are subject to attacks from the execution platform.Typical white-box attack contexts include(1)
a server or PC that an attacker has got the “root” or “admin” privilege of it,(2)
a mobile agent that is running on a malicious host,(3)
an attacker has control of an outdoor wireless sensor network node,(4)
digital right management (DRM) components in cable television applications.Secure computing in a white-box attack context (WABC) is a challenge because, as discussed in [2, 3], (1) fully-privileged attack software shares a host with cryptographic software and has complete access to the implementation of algorithms, (2) dynamic execution (with instantiated cryptographic keys) can be observed, and (3) internal details of cryptographic algorithms are both completely visible and alterable.Standard design and implementation of symmetric encryption algorithms were not intended to operate in a white-box attack context where their execution could be observed. In fact, cryptographic models usually assume that endpoints, hosts, and hardware protection tokens are to be trusted. This is not the case in a white-box attack. By actively monitoring standard cryptographic functions or memory dumps, an attacker can even extract the cryptographic keys. This is extremely dangerous when using a symmetric encryption scheme because the decryption algorithm uses the same key as the encryption algorithm.In response to this security challenge, we propose a new, secure, and white-box implementation of a symmetric encryption algorithm that reduces the risk of keys being compromised. Note that the terms “white-box encryption algorithm” and “white-box implementation of an encryption algorithm” are used interchangeably throughout the paper.The remainder of this article is organized as follows. Section2 describes recent advances in white-box cryptography. A new white-box symmetric encryption algorithm is proposed in Section 3, followed by a security analysis in Section 4. Section 5 analyzes the complexity and performance of the new algorithm and includes a suggested implementation approach and some experimental results. In Section 6 we conclude with a discussion of our findings and ideas for future research.


## 2. Recent Advances in White-Box Cryptography

White-box cryptography provides protection to software implementations of encryption algorithms that may be executed on an untrustworthy host or other white-box attack contexts. The main constraint is that the result must be directly executable. Chow et al. introduced this idea and proposed a white-box implementation of DES by interleaving affine transformations and using delinearization techniques [2]. Chow et al. also introduced a white-box implementation of AES, representing it with a set of key-dependent look-up tables [3]. Their original proposal is that these two algorithms could be used in digital rights management (DRM) applications to satisfy the need to protect digital information content from unauthorized access, use, and dissemination.In [4], Jacob et al. proposed that a fault injection attack, where an attacker injects errors into the program environment during execution, could defeat some obfuscation methods. They presented a cryptanalysis of a variant of the algorithm in [2] that does not have external encodings. Link and Neumann implemented white-box DES and triple-DES algorithms along the lines of Chow et al., with alterations that improved the security of the key [5]. Their system is secure against the previously published attacks on the implementation of Chow et al. and their own adaptation of a statistical bucketing attack. In 2007, Wyseur et al. [6] and Goubin et al. [7] independently cryptanalyzed all existing obfuscation methods of DES. Both attacks were based on a truncated differential cryptanalysis. Goubin et al. presented an attack that analyzed the first rounds of the white-box DES implementations, while Wyseur et al. presented an attack that works on the internal information.In [8], Billet et al. presented an efficient and practical attack against the obfuscated AES implementation proposed by Chow et al. in [3]. It used negligible memory and had the worst time complexity of 230. In 2009, Michiels et al. improved the attack so that it could be deployed on a generic class of white-box implementations [9]. In 2011, Karroumi proposed a new white-box implementation that uses dual representations of AES [10]. Karroumi claimed that the time complexity of Billet et al.’s attack against his white-box AES is 291. Furthermore, even with the more powerful attack tool [11] proposed by Tolhuizen last year, the expected time complexity of Billet et al.’s attack remains 281.In [12], Xiao and Lai proposed a secure implementation of white-box AES after a detailed analysis of the attack technique in [8] on the AES implementation proposed in [3]. In their scheme, the obfuscation works on at least two cells of an AES state, which the attacker cannot divide them into small ones and remove them using the attack technique proposed in [8]. The time complexity of Xiao and Lai’s white-box AES implementation is 224. It is slower than Chow et al.’s implementation, which has a time complexity of 220 [3]. Furthermore, the size of Xiao and Lai’s white-box AES implementation is 20502 KB. In 2012, Mulder et al. [13] presented a cryptanalysis of a white-box AES implementation, based on Xiao and Lai’s idea. They applied the linear equivalence algorithm presented by Biryukov et al. in [14] as a building block. The cryptanalysis efficiently extracts the AES key with a work factor of approximately 232. Furthermore, the size of Xiao and Lai’s implementation still has potential to be improved.


## 3. A Novel White-Box Symmetric Encryption Algorithm

In this section, we propose a new white-box symmetric encryption algorithm based on SHARK [15]. Our general approach is to merge several steps of each round function of SHARK into table lookups, blending by randomly generated mixing bijections. We use techniques from [10, 12] to obtain the obfuscated implementation.


### 3.1. The Symmetric Encryption Algorithm, SHARK

SHARK is a six round substitution permutation-network that alternates a key mixing stage with linear and nonlinear transformation layers. We can split each round of the SHARK algorithm into three distinct layers: a nonlinear layer of substitution boxes, a diffusion layer, and a key addition layer. An interpolation attack can break the five rounds of a modified version of SHARK [16], but the security of the six round SHARK cipher is acceptable for many applications.LetS:GF(28)→GF(28),x↦S[x] denote the mapping of S-boxes. Then the nonlinear layer can be defined as γ:GF(28)8→GF(28)8, γ(a)=b⇔bi=S[ai],0≤i≤7.Letλ:GF(28)8→GF(28)8 be the linear transformation corresponding to the diffusion layer. Then there exists a matrix H such that λ(a)=b⇔b=a·H.Furthermore, letKr be the round key of the rth round and let σ[Kr]:GF(28)8→GF(28)8 be the key addition mapping.Now, the symmetric encryption algorithm SHARK with encryption keyK is defined as follows:
(1)SHARK[K]=λ-1∘(∘r=16σ[Kr]∘λ∘γ)∘σ[K0].


### 3.2. Components of the White-Box Encryption Algorithm

To hide the encryption key, we must merge several steps of each round function of SHARK into table lookups blended by randomly generated mixing bijections. In this section, we investigate how to design such tables and how randomly generated mixing bijections can be counteracted.BecauseSHARK[K]=λ-1∘(6∘σ[Kr]∘λ∘γr=1)∘σ[K0]λ-1∘σ[K6]∘(5∘λ∘γ∘σ[Kr]r=0), we can also define the algorithm as
(2)SHARK[K]=λ-1∘σ[K6]∘(∘r=05ρ[Kr]),
where ρ[Kr] is the round function of the rth round with round key Kr defined as
(3)ρ[Kr]≡λ∘γ∘σ[Kr].
The flow of SHARK depicted in (2) and (3) is shown in Figure 1.Figure 1
Flow of the SHARK algorithm.LetMr be a 64 × 64 nonsingular matrix over GF(2), defined for r=1,…,6 as
(4)Mr=(Nr-1)-1[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1],
where Nr, r=0,…,6 are randomly generated 64×64 nonsingular matrices over GF(2).The external input encoding,U, is a 64×64 nonsingular matrix over GF(2) defined as
(5)U=[(Q0,0)-1(Q0,1)-1(Q0,2)-1(Q0,3)-1],
where Qr,i, r=1,…,6, i=0,…,3 are randomly generated 16×16 nonsingular matrices over GF(2). The external output encoding V=(N6)-1 is also a 64×64 nonsingular matrix over GF(2).In a white-box encryption algorithm, round functions should be obfuscated to protect the round keys against attacks from an adversary. Using the definitions above, we can define the obfuscated round functions, which we will implement using a set of tables (T-Boxes). For each round, r, let the obfuscated subround function be ρW[r,i,k]:GF(28)2→GF(28)8,i=0,1,2,3.The number of possible different representations ofGF(216) is 8160. The isomorphic transformation Δ that takes the description of the cipher under the standard irreducible polynomial to another description with a different irreducible polynomial is linear. For each round r, Δr is chosen randomly from these isomorphic transformations.Let(6)Li0=Δ0∘(·Q0,i);i=0,1,2,3,Lir=Δr∘Δr-1-1∘(·Qr,i),r=1,…,6;i=0,…,3
be preround mixing bijections.Let(7)Pr=(Δr(H))·Nr=def[P0rP1rP2rP3r],r=0,…,5,P6=(Δ6(H-1))·N6=def[P06P16P26P36]
be postround diffusion-mixing bijections.Then, we can write the obfuscated subround functions as(8)ρW[r,i,K](x)=((S∥S)Δr((Lir(x))⊕(Δr(k2ir∥k2i+1r))))Pirr=0,…,5;i=0,…,3,ρW[6,i,K](x)=((Li6(x))⊕(Δ6(k2i6∥k2i+16)))Pi6,i=0,…,3,
where S∥S refers to two S-boxes operating in parallel and (S∥S)Δr:GF(28)2→GF(28)2,x↦Δr((S∥S)(Δr-1(x))).To invert the effect of the postround mixing matricesPr-1,i, r=1,…,6, i=0,…,3 and the preround mixing matrices Qr,i, r=0,…,5, i=0,…,3, a left multiplication of the matrix Mr+1 is added at the end of each of rounds 0 to 5.The data flows of our obfuscated implementation of round functions are shown in Figures2 and 3.Figure 2
Data flow of the standard and the obfuscated implementation of the round functions for rounds 0 to 5.Figure 3
Data flow of the standard and the obfuscated implementation of round 6.As shown in Figure3, the T-Boxes of the last round are lookup tables corresponding to the subround functions ρW[6,i,K](x)=((Li6(x))⊕(Δ6(k2i6∥k2i+16)))Pi6, i=0,…,3. The nonlinear S-Boxes of other rounds have been removed. In fact, the T-Boxes of the last round are affine transformations ρW[6,i,K](x)=(Li6(x)Pi6)⊕((Δ6(k2i6∥k2i+16))Pi6), i=0,…,3. Clearly, this is dangerous, and so we modify the last round of SHARK as illustrated in Figure 4. Consequently, the T-Boxes of the last round should be ρW[6,i,K](x)=((S∥S)Δ6((Li6(x))⊕(Δ6(k2i6∥k2i+16))))Pi6, i=0,…,3. We call this modified version SHARK′[K]. Now, SHARK[K]=(·H-1)∘(S8-1)∘(·H)∘SHARK′[K] where
(9)S8=||k=07SΔ6.Modification of the last round of SHARK.
(a)
The last round of SHARK
(b)
The modified last round of SHARK


### 3.3. The Complete White-Box Encryption Algorithm

Using the components described in the previous section, the encryption process is shown in Algorithm1.Algorithm 1:Algorithm SHARKW[K](oninputx).
(1)i←0
(2)(x0,x1,x2,x3)←x
(3)j←0
(4)yj←TBoxi,j(xj)//LookupinaTBox
(5)j←j+1
(6)     if(j<4) goto (4); else goto (7)
(7)x←y0⊕y1⊕y2⊕y3
(8)   if(i<7) goto (9); else goto (11)
(9)x←x·Mi
(10) i←i+1; goto (2)
(11) outputxWe will now prove the soundness of our algorithm.Proposition 1.
The encryption algorithmSHARKW[K] is such that
(10)G∘SHARKW[K]∘F=SHARK[K],
where
(11)SHARK[K]=λ-1∘σ[K6]∘(∘r=05ρ[Kr]),F=(·U)∘(Δ0-1∥Δ0-1∥Δ0-1∥Δ0-1),G=(·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1)∘(·V).Proof.
Letx=(x0,x1,x2,x3), xi∈GF(2)16, i=0,1,2,3 be the input to the first round of G∘SHARKW[K]∘F. Then
(12)(∑i=03ρW[0,i,K]((Δ0-1(xi))·(Q0,i)-1))·M1=(∑i=03((S∥S)Δ0((Li0((Δ0-1(xi))·(Q0,i)-1))⊕(Δ0(k2i0∥k2i+10))))Pi0)·M1=(∑i=03(((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10)))(S∥S)Δ0×((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10))))×Pi0((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10))))·M1=(∑i=03Δ0((S∥S)(xi⊕(k2i0∥k2i+10))))·(Δ0(H))·N0·M1=((Δ0∥Δ0∥Δ0∥Δ0)(ρ[K0](x)))·N0·(N0)-1·[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1]=((Δ0∥Δ0∥Δ0∥Δ0)(ρ[K0](x)))·[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1],
where the round transformation ρ is defined in (3). We arrive at the last round by similar deductions on the previous rounds.
Lety=(5∘ρ[Kr]r=0)(x)=(y0,y1,y2,y3), yi∈GF(2)16, i=0,1,2,3 and define z to be the output of the fifth round of G∘SHARKW[K]∘F; that is,
(13)z=(((Δ5∥Δ5∥Δ5∥Δ5)∘(5∘r=0ρ[Kr]))(x))·[(Q5,0)-1(Q5,1)-1(Q5,2)-1(Q5,3)-1]=((Δ5∥Δ5∥Δ5∥Δ5)(y))·[(Q5,0)-1(Q5,1)-1(Q5,2)-1(Q5,3)-1]=((Δ5(y0))·(Q5,0)-1,(Δ5(y1))·(Q5,1)-1,(Δ5(y2))·(Q5,2)-1,(Δ5(y3))·(Q5,3)-1)=(z0,z1,z2,z3),zi∈GF(2)16,i=0,1,2,3.
Letρ[K6]=λ-1∘γ∘σ[K6]. The last round of G∘SHARKW[K]∘F works on the output of previous round as follows:
(14)G(∑i=03ρW[6,i,K](zi))=G(∑i=03((S∥S)Δ6((Li6((Δ5(yi))·(Q5,i)-1))⊕(Δ0(k2i6∥k2i+16))))Pi6)=G(∑i=03((S∥S)Δ6((Δ6(yi))⊕(Δ6(k2i6∥k2i+16))))Pi6)=G((∑i=03Δ6((S∥S)(yi⊕(k2i0∥k2i+10))))·(Δ6(H-1))·N6(∑i=03Δ6((S∥S)(yi⊕(k2i0∥k2i+10)))))=G(((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))·N6)=((·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1)∘(·V))×(((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))·N6)=((·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1))×((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))=((·H-1)∘(S8)-1∘(·H))(ρ[K6](y))=(λ-1∘σ[K6])(y)=(λ-1∘σ[K6]∘(∘r=05ρ[Kr]))(x)=SHARK[K](x).
This ends the proof.The following corollary shows how to decrypt the output ofSHARKW[K] by modifying, the decryption process of SHARK, that is, SHARK-1[K].Corollary 2.
The previously described encryption algorithm,SHARKW[K], can be decrypted using
(15)SHARKW[K]-1=F∘SHARK-1[K]∘G.Proof.
By Proposition1, G∘SHARKW[K]∘F=SHARK[K]. Hence,
(16)SHARKW[K]=G-1∘SHARK[K]∘F-1,SHARKW[K]-1=(G-1∘SHARK[K]∘F-1)-1=F∘SHARK[K]-1∘G=F∘SHARK-1[K]∘G.
This ends the proof.


## 3.1. The Symmetric Encryption Algorithm, SHARK

SHARK is a six round substitution permutation-network that alternates a key mixing stage with linear and nonlinear transformation layers. We can split each round of the SHARK algorithm into three distinct layers: a nonlinear layer of substitution boxes, a diffusion layer, and a key addition layer. An interpolation attack can break the five rounds of a modified version of SHARK [16], but the security of the six round SHARK cipher is acceptable for many applications.LetS:GF(28)→GF(28),x↦S[x] denote the mapping of S-boxes. Then the nonlinear layer can be defined as γ:GF(28)8→GF(28)8, γ(a)=b⇔bi=S[ai],0≤i≤7.Letλ:GF(28)8→GF(28)8 be the linear transformation corresponding to the diffusion layer. Then there exists a matrix H such that λ(a)=b⇔b=a·H.Furthermore, letKr be the round key of the rth round and let σ[Kr]:GF(28)8→GF(28)8 be the key addition mapping.Now, the symmetric encryption algorithm SHARK with encryption keyK is defined as follows:
(1)SHARK[K]=λ-1∘(∘r=16σ[Kr]∘λ∘γ)∘σ[K0].


## 3.2. Components of the White-Box Encryption Algorithm

To hide the encryption key, we must merge several steps of each round function of SHARK into table lookups blended by randomly generated mixing bijections. In this section, we investigate how to design such tables and how randomly generated mixing bijections can be counteracted.BecauseSHARK[K]=λ-1∘(6∘σ[Kr]∘λ∘γr=1)∘σ[K0]λ-1∘σ[K6]∘(5∘λ∘γ∘σ[Kr]r=0), we can also define the algorithm as
(2)SHARK[K]=λ-1∘σ[K6]∘(∘r=05ρ[Kr]),
where ρ[Kr] is the round function of the rth round with round key Kr defined as
(3)ρ[Kr]≡λ∘γ∘σ[Kr].
The flow of SHARK depicted in (2) and (3) is shown in Figure 1.Figure 1
Flow of the SHARK algorithm.LetMr be a 64 × 64 nonsingular matrix over GF(2), defined for r=1,…,6 as
(4)Mr=(Nr-1)-1[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1],
where Nr, r=0,…,6 are randomly generated 64×64 nonsingular matrices over GF(2).The external input encoding,U, is a 64×64 nonsingular matrix over GF(2) defined as
(5)U=[(Q0,0)-1(Q0,1)-1(Q0,2)-1(Q0,3)-1],
where Qr,i, r=1,…,6, i=0,…,3 are randomly generated 16×16 nonsingular matrices over GF(2). The external output encoding V=(N6)-1 is also a 64×64 nonsingular matrix over GF(2).In a white-box encryption algorithm, round functions should be obfuscated to protect the round keys against attacks from an adversary. Using the definitions above, we can define the obfuscated round functions, which we will implement using a set of tables (T-Boxes). For each round, r, let the obfuscated subround function be ρW[r,i,k]:GF(28)2→GF(28)8,i=0,1,2,3.The number of possible different representations ofGF(216) is 8160. The isomorphic transformation Δ that takes the description of the cipher under the standard irreducible polynomial to another description with a different irreducible polynomial is linear. For each round r, Δr is chosen randomly from these isomorphic transformations.Let(6)Li0=Δ0∘(·Q0,i);i=0,1,2,3,Lir=Δr∘Δr-1-1∘(·Qr,i),r=1,…,6;i=0,…,3
be preround mixing bijections.Let(7)Pr=(Δr(H))·Nr=def[P0rP1rP2rP3r],r=0,…,5,P6=(Δ6(H-1))·N6=def[P06P16P26P36]
be postround diffusion-mixing bijections.Then, we can write the obfuscated subround functions as(8)ρW[r,i,K](x)=((S∥S)Δr((Lir(x))⊕(Δr(k2ir∥k2i+1r))))Pirr=0,…,5;i=0,…,3,ρW[6,i,K](x)=((Li6(x))⊕(Δ6(k2i6∥k2i+16)))Pi6,i=0,…,3,
where S∥S refers to two S-boxes operating in parallel and (S∥S)Δr:GF(28)2→GF(28)2,x↦Δr((S∥S)(Δr-1(x))).To invert the effect of the postround mixing matricesPr-1,i, r=1,…,6, i=0,…,3 and the preround mixing matrices Qr,i, r=0,…,5, i=0,…,3, a left multiplication of the matrix Mr+1 is added at the end of each of rounds 0 to 5.The data flows of our obfuscated implementation of round functions are shown in Figures2 and 3.Figure 2
Data flow of the standard and the obfuscated implementation of the round functions for rounds 0 to 5.Figure 3
Data flow of the standard and the obfuscated implementation of round 6.As shown in Figure3, the T-Boxes of the last round are lookup tables corresponding to the subround functions ρW[6,i,K](x)=((Li6(x))⊕(Δ6(k2i6∥k2i+16)))Pi6, i=0,…,3. The nonlinear S-Boxes of other rounds have been removed. In fact, the T-Boxes of the last round are affine transformations ρW[6,i,K](x)=(Li6(x)Pi6)⊕((Δ6(k2i6∥k2i+16))Pi6), i=0,…,3. Clearly, this is dangerous, and so we modify the last round of SHARK as illustrated in Figure 4. Consequently, the T-Boxes of the last round should be ρW[6,i,K](x)=((S∥S)Δ6((Li6(x))⊕(Δ6(k2i6∥k2i+16))))Pi6, i=0,…,3. We call this modified version SHARK′[K]. Now, SHARK[K]=(·H-1)∘(S8-1)∘(·H)∘SHARK′[K] where
(9)S8=||k=07SΔ6.Modification of the last round of SHARK.
(a)
The last round of SHARK
(b)
The modified last round of SHARK


## 3.3. The Complete White-Box Encryption Algorithm

Using the components described in the previous section, the encryption process is shown in Algorithm1.Algorithm 1:Algorithm SHARKW[K](oninputx).
(1)i←0
(2)(x0,x1,x2,x3)←x
(3)j←0
(4)yj←TBoxi,j(xj)//LookupinaTBox
(5)j←j+1
(6)     if(j<4) goto (4); else goto (7)
(7)x←y0⊕y1⊕y2⊕y3
(8)   if(i<7) goto (9); else goto (11)
(9)x←x·Mi
(10) i←i+1; goto (2)
(11) outputxWe will now prove the soundness of our algorithm.Proposition 1.
The encryption algorithmSHARKW[K] is such that
(10)G∘SHARKW[K]∘F=SHARK[K],
where
(11)SHARK[K]=λ-1∘σ[K6]∘(∘r=05ρ[Kr]),F=(·U)∘(Δ0-1∥Δ0-1∥Δ0-1∥Δ0-1),G=(·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1)∘(·V).Proof.
Letx=(x0,x1,x2,x3), xi∈GF(2)16, i=0,1,2,3 be the input to the first round of G∘SHARKW[K]∘F. Then
(12)(∑i=03ρW[0,i,K]((Δ0-1(xi))·(Q0,i)-1))·M1=(∑i=03((S∥S)Δ0((Li0((Δ0-1(xi))·(Q0,i)-1))⊕(Δ0(k2i0∥k2i+10))))Pi0)·M1=(∑i=03(((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10)))(S∥S)Δ0×((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10))))×Pi0((Δ0((Δ0-1(xi))·(Q0,i)-1·Q0,i))⊕(Δ0(k2i0∥k2i+10))))·M1=(∑i=03Δ0((S∥S)(xi⊕(k2i0∥k2i+10))))·(Δ0(H))·N0·M1=((Δ0∥Δ0∥Δ0∥Δ0)(ρ[K0](x)))·N0·(N0)-1·[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1]=((Δ0∥Δ0∥Δ0∥Δ0)(ρ[K0](x)))·[(Qr,0)-1(Qr,1)-1(Qr,2)-1(Qr,3)-1],
where the round transformation ρ is defined in (3). We arrive at the last round by similar deductions on the previous rounds.
Lety=(5∘ρ[Kr]r=0)(x)=(y0,y1,y2,y3), yi∈GF(2)16, i=0,1,2,3 and define z to be the output of the fifth round of G∘SHARKW[K]∘F; that is,
(13)z=(((Δ5∥Δ5∥Δ5∥Δ5)∘(5∘r=0ρ[Kr]))(x))·[(Q5,0)-1(Q5,1)-1(Q5,2)-1(Q5,3)-1]=((Δ5∥Δ5∥Δ5∥Δ5)(y))·[(Q5,0)-1(Q5,1)-1(Q5,2)-1(Q5,3)-1]=((Δ5(y0))·(Q5,0)-1,(Δ5(y1))·(Q5,1)-1,(Δ5(y2))·(Q5,2)-1,(Δ5(y3))·(Q5,3)-1)=(z0,z1,z2,z3),zi∈GF(2)16,i=0,1,2,3.
Letρ[K6]=λ-1∘γ∘σ[K6]. The last round of G∘SHARKW[K]∘F works on the output of previous round as follows:
(14)G(∑i=03ρW[6,i,K](zi))=G(∑i=03((S∥S)Δ6((Li6((Δ5(yi))·(Q5,i)-1))⊕(Δ0(k2i6∥k2i+16))))Pi6)=G(∑i=03((S∥S)Δ6((Δ6(yi))⊕(Δ6(k2i6∥k2i+16))))Pi6)=G((∑i=03Δ6((S∥S)(yi⊕(k2i0∥k2i+10))))·(Δ6(H-1))·N6(∑i=03Δ6((S∥S)(yi⊕(k2i0∥k2i+10)))))=G(((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))·N6)=((·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1)∘(·V))×(((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))·N6)=((·H-1)∘(S8)-1∘(·H)∘(Δ6-1∥Δ6-1∥Δ6-1∥Δ6-1))×((Δ6∥Δ6∥Δ6∥Δ6)(ρ[K6](y)))=((·H-1)∘(S8)-1∘(·H))(ρ[K6](y))=(λ-1∘σ[K6])(y)=(λ-1∘σ[K6]∘(∘r=05ρ[Kr]))(x)=SHARK[K](x).
This ends the proof.The following corollary shows how to decrypt the output ofSHARKW[K] by modifying, the decryption process of SHARK, that is, SHARK-1[K].Corollary 2.
The previously described encryption algorithm,SHARKW[K], can be decrypted using
(15)SHARKW[K]-1=F∘SHARK-1[K]∘G.Proof.
By Proposition1, G∘SHARKW[K]∘F=SHARK[K]. Hence,
(16)SHARKW[K]=G-1∘SHARK[K]∘F-1,SHARKW[K]-1=(G-1∘SHARK[K]∘F-1)-1=F∘SHARK[K]-1∘G=F∘SHARK-1[K]∘G.
This ends the proof.


## 4. Security Measurements and Analysis

### 4.1. Security Measurements

In [2, 3], Chow et al. used white-box diversity and white-box ambiguity to measure the security of a white-box encryption algorithm. The white-box diversity of a given table type counts the number of distinct constructions that exist in a table of the same type. It measures variability among implementations and is useful in foiling prepackaged attacks. White-box ambiguity of a table is a more important metric because it counts the number of distinct constructions that produce exactly the same type of table. It measures the number of alternative interpretations or meanings of a specific table, which an attacker must investigate in order to determine one of the obfuscated cipher’s instances.The number of nonsingular matrices of ordern is (2n-1)×∏j=1n-1(2n-1-∑k=1j(jk)). The number of possible Δ is 8160≈213. For each table (T-Box), the white-box diversity is approximately 2255×213×216×213×2255=2552, and the white-box ambiguity is approximately 2255×216=2271.


### 4.2. Against Billet et al.’s and Michiels et al.’s Attack

Billet et al. [8] described a very efficient attack against the white-box AES implementation proposed in [3]. Recovering information about the key by a local inspection of the lookup tables seems difficult, as the tables are designed to satisfy diversity and ambiguity criteria. In the Billet et al. attack, the authors take advantage of the fact that it is easier to recover information by analyzing compositions of lookup tables corresponding to one encoded AES round.In this paper, the proposed implementation means that some attack techniques aimed at the simplicity of AESS-boxes are not valid. Furthermore, we have also used isomorphic transformations to increase the white-box diversity. For these reasons, the Billet et al. attack will not work.The ideas presented in [3] can be used to derive a white-box implementation for any substitution linear-transformation network cipher [17]. Michiels et al. [9] presented an algorithm for extracting the round keys of such a cipher when all block rows of the diffusion matrices have disjoint spanning block sets. This condition on the diffusion matrices is, for example, satisfied by all maximum distance separable matrices [18, 19]. In our algorithm, we have implemented reverse operations of linear mixing bijections in a different way. This ensures that our technique is immune from the attack of Michiels et al.


### 4.3. Against Mulder et al.’s Attack

Mulder et al. [13] presented a cryptanalysis of Xiao-Lai white-box AES implementation by using Biryukov et al.’s highly efficient linear equivalence algorithm [14]. The linear equivalence algorithm checks linear equivalence between two permutations (S-boxes), S1 and S2, and finds two invertible linear mappings, L1 and L2, such that L2∘S1∘L1=S2. This is an important problem in symmetric cryptography.Biryukov et al.’s linear equivalence algorithm exploits the following two ideas. The first is that we can guess portions ofL1, which will provide us with knowledge of the values of L2. These new values from L2 allow the algorithm to extract new information about L1. The linear (affine) structure of the mappings causes another process, which they refer to as the exponential amplification of guesses. Their second idea is that if we know k vectors from the mapping L1, we also know 2k linear combinations of these vectors.Mulder et al. proposed a modified version of the linear equivalence algorithm in [13]. The time complexity of solving the linear equivalence problem of a building block decreases from 244 to 229. It follows that the attack efficiently extracts the AES key from Xiao-Lai white-box AES implementation with a time complexity of approximately 232. In the case of our white-box SHARK implementation, we have not found any technique that can reduce the time complexity in the same manner because of the following reasons.(1)
As shown in (17) and (18), the diffusion matrices of SHARK and AES are different.
(a)
The diffusion matrix of SHARK is(17)[CE9557828A19B001E7FE05D252C188F1B9DA4DD19E178386D09D262C5D9F6D7552A9076CB98F701787283A5AF4330B6C745115CF09A462090B317F86BE058334].(b)
The diffusion matrix of AES is(18)[02030101010203010101020303010102].(2)
We use a different approach to computeMr.Furthermore, theΔ transformation that we use in this paper can provide a higher work factor. The overall work factor of Mulder, Roelse, and Preneel’s attack against our white-box SHARK implementation is the product of following three factors:(1)
244 (=n322n, n=16) to solve the linear equivalence problem of a building block,(2)
213 (≈8160) to guess all the dual components,(3)
22 because there are four building blocks in each round.Thus, our white-box SHARK implementation remains with a security level higher than244+13+2=259 against Mulder et al’s attack.


## 4.1. Security Measurements

In [2, 3], Chow et al. used white-box diversity and white-box ambiguity to measure the security of a white-box encryption algorithm. The white-box diversity of a given table type counts the number of distinct constructions that exist in a table of the same type. It measures variability among implementations and is useful in foiling prepackaged attacks. White-box ambiguity of a table is a more important metric because it counts the number of distinct constructions that produce exactly the same type of table. It measures the number of alternative interpretations or meanings of a specific table, which an attacker must investigate in order to determine one of the obfuscated cipher’s instances.The number of nonsingular matrices of ordern is (2n-1)×∏j=1n-1(2n-1-∑k=1j(jk)). The number of possible Δ is 8160≈213. For each table (T-Box), the white-box diversity is approximately 2255×213×216×213×2255=2552, and the white-box ambiguity is approximately 2255×216=2271.


## 4.2. Against Billet et al.’s and Michiels et al.’s Attack

Billet et al. [8] described a very efficient attack against the white-box AES implementation proposed in [3]. Recovering information about the key by a local inspection of the lookup tables seems difficult, as the tables are designed to satisfy diversity and ambiguity criteria. In the Billet et al. attack, the authors take advantage of the fact that it is easier to recover information by analyzing compositions of lookup tables corresponding to one encoded AES round.In this paper, the proposed implementation means that some attack techniques aimed at the simplicity of AESS-boxes are not valid. Furthermore, we have also used isomorphic transformations to increase the white-box diversity. For these reasons, the Billet et al. attack will not work.The ideas presented in [3] can be used to derive a white-box implementation for any substitution linear-transformation network cipher [17]. Michiels et al. [9] presented an algorithm for extracting the round keys of such a cipher when all block rows of the diffusion matrices have disjoint spanning block sets. This condition on the diffusion matrices is, for example, satisfied by all maximum distance separable matrices [18, 19]. In our algorithm, we have implemented reverse operations of linear mixing bijections in a different way. This ensures that our technique is immune from the attack of Michiels et al.


## 4.3. Against Mulder et al.’s Attack

Mulder et al. [13] presented a cryptanalysis of Xiao-Lai white-box AES implementation by using Biryukov et al.’s highly efficient linear equivalence algorithm [14]. The linear equivalence algorithm checks linear equivalence between two permutations (S-boxes), S1 and S2, and finds two invertible linear mappings, L1 and L2, such that L2∘S1∘L1=S2. This is an important problem in symmetric cryptography.Biryukov et al.’s linear equivalence algorithm exploits the following two ideas. The first is that we can guess portions ofL1, which will provide us with knowledge of the values of L2. These new values from L2 allow the algorithm to extract new information about L1. The linear (affine) structure of the mappings causes another process, which they refer to as the exponential amplification of guesses. Their second idea is that if we know k vectors from the mapping L1, we also know 2k linear combinations of these vectors.Mulder et al. proposed a modified version of the linear equivalence algorithm in [13]. The time complexity of solving the linear equivalence problem of a building block decreases from 244 to 229. It follows that the attack efficiently extracts the AES key from Xiao-Lai white-box AES implementation with a time complexity of approximately 232. In the case of our white-box SHARK implementation, we have not found any technique that can reduce the time complexity in the same manner because of the following reasons.(1)
As shown in (17) and (18), the diffusion matrices of SHARK and AES are different.
(a)
The diffusion matrix of SHARK is(17)[CE9557828A19B001E7FE05D252C188F1B9DA4DD19E178386D09D262C5D9F6D7552A9076CB98F701787283A5AF4330B6C745115CF09A462090B317F86BE058334].(b)
The diffusion matrix of AES is(18)[02030101010203010101020303010102].(2)
We use a different approach to computeMr.Furthermore, theΔ transformation that we use in this paper can provide a higher work factor. The overall work factor of Mulder, Roelse, and Preneel’s attack against our white-box SHARK implementation is the product of following three factors:(1)
244 (=n322n, n=16) to solve the linear equivalence problem of a building block,(2)
213 (≈8160) to guess all the dual components,(3)
22 because there are four building blocks in each round.Thus, our white-box SHARK implementation remains with a security level higher than244+13+2=259 against Mulder et al’s attack.


## 5. Size and Performance

In this section, we first analyze the size of static data that the algorithm requires. We then make some suggestions regarding the implementation and provide some experimental results. Finally, we discuss a highly efficient work mode for encrypting data.Each round of our algorithm requires fourT-Box tables. As the size of each table is 216×64 bits =219 bytes, the size of the 28 tables is 14 MB. The size of each matrix is 64×64 bits =29 bytes. Thus, the size of these matrices is 3 KB. Combining these values, we determine that the size of all lookup tables and matrices is 14339 KB.Three operations are needed to run theSHARKW[K] algorithm: bit multiplication, bit addition, and T-Box table lookup. We list the number of required operations in Table 1.Table 1
Number of operations in the algorithmSHARKW[K].
Operation
Number of operations
Formula
Bit multiplication
3
×
2
13
=
6
×
64
×
64
Bit addition
3
×
2
13
≈
6
×
64
×
64
T-Box table lookup
28
=
7
×
4Of course, this is a “naïve” implementation as we can speed up the algorithm by using the memory-speed trade-off technique. A multiplication table can map two input bytes (a0,…,a7 and b0,…,b7) into a single bit (a0×b0)⊕(a1×b1)⊕⋯⊕(a7×b7). With the help of such multiplication table, we can optimize the complexity of matrix multiplications and obtain a fast software implementation. The extra cost of memory is only 8 KB. This implementation requires three operations: multiplication table lookup, bit addition, and T-Box table lookup. Table 2 lists the required number of each operation.Table 2
Number of operations in the fast software implementation ofSHARKW[K].
Operation
Number of operations
Formula
Multiplication table lookup
3
×
2
10
=
6
×
8
×
64
Bit addition
3
×
2
10
≈
6
×
8
×
64
T-Box table lookup
28
=
7
×
4We have investigated the time taken to encrypt 1 MB of data in the electronic codebook (ECB) mode on a ThinkPad notebook. The average time of the naïve implementation is 23.3 seconds and the average time of the fast implementation is only 1.2 seconds. Table3 shows the details of the testing environment.Table 3
Details of testing environment.
Machine
Lenovo ThinkPad Carbon X1
CPU
Intel core i5-3317U 1.7 GHz/2.6 GHz
RAM
4 GB
OS
Window7 64 bit
JDK Version
7Clearly, the proposed algorithm is much slower than the standard algorithm because of the additional time taken when multiplying byMr, r=1,…,6. This is true even when using the fast implementation. But the proposed algorithm running in the composite propagating cipher-block chaining (PCBC) mode, as suggested by [20], is much faster than ECB mode. In the composite PCBC mode, the speed of encryption is almost the same as the standard implementation. Figure 5 shows the flow chart of the white-box SHARK algorithm running in the composite PCBC mode.Figure 5
Flow of the white-box SHARK algorithm in composite PCBC mode.


## 6. Conclusions and Discussion

In this paper, we propose a new white-box encryption algorithm that obfuscates the cipher SHARK. Our general approach is to merge several steps of the round function of SHARK into table lookups blended by randomly generated mixing bijections. Techniques used in [10, 12] are used in this paper to obtain the obfuscated cipher. Hence, this algorithm is secure against the attacks of Billet et al. [8], Michiels et al. [9], and Mulder et al. [13]. Thus, the algorithm is a countermeasure against the threat of key compromise in white-box attack context.This design of white-box SHARK can also be used to obtain a white-box AES with a slight modification. The outcome of adapting our design to use AES will be a white-box AES implementation with the size of lookup tables and matrices being 20502 MB and with a security level of 292. We have chosen SHARK because it results in smaller tables and matrices and has a simpler description.Future work should be focused on the size of the implementation. If we can significantly decrease the size, white-box encryption algorithms may be applied to lightweight applications such as the Internet of Things or wireless sensor networks.



---

*Source: 431794-2013-11-21.xml*