This year in CRYPTO 2022 I presented the paper Implicit White-Box Implementations: White-Boxing ARX Ciphers; you can read the paper here and watch the talk here:
While the talk and the paper explain this work from a theoretical view, in this blog post I will briefly introduce this work from a more practical perspective by focusing on an example.
Let’s assume we want to implement a software application that encrypts messages using a block cipher, and we want to embed and fix the secret key of the cipher in the application. Since the application will be deployed in an untrusted environment, we want to protect the application so that no one can extract the cipher key.
If we cannot rely on secure hardware elements to store the key and we cannot prevent attackers from extracting the code of our application, our only option is to obfuscate the code so that the attacker cannot locate, separate and extract the key from the code. White-box cryptography is the field that addresses this challenging problem, protecting software implementations of cryptographic primitives against attackers with full control over the code.
All white-box methods that have been proposed in the scientific literature to protect block ciphers have been broken, and in this work we propose a new white-box method, the implicit framework. Since the implicit framework works better on ARX ciphers rather than on AES-like ciphers, we will use for our example one of the simplest ARX ciphers.
Speck
Speck is a family of lightweight block ciphers that iterates an ARX round function, composed of modular additions \(\boxplus\), rotations \(\ggg\), \(\lll\) and XORs \(\oplus\). The round function \(f(x, y, k) = (x’, y’)\) of Speck takes two words \(x\) and \(y\), and a round key \(k\), all of wordsize \(n\) bits, and outputs two n-bit words \(x\)’ and \(y’\) given by
\[ \begin{align*} x’ &= ((x \ggg \alpha)\boxplus y)\oplus k \\ y’ &= x’ \oplus (y \lll \beta))\,. \end{align*} \]
The rotation constants \((\alpha, \beta)\), the number of rounds and the wordsize \(n\) depends on the Speck instance. The generation of the round keys from the main key (the key-schedule algorithm) is not important for our example, only the fact that the main key can be recovered from the round keys.
For our example, we will consider a toy instance of Speck given by the rotational constants \((2, 1)\), three rounds, and 4-bit wordsize. Assuming the key schedule derives the hexadecimal round keys 0x3, 0xd, 0xb from the hexadecimal key 0x123, we could implement this fixed-key instance of Speck in the programming language Python as follows:
n = 4
rk = [0x3, 0xd, 0xb]
def RotateRight(x, r):
return (x >> r) | (x << (n - r) % (2**n))
def RotateLeft(x, r):
return ((x << r) % (2**n)) | (x >> (n - r))
def encrypt(x, y):
for i in range(3):
x = ((RotateRight(x, 2) + y) % (2**n)) ^ rk[i]
y = RotateLeft(y, 1) ^ x
return x, y
The Implicit Framework
If we deployed this unprotected code in our application and if this code was reverse engineered by an attacker, then the attacker can easily retrieve the cipher key by locating the list rk and then recovering the key from the round key values.
Instead, we will protect our Speck encryption code with the implicit framework. The main idea of the implicit framework is to represent each round as a system of low-degree equations (denoted in the paper as implicit functions) and then to protect the equations with random permutations (round encodings).
Following the method described in our paper, we can represent the round function of Speck by a system of \(2n\) binary quadratic equations with \(4n\) bit-variables: the first \(2n\) bit-variables \((x_1, \dots, x_n, y_1, \dots, y_n)\) correspond to the round input \((x, y)\) and the last \(2n\) bit-variables \((z_1, \dots, z_n, t_1, \dots, t_n)\) correspond to the round output \((z, t)\).
With this representation, we can evaluate the round function at the input \((\hat{x}, \hat{y})\) using the system of equations by substituting \((x, y) = (\hat{x}, \hat{y})\) and solving the remaining system for the variables \((z, t)\); the only solution \((\hat{z}, \hat{t})\) of the remaining system is the output value of the round function, that is, \(f(\hat{x}, \hat{y}) = (\hat{z}, \hat{t})\). Thus, we could equivalently implement our Speck instance for the key 0x123 with the following SageMath code:
R_xyzt.<x0, x1, x2, x3, y0, y1, y2, y3, z0, z1, z2, z3, t0, t1, t2, t3> = BooleanPolynomialRing()
R_zt = R_xyzt.remove_var(x0, x1, x2, x3, y0, y1, y2, y3)
ROUND_SYSTEMS = [
[ # round 0: x = (RotateRight(x, 2) + y) % (2**n)
x2 + y0 + z0,
x2*y0 + x2*z0 + x3 + y0*z0 + y1 + z0 + z1,
x0 + x2*y0 + x2*z0 + x3*y1 + x3*z1 + y0*z0 + y1*z1 + y2 + z0 + z1 + z2,
x0*y2 + x0*z2 + x1 + x2*y0 + x2*z0 + x3*y1 + x3*z1 + y0*z0 + y1*z1 + y2*z2 + y3 + z0 + z1 + z2 + z3,
y0 + t0,
y1 + t1,
y2 + t2,
y3 + t3
],
[ # round 1: x ^= rk[0]; y = RotateLeft(y, 1) ^ x; x = (RotateRight(x, 2) + y) % (2**n)
x0 + x2 + y3 + z0 + 1,
x0*x2 + x0*z0 + x1 + x2*y3 + x2*z0 + x2 + x3 + y0 + y3*z0 + z1 + 1,
x0*x2 + x0*z0 + x0 + x1*x3 + x1*z1 + x2*y3 + x2*z0 + x3*y0 + x3*z1 + x3 + y0*z1 + y1 + y3*z0 + z2 + 1,
x0*y1 + x0*z0 + x0*z2 + x1*x3 + x1*z1 + x1 + x2*y3 + x2*z0 + x2*z2 + x3*y0 + x3*z1 + y0*z1 + y1*z2 + y1 + y2 + y3*z0 + z3 + 1,
x0 + y3 + t0 + 1,
x1 + y0 + t1 + 1,
x2 + y1 + t2,
x3 + y2 + t3
],
[ # round 2: x ^= rk[1]; y = RotateLeft(y, 1) ^ x; x = (RotateRight(x, 2) + y) % (2**n); x ^= rk[2]; y = RotateLeft(y, 1) ^ x
x0 + x2 + y3 + z0 + 1,
x0*x2 + x0*z0 + x1 + x2*y3 + x2*z0 + x3 + y0 + y3*z0 + z0 + z1,
x0*x2 + x0*z0 + x0 + x1*x3 + x1*z1 + x2*y3 + x2*z0 + x2 + x3*y0 + x3*z1 + x3 + y0*z1 + y1 + y3*z0 + z0 + z2,
x0*y1 + x0*z0 + x0*z2 + x0 + x1*x3 + x1*z1 + x1 + x2*y3 + x2*z0 + x2*z2 + x2 + x3*y0 + x3*z1 + y0*z1 + y1*z2 + y1 + y2 + y3*z0 + z0 + z2 + z3 + 1,
x0 + y3 + z1 + t1 + 1,
x1 + y0 + z2 + t2,
x2 + y1 + z3 + t3 + 1,
x3 + y2 + z0 + t0 + 1
],
]
def int2bits(my_int):
my_int = Integer(my_int).bits()
return [R_xyzt(0)]*(4-len(my_int)) + [R_xyzt(bit) for bit in my_int]
def encrypt(x_val, y_val):
x_val, y_val = int2bits(x_val), int2bits(y_val)
for i in range(3):
new_system = [eq(*(x_val + y_val + [z0, z1, z2, z3, t0, t1, t2, t3])) for eq in ROUND_SYSTEMS[i]]
s = R_zt.ideal(new_system).variety()[0] # get unique solution
z_val, t_val = [s[z0], s[z1], s[z2], s[z3]], [s[t0], s[t1], s[t2], s[t3]]
x_val, y_val = [R_xyzt(bit) for bit in z_val], [R_xyzt(bit) for bit in t_val]
x_val, y_val = Integer(x_val, base=2), Integer(y_val, base=2)
return x_val, y_val
This SageMath code and the previous Python code are functionally equivalent; for a given plaintext, they return the same ciphertexts. For example, encrypt(0x0, 0x0) outputs the ciphertext (0x7, 0xd) in both implementations.
Representing each round by a system of equations is not enough to hide the round key values, and we will first apply a transformation to obfuscate the systems of equations but preserving the input-output behaviour of the encryption function. This transformation consists of composing the systems of equations (seen as vectorial Boolean functions) with random permutations such that the transformations of adjacent rounds cancel each other. These random permutations are in turn composed of self-equivalences and graph automorphisms, and you can read more about these special type of functions in the paper. After applying this transformation, we get the following system of equations:
ROUND_SYSTEMS = [
[ # round 0
x0*x2 + x0*y3 + x0*z1 + x1 + x2*x3 + x2*y3 + x2 + x3*y3 + x3*z1 + y3*z1 + z1 + t0 + t1,
x0*x2 + x0*y3 + x0*z1 + x0 + x1 + x2*x3 + x2*y0 + x2*y2 + x2*z1 + x2*z2 + x2*z3 + x2*t3 + x3*y0 + x3*y3 + x3*z0 + x3*z1 + x3*z3 + x3*t2 + x3*t3 + x3 + y0*y1 + y0*y2 + y0*y3 + y0*z1 + y0*z2 + y0*z3 + y0*t3 + y0 + y1*z0 + y1*z3 + y1*t2 + y1*t3 + y3*z1 + y3 + z0 + z3 + t1 + t3,
x2*x3 + x2*y0 + x2*y1 + x2*y2 + x2*y3 + x2*z1 + x2*z2 + x2*z3 + x2*t3 + x2 + x3*y0 + x3 + y0*y1 + y0*y2 + y0*y3 + y0*z1 + y0*z2 + y0*z3 + y0*t3 + y0 + y3 + z0 + z1 + z3 + t1 + t2,
x0 + x2*x3 + x2*y1 + x3*z0 + x3*z3 + x3*t2 + x3*t3 + y1*z0 + y1*z3 + y1*t2 + y1*t3 + y1 + t1 + t3,
x0*x2 + x0*y3 + x0*z1 + x1 + x2*y0 + x2*y1 + x2*y2 + x2*z1 + x2*z2 + x2*z3 + x2*t3 + x2 + x3*y0 + x3*y3 + x3*z1 + y0*y1 + y0*y2 + y0*y3 + y0*z1 + y0*z2 + y0*z3 + y0*t3 + y1 + y2 + y3*z1 + z0 + z1 + z2 + t0 + t2 + t3,
x0*x2 + x0*y3 + x0*z1 + x1 + x2*x3 + x2*y3 + x2 + x3*y3 + x3*z1 + y0 + y1 + y3*z1 + z2 + t1 + t3 + 1,
x0*x2 + x0*y3 + x0*z1 + x1 + x2*x3 + x2*y3 + x2 + x3*y3 + x3*z1 + y1 + y3*z1 + y3 + z2 + t0 + t1 + t2 + 1,
x0*x2 + x0*y3 + x0*z1 + x1 + x2*y0 + x2*y1 + x2*y2 + x2*z1 + x2*z2 + x2*z3 + x2*t3 + x2 + x3*y0 + x3*y3 + x3*z1 + x3 + y0*y1 + y0*y2 + y0*y3 + y0*z1 + y0*z2 + y0*z3 + y0*t3 + y3*z1 + y3 + z0 + z1 + z3 + t1 + 1,
],
[ # round 1
x0*x2*y1 + x0*x2*y3 + x0*x2 + x0*x3*y1 + x0*x3*y3 + x0*x3 + x0*y0 + x0*y1 + x0*z0 + x0*z2 + x0*z3 + x0*t1 + x1*x2*y3 + x1*x2*z0 + x1*x2*z2 + x1*x2*z3 + x1*x2*t1 + x1*x2 + x1*y0*y3 + x1*y0*z0 + x1*y0*z2 + x1*y0*z3 + x1*y0*t1 + x1*y0 + x1*y1*y3 + x1*y1*z0 + x1*y1*z2 + x1*y1*z3 + x1*y1*t1 + x1*y1 + x1*y3*z0 + x1*y3*z2 + x1*y3*z3 + x1*y3*t1 + x1*y3 + x1*z0 + x1*z2 + x1*z3 + x1*t1 + x2*x3 + x2*y0*y1 + x2*y0*z0 + x2*y0*z2 + x2*y0*z3 + x2*y0*t1 + x2*y0 + x2*y1*y2 + x2*y1*y3 + x2*y1*z1 + x2*y1*z2 + x2*y1*t0 + x2*y1*t1 + x2*y1 + x2*y2*z0 + x2*y2*z2 + x2*y2*z3 + x2*y2*t1 + x2*y2 + x2*y3*z0 + x2*y3*z1 + x2*y3*z3 + x2*y3*t0 + x2*y3 + x2*z0 + x2*z2 + x2*z3 + x2*t1 + x3*y0*y1 + x3*y0*y3 + x3*y0 + x3*y1*y2 + x3*y1*z0 + x3*y1*z1 + x3*y1*z3 + x3*y1*t0 + x3*y2*y3 + x3*y2 + x3*y3*z0 + x3*y3*z1 + x3*y3*z3 + x3*y3*t0 + x3*z0 + x3*z1 + x3*z3 + x3*t0 + x3 + y0*y1 + y0*y2*y3 + y0*y2*z0 + y0*y2*z2 + y0*y2*z3 + y0*y2*t1 + y0*y2 + y0*y3*z0 + y0*y3*z2 + y0*y3*z3 + y0*y3*t1 + y0*z0 + y0*z2 + y0*z3 + y0*t1 + y1*y2*y3 + y1*y2*z0 + y1*y2*z2 + y1*y2*z3 + y1*y2*t1 + y1*y2 + y1*y3*z0 + y1*y3*z2 + y1*y3*z3 + y1*y3*t1 + y2*y3*z0 + y2*y3*z2 + y2*y3*z3 + y2*y3*t1 + y2*y3 + y2*z0 + y2*z2 + y2*z3 + y2*t1 + y3 + z1 + z2 + z3 + t0 + t1 + 1,
x0*x2 + x0*y0 + x0*y1 + x0*z0 + x0*z2 + x0*z3 + x0*t1 + x1*x2*y3 + x1*x2*z0 + x1*x2*z2 + x1*x2*z3 + x1*x2*t1 + x1*x2 + x1*y0*y3 + x1*y0*z0 + x1*y0*z2 + x1*y0*z3 + x1*y0*t1 + x1*y0 + x1*y1*y3 + x1*y1*z0 + x1*y1*z2 + x1*y1*z3 + x1*y1*t1 + x1*y1 + x1*y3*z0 + x1*y3*z2 + x1*y3*z3 + x1*y3*t1 + x1*y3 + x1*z0 + x1*z2 + x1*z3 + x1*t1 + x2*y0*y3 + x2*y0*z0 + x2*y0*z2 + x2*y0*z3 + x2*y0*t1 + x2*y0 + x2*y1*y3 + x2*y1*z0 + x2*y1*z2 + x2*y1*z3 + x2*y1*t1 + x2*y2*y3 + x2*y2*z0 + x2*y2*z2 + x2*y2*z3 + x2*y2*t1 + x2*y2 + x2*z0 + x2*z2 + x2*z3 + x2*t1 + x3 + y0*y1 + y0*y2*y3 + y0*y2*z0 + y0*y2*z2 + y0*y2*z3 + y0*y2*t1 + y0*y2 + y0*y3*z0 + y0*y3*z2 + y0*y3*z3 + y0*y3*t1 + y0*z0 + y0*z2 + y0*z3 + y0*t1 + y0 + y1*y2*y3 + y1*y2*z0 + y1*y2*z2 + y1*y2*z3 + y1*y2*t1 + y1*y2 + y1*y3*z0 + y1*y3*z2 + y1*y3*z3 + y1*y3*t1 + y2*y3*z0 + y2*y3*z2 + y2*y3*z3 + y2*y3*t1 + y2*y3 + y2*z0 + y2*z2 + y2*z3 + y2*t1 + y2 + z1 + z2 + z3 + t2 + 1,
x0 + x2*y1 + x2*y3 + x3*y1 + x3*y3 + y2 + y3 + z1 + z2 + t1 + 1,
x0*x2 + x0*y0 + x0*y1 + x0*z0 + x0*z2 + x0*z3 + x0*t1 + x0 + x1*x2*y0 + x1*x2*y2 + x1*x2*z0 + x1*x2*z1 + x1*x2*t0 + x1*x2*t1 + x1*x2*t2 + x1*x2*t3 + x1*x2 + x1*y0*y1 + x1*y0*y2 + x1*y0*y3 + x1*y0*z0 + x1*y0*z1 + x1*y0*t0 + x1*y0*t1 + x1*y0*t2 + x1*y0*t3 + x1*y0 + x1*y1*y2 + x1*y1*z0 + x1*y1*z1 + x1*y1*t0 + x1*y1*t1 + x1*y1*t2 + x1*y1*t3 + x1*y1 + x1*y2*y3 + x1*y2 + x1*y3*z0 + x1*y3*z1 + x1*y3*t0 + x1*y3*t1 + x1*y3*t2 + x1*y3*t3 + x1*y3 + x1*z0 + x1*z1 + x1*t0 + x1*t1 + x1*t2 + x1*t3 + x1 + x2*x3*y1 + x2*x3*y3 + x2*y0*y1 + x2*y0*z0 + x2*y0*z1 + x2*y0*t0 + x2*y0*t1 + x2*y0*t2 + x2*y0*t3 + x2*y0 + x2*y1*y3 + x2*y1*z0 + x2*y1*z2 + x2*y1*z3 + x2*y1*t1 + x2*y1 + x2*y2*y3 + x2*y2*z0 + x2*y2*z1 + x2*y2*t0 + x2*y2*t1 + x2*y2*t2 + x2*y2*t3 + x2*y3*z1 + x2*y3*z2 + x2*y3*z3 + x2*y3*t0 + x2*y3*t2 + x2*y3*t3 + x2*z0 + x2*z1 + x2*t0 + x2*t1 + x2*t2 + x2*t3 + x3*y1*y2 + x3*y1*y3 + x3*y1*z1 + x3*y1*z2 + x3*y1*z3 + x3*y1*t0 + x3*y1*t2 + x3*y1*t3 + x3*y2*y3 + x3*y3*z1 + x3*y3*z2 + x3*y3*z3 + x3*y3*t0 + x3*y3*t2 + x3*y3*t3 + x3*y3 + x3 + y0*y1*y2 + y0*y1*y3 + y0*y2*z0 + y0*y2*z1 + y0*y2*t0 + y0*y2*t1 + y0*y2*t2 + y0*y2*t3 + y0*y2 + y0*y3*z0 + y0*y3*z1 + y0*y3*t0 + y0*y3*t1 + y0*y3*t2 + y0*y3*t3 + y0*z0 + y0*z1 + y0*t0 + y0*t1 + y0*t2 + y0*t3 + y1*y2*y3 + y1*y2*z0 + y1*y2*z1 + y1*y2*t0 + y1*y2*t1 + y1*y2*t2 + y1*y2*t3 + y1*y3*z0 + y1*y3*z1 + y1*y3*t0 + y1*y3*t1 + y1*y3*t2 + y1*y3*t3 + y1*y3 + y1*z1 + y1*z2 + y1*z3 + y1*t0 + y1*t2 + y1*t3 + y2*y3*z0 + y2*y3*z1 + y2*y3*t0 + y2*y3*t1 + y2*y3*t2 + y2*y3*t3 + y2*z0 + y2*z2 + y2*z3 + y2*t1 + z1 + z3 + t0 + t3 + 1,
x0*x2 + x0*y0 + x0*y1 + x0*z0 + x0*z2 + x0*z3 + x0*t1 + x0 + x1*x2*y3 + x1*x2*z0 + x1*x2*z2 + x1*x2*z3 + x1*x2*t1 + x1*x2 + x1*y0*y3 + x1*y0*z0 + x1*y0*z2 + x1*y0*z3 + x1*y0*t1 + x1*y0 + x1*y1*y3 + x1*y1*z0 + x1*y1*z2 + x1*y1*z3 + x1*y1*t1 + x1*y1 + x1*y3*z0 + x1*y3*z2 + x1*y3*z3 + x1*y3*t1 + x1*y3 + x1*z0 + x1*z2 + x1*z3 + x1*t1 + x1 + x2*y0*y3 + x2*y0*z0 + x2*y0*z2 + x2*y0*z3 + x2*y0*t1 + x2*y0 + x2*y1*y3 + x2*y1*z0 + x2*y1*z2 + x2*y1*z3 + x2*y1*t1 + x2*y2*y3 + x2*y2*z0 + x2*y2*z2 + x2*y2*z3 + x2*y2*t1 + x2*y2 + x2*z0 + x2*z2 + x2*z3 + x2*t1 + x2 + y0*y1 + y0*y2*y3 + y0*y2*z0 + y0*y2*z2 + y0*y2*z3 + y0*y2*t1 + y0*y2 + y0*y3*z0 + y0*y3*z2 + y0*y3*z3 + y0*y3*t1 + y0*z0 + y0*z2 + y0*z3 + y0*t1 + y0 + y1*y2*y3 + y1*y2*z0 + y1*y2*z2 + y1*y2*z3 + y1*y2*t1 + y1*y2 + y1*y3*z0 + y1*y3*z2 + y1*y3*z3 + y1*y3*t1 + y2*y3*z0 + y2*y3*z2 + y2*y3*z3 + y2*y3*t1 + y2*y3 + y2*z0 + y2*z2 + y2*z3 + y2*t1 + y2 + y3 + z0 + z1 + z2 + t0 + 1,
x0*x2 + x0*y0 + x0*y1 + x0*z0 + x0*z2 + x0*z3 + x0*t1 + x0 + x1*x2*y0 + x1*x2*y2 + x1*x2*z0 + x1*x2*z1 + x1*x2*t0 + x1*x2*t1 + x1*x2*t2 + x1*x2*t3 + x1*x2 + x1*y0*y1 + x1*y0*y2 + x1*y0*y3 + x1*y0*z0 + x1*y0*z1 + x1*y0*t0 + x1*y0*t1 + x1*y0*t2 + x1*y0*t3 + x1*y0 + x1*y1*y2 + x1*y1*z0 + x1*y1*z1 + x1*y1*t0 + x1*y1*t1 + x1*y1*t2 + x1*y1*t3 + x1*y1 + x1*y2*y3 + x1*y2 + x1*y3*z0 + x1*y3*z1 + x1*y3*t0 + x1*y3*t1 + x1*y3*t2 + x1*y3*t3 + x1*y3 + x1*z0 + x1*z1 + x1*t0 + x1*t1 + x1*t2 + x1*t3 + x2*x3*y1 + x2*x3*y3 + x2*y0*y1 + x2*y0*z0 + x2*y0*z1 + x2*y0*t0 + x2*y0*t1 + x2*y0*t2 + x2*y0*t3 + x2*y0 + x2*y1*y3 + x2*y1*z0 + x2*y1*z2 + x2*y1*z3 + x2*y1*t1 + x2*y2*y3 + x2*y2*z0 + x2*y2*z1 + x2*y2*t0 + x2*y2*t1 + x2*y2*t2 + x2*y2*t3 + x2*y3*z1 + x2*y3*z2 + x2*y3*z3 + x2*y3*t0 + x2*y3*t2 + x2*y3*t3 + x2*y3 + x2*z0 + x2*z1 + x2*t0 + x2*t1 + x2*t2 + x2*t3 + x3*y1*y2 + x3*y1*y3 + x3*y1*z1 + x3*y1*z2 + x3*y1*z3 + x3*y1*t0 + x3*y1*t2 + x3*y1*t3 + x3*y1 + x3*y2*y3 + x3*y3*z1 + x3*y3*z2 + x3*y3*z3 + x3*y3*t0 + x3*y3*t2 + x3*y3*t3 + y0*y1*y2 + y0*y1*y3 + y0*y2*z0 + y0*y2*z1 + y0*y2*t0 + y0*y2*t1 + y0*y2*t2 + y0*y2*t3 + y0*y2 + y0*y3*z0 + y0*y3*z1 + y0*y3*t0 + y0*y3*t1 + y0*y3*t2 + y0*y3*t3 + y0*z0 + y0*z1 + y0*t0 + y0*t1 + y0*t2 + y0*t3 + y1*y2*y3 + y1*y2*z0 + y1*y2*z1 + y1*y2*t0 + y1*y2*t1 + y1*y2*t2 + y1*y2*t3 + y1*y3*z0 + y1*y3*z1 + y1*y3*t0 + y1*y3*t1 + y1*y3*t2 + y1*y3*t3 + y1*y3 + y1*z1 + y1*z2 + y1*z3 + y1*t0 + y1*t2 + y1*t3 + y1 + y2*y3*z0 + y2*y3*z1 + y2*y3*t0 + y2*y3*t1 + y2*y3*t2 + y2*y3*t3 + y2*z0 + y2*z2 + y2*z3 + y2*t1 + z3 + t0 + t1 + t2 + 1,
x0 + x1*x2*y0 + x1*x2*y2 + x1*x2*y3 + x1*x2*z1 + x1*x2*z2 + x1*x2*z3 + x1*x2*t0 + x1*x2*t2 + x1*x2*t3 + x1*x2 + x1*y0*y1 + x1*y0*y2 + x1*y0*z1 + x1*y0*z2 + x1*y0*z3 + x1*y0*t0 + x1*y0*t2 + x1*y0*t3 + x1*y0 + x1*y1*y2 + x1*y1*y3 + x1*y1*z1 + x1*y1*z2 + x1*y1*z3 + x1*y1*t0 + x1*y1*t2 + x1*y1*t3 + x1*y1 + x1*y2*y3 + x1*y2 + x1*y3*z1 + x1*y3*z2 + x1*y3*z3 + x1*y3*t0 + x1*y3*t2 + x1*y3*t3 + x1*y3 + x1*z1 + x1*z2 + x1*z3 + x1*t0 + x1*t2 + x1*t3 + x2*x3*y1 + x2*x3*y3 + x2*y0*y1 + x2*y0*y3 + x2*y0*z1 + x2*y0*z2 + x2*y0*z3 + x2*y0*t0 + x2*y0*t2 + x2*y0*t3 + x2*y0 + x2*y1 + x2*y2*z1 + x2*y2*z2 + x2*y2*z3 + x2*y2*t0 + x2*y2*t2 + x2*y2*t3 + x2*y3*z1 + x2*y3*z2 + x2*y3*z3 + x2*y3*t0 + x2*y3*t2 + x2*y3*t3 + x2*y3 + x2*z1 + x2*z2 + x2*z3 + x2*t0 + x2*t2 + x2*t3 + x2 + x3*y1*y2 + x3*y1*y3 + x3*y1*z1 + x3*y1*z2 + x3*y1*z3 + x3*y1*t0 + x3*y1*t2 + x3*y1*t3 + x3*y1 + x3*y2*y3 + x3*y3*z1 + x3*y3*z2 + x3*y3*z3 + x3*y3*t0 + x3*y3*t2 + x3*y3*t3 + y0*y1*y2 + y0*y1*y3 + y0*y1 + y0*y2*y3 + y0*y2*z1 + y0*y2*z2 + y0*y2*z3 + y0*y2*t0 + y0*y2*t2 + y0*y2*t3 + y0*y2 + y0*y3*z1 + y0*y3*z2 + y0*y3*z3 + y0*y3*t0 + y0*y3*t2 + y0*y3*t3 + y0*y3 + y0*z1 + y0*z2 + y0*z3 + y0*t0 + y0*t2 + y0*t3 + y0 + y1*y2*z1 + y1*y2*z2 + y1*y2*z3 + y1*y2*t0 + y1*y2*t2 + y1*y2*t3 + y1*y3*z1 + y1*y3*z2 + y1*y3*z3 + y1*y3*t0 + y1*y3*t2 + y1*y3*t3 + y1*z1 + y1*z2 + y1*z3 + y1*t0 + y1*t2 + y1*t3 + y2*y3*z1 + y2*y3*z2 + y2*y3*z3 + y2*y3*t0 + y2*y3*t2 + y2*y3*t3 + y3 + z0 + z1 + z2 + z3 + t0 + t2 + t3 + 1,
x0*x2*y1 + x0*x2*y3 + x0*x3*y1 + x0*x3*y3 + x0*x3 + x1*x2*y0 + x1*x2*y2 + x1*x2*y3 + x1*x2*z1 + x1*x2*z2 + x1*x2*z3 + x1*x2*t0 + x1*x2*t2 + x1*x2*t3 + x1*y0*y1 + x1*y0*y2 + x1*y0*z1 + x1*y0*z2 + x1*y0*z3 + x1*y0*t0 + x1*y0*t2 + x1*y0*t3 + x1*y1*y2 + x1*y1*y3 + x1*y1*z1 + x1*y1*z2 + x1*y1*z3 + x1*y1*t0 + x1*y1*t2 + x1*y1*t3 + x1*y2*y3 + x1*y2 + x1*y3*z1 + x1*y3*z2 + x1*y3*z3 + x1*y3*t0 + x1*y3*t2 + x1*y3*t3 + x1*z1 + x1*z2 + x1*z3 + x1*t0 + x1*t2 + x1*t3 + x2*x3*y1 + x2*x3*y3 + x2*x3 + x2*y0*z1 + x2*y0*z2 + x2*y0*z3 + x2*y0*t0 + x2*y0*t2 + x2*y0*t3 + x2*y1*y2 + x2*y1*z0 + x2*y1*z1 + x2*y1*z3 + x2*y1*t0 + x2*y2*y3 + x2*y2*z1 + x2*y2*z2 + x2*y2*z3 + x2*y2*t0 + x2*y2*t2 + x2*y2*t3 + x2*y2 + x2*y3*z0 + x2*y3*z2 + x2*y3*t2 + x2*y3*t3 + x2*y3 + x2*z1 + x2*z2 + x2*z3 + x2*t0 + x2*t2 + x2*t3 + x3*y0*y1 + x3*y0*y3 + x3*y0 + x3*y1*y3 + x3*y1*z0 + x3*y1*z2 + x3*y1*t2 + x3*y1*t3 + x3*y2 + x3*y3*z0 + x3*y3*z2 + x3*y3*t2 + x3*y3*t3 + x3*y3 + x3*z0 + x3*z1 + x3*z3 + x3*t0 + x3 + y0*y1*y2 + y0*y1*y3 + y0*y1 + y0*y2*y3 + y0*y2*z1 + y0*y2*z2 + y0*y2*z3 + y0*y2*t0 + y0*y2*t2 + y0*y2*t3 + y0*y3*z1 + y0*y3*z2 + y0*y3*z3 + y0*y3*t0 + y0*y3*t2 + y0*y3*t3 + y0*z1 + y0*z2 + y0*z3 + y0*t0 + y0*t2 + y0*t3 + y0 + y1*y2*z1 + y1*y2*z2 + y1*y2*z3 + y1*y2*t0 + y1*y2*t2 + y1*y2*t3 + y1*y2 + y1*y3*z1 + y1*y3*z2 + y1*y3*z3 + y1*y3*t0 + y1*y3*t2 + y1*y3*t3 + y1*y3 + y1*z1 + y1*z2 + y1*z3 + y1*t0 + y1*t2 + y1*t3 + y1 + y2*y3*z1 + y2*y3*z2 + y2*y3*z3 + y2*y3*t0 + y2*y3*t2 + y2*y3*t3 + y2*y3 + z1 + z2 + t0 + t2 + t3
],
[ # round 2
x0*x1*x2 + x0*x1*x3 + x0*x1*y0 + x0*x1*y3 + x0*x1 + x0*x2*x3 + x0*x2*y1 + x0*x2*y3 + x0*x3*y0 + x0*x3*y1 + x0*y0*y1 + x0*y0*y3 + x0*y1*y3 + x0*y1 + x1*x2*x3 + x1*x2*y0 + x1*x2*y2 + x1*x2 + x1*x3*y2 + x1*x3*y3 + x1*y0*y2 + x1*y0*y3 + x1*y1 + x1*y2*y3 + x1*z1 + x1*t1 + x1*t2 + x1 + x2*x3*y0 + x2*x3*y1 + x2*x3*y2 + x2*x3*y3 + x2*y0*y3 + x2*y0 + x2*y1*y2 + x2*y1*y3 + x2*y2*y3 + x2*y2 + x2*z1 + x2*z2 + x2*z3 + x2*t0 + x2*t1 + x2*t2 + x2*t3 + x2 + x3*y0*y1 + x3*y0*y2 + x3*y0*y3 + x3*y1*y2 + x3*y3 + x3*z2 + x3*z3 + x3*t0 + x3*t3 + y0*y1*y2 + y0*y1*y3 + y0*y2*y3 + y0*z2 + y0*z3 + y0*t0 + y0*t3 + y0 + y1*y2*y3 + y1*z1 + y1*t1 + y1*t2 + y2 + y3*z2 + y3*z3 + y3*t0 + y3*t3 + z2 + z3 + t0 + t1 + 1,
x0*x1*x2 + x0*x1*y1 + x0*x1*y2 + x0*x1*y3 + x0*x1*z2 + x0*x1*t1 + x0*x1*t2 + x0*x2*x3 + x0*x2*y1 + x0*x2*y3 + x0*x2 + x0*x3*y1 + x0*x3*y2 + x0*x3*y3 + x0*x3*z2 + x0*x3*t1 + x0*x3*t2 + x0*y1*y2 + x0*y1*z2 + x0*y1*t1 + x0*y1*t2 + x0*y2*y3 + x0*y2 + x0*y3*z2 + x0*y3*t1 + x0*y3*t2 + x0*z2 + x0*t1 + x0*t2 + x0 + x1*x2*y1 + x1*x2*z2 + x1*x2*t1 + x1*x2*t2 + x1*x3 + x1*y0 + x1*y1*y2 + x1*y1*y3 + x1*y2*z2 + x1*y2*t1 + x1*y2*t2 + x1*y2 + x1*y3*z2 + x1*y3*t1 + x1*y3*t2 + x1*y3 + x1*z1 + x1*z2 + x2*x3*y0 + x2*x3*y1 + x2*x3*y3 + x2*x3*z2 + x2*x3*t1 + x2*x3*t2 + x2*x3 + x2*y0*y2 + x2*y0*y3 + x2*y0*z2 + x2*y0*t1 + x2*y0*t2 + x2*y0 + x2*y1*y3 + x2*y1*z2 + x2*y1*t1 + x2*y1*t2 + x2*y1 + x2*y2*y3 + x2*y3 + x2*z2 + x2*t1 + x2*t2 + x2 + x3*y0*y1 + x3*y0*y2 + x3*y0*y3 + x3*y0*z2 + x3*y0*t1 + x3*y0*t2 + x3*y1*y2 + x3*y2*y3 + x3*y2*z2 + x3*y2*t1 + x3*y2*t2 + x3*z1 + x3*t1 + x3*t2 + x3 + y0*y1*y2 + y0*y1*y3 + y0*y1*z2 + y0*y1*t1 + y0*y1*t2 + y0*y1 + y0*y2 + y0*z1 + y0*t1 + y0*t2 + y0 + y1*y2*z2 + y1*y2*t1 + y1*y2*t2 + y1*z1 + y1*t1 + y1*t2 + y2*y3*z2 + y2*y3*t1 + y2*y3*t2 + y2*z2 + y2*t1 + y2*t2 + y2 + y3*z1 + y3*t1 + y3*t2 + y3 + z0 + t0 + t3 + 1,
x0*x1*x2 + x0*x1*y1 + x0*x1*y2 + x0*x1*y3 + x0*x1*z2 + x0*x1*t1 + x0*x1*t2 + x0*x2*x3 + x0*x2*y1 + x0*x2*y3 + x0*x2 + x0*x3*y1 + x0*x3*y2 + x0*x3*y3 + x0*x3*z2 + x0*x3*t1 + x0*x3*t2 + x0*y1*y2 + x0*y1*z2 + x0*y1*t1 + x0*y1*t2 + x0*y2*y3 + x0*y2 + x0*y3*z2 + x0*y3*t1 + x0*y3*t2 + x0*z2 + x0*t1 + x0*t2 + x1*x2*y1 + x1*x2*z2 + x1*x2*t1 + x1*x2*t2 + x1*y1*y2 + x1*y1*y3 + x1*y1 + x1*y2*z2 + x1*y2*t1 + x1*y2*t2 + x1*y3*z2 + x1*y3*t1 + x1*y3*t2 + x1*z2 + x1*t1 + x1*t2 + x1 + x2*x3*y0 + x2*x3*y1 + x2*x3*y3 + x2*x3*z2 + x2*x3*t1 + x2*x3*t2 + x2*x3 + x2*y0*y2 + x2*y0*y3 + x2*y0*z2 + x2*y0*t1 + x2*y0*t2 + x2*y0 + x2*y1*y3 + x2*y1*z2 + x2*y1*t1 + x2*y1*t2 + x2*y1 + x2*y2*y3 + x2*y3 + x2*z2 + x2*t1 + x2*t2 + x2 + x3*y0*y1 + x3*y0*y2 + x3*y0*y3 + x3*y0*z2 + x3*y0*t1 + x3*y0*t2 + x3*y1*y2 + x3*y2*y3 + x3*y2*z2 + x3*y2*t1 + x3*y2*t2 + x3*y2 + y0*y1*y2 + y0*y1*y3 + y0*y1*z2 + y0*y1*t1 + y0*y1*t2 + y0*y1 + y1*y2*z2 + y1*y2*t1 + y1*y2*t2 + y1*y2 + y1 + y2*y3*z2 + y2*y3*t1 + y2*y3*t2 + y2*y3 + y2*z2 + y2*t1 + y2*t2 + y3 + z1 + z3 + t1 + t2 + t3 + 1,
x2 + y1 + y2 + y3 + z1 + t1,
x0*x1*x2 + x0*x1*y1 + x0*x1*y2 + x0*x1*y3 + x0*x1*z2 + x0*x1*t1 + x0*x1*t2 + x0*x1 + x0*x2*x3 + x0*x2*y1 + x0*x2*y3 + x0*x2 + x0*x3*y1 + x0*x3*y2 + x0*x3*y3 + x0*x3*z2 + x0*x3*t1 + x0*x3*t2 + x0*x3 + x0*y1*y2 + x0*y1*z2 + x0*y1*t1 + x0*y1*t2 + x0*y1 + x0*y2*y3 + x0*y2 + x0*y3*z2 + x0*y3*t1 + x0*y3*t2 + x0*y3 + x0*z2 + x0*t1 + x0*t2 + x1*x2*y1 + x1*x2*z2 + x1*x2*t1 + x1*x2*t2 + x1*x2 + x1*y1*y2 + x1*y1*y3 + x1*y1 + x1*y2*z2 + x1*y2*t1 + x1*y2*t2 + x1*y2 + x1*y3*z2 + x1*y3*t1 + x1*y3*t2 + x1*y3 + x1*z2 + x1*t1 + x1*t2 + x1 + x2*x3*y0 + x2*x3*y1 + x2*x3*y3 + x2*x3*z2 + x2*x3*t1 + x2*x3*t2 + x2*y0*y2 + x2*y0*y3 + x2*y0*z2 + x2*y0*t1 + x2*y0*t2 + x2*y1*y3 + x2*y1*z2 + x2*y1*t1 + x2*y1*t2 + x2*y2*y3 + x2*y3 + x2*z2 + x2*t1 + x2*t2 + x3*y0*y1 + x3*y0*y2 + x3*y0*y3 + x3*y0*z2 + x3*y0*t1 + x3*y0*t2 + x3*y0 + x3*y1*y2 + x3*y2*y3 + x3*y2*z2 + x3*y2*t1 + x3*y2*t2 + x3 + y0*y1*y2 + y0*y1*y3 + y0*y1*z2 + y0*y1*t1 + y0*y1*t2 + y1*y2*z2 + y1*y2*t1 + y1*y2*t2 + y2*y3*z2 + y2*y3*t1 + y2*y3*t2 + y2*z2 + y2*t1 + y2*t2 + y2 + z1 + z3 + t0 + t1 + t2 + t3,
x0*x1*x3 + x0*x1*y0 + x0*x1*y1 + x0*x1*y2 + x0*x1*z2 + x0*x1*t1 + x0*x1*t2 + x0*x2 + x0*x3*y0 + x0*x3*y2 + x0*x3*y3 + x0*x3*z2 + x0*x3*t1 + x0*x3*t2 + x0*x3 + x0*y0*y1 + x0*y0*y3 + x0*y1*y2 + x0*y1*y3 + x0*y1*z2 + x0*y1*t1 + x0*y1*t2 + x0*y2*y3 + x0*y2 + x0*y3*z2 + x0*y3*t1 + x0*y3*t2 + x0*y3 + x0*z2 + x0*t1 + x0*t2 + x1*x2*x3 + x1*x2*y0 + x1*x2*y1 + x1*x2*y2 + x1*x2*z2 + x1*x2*t1 + x1*x2*t2 + x1*x3*y2 + x1*x3*y3 + x1*y0*y2 + x1*y0*y3 + x1*y1*y2 + x1*y1*y3 + x1*y2*y3 + x1*y2*z2 + x1*y2*t1 + x1*y2*t2 + x1*y2 + x1*y3*z2 + x1*y3*t1 + x1*y3*t2 + x1*y3 + x1*z1 + x1*z2 + x1 + x2*x3*y2 + x2*x3*z2 + x2*x3*t1 + x2*x3*t2 + x2*y0*y2 + x2*y0*z2 + x2*y0*t1 + x2*y0*t2 + x2*y0 + x2*y1*y2 + x2*y1*z2 + x2*y1*t1 + x2*y1*t2 + x2*y2 + x2*y3 + x2*z1 + x2*z3 + x2*t0 + x2*t3 + x2 + x3*y0*z2 + x3*y0*t1 + x3*y0*t2 + x3*y0 + x3*y2*y3 + x3*y2*z2 + x3*y2*t1 + x3*y2*t2 + x3*y3 + x3*z2 + x3*z3 + x3*t0 + x3*t3 + x3 + y0*y1*z2 + y0*y1*t1 + y0*y1*t2 + y0*y2*y3 + y0*z2 + y0*z3 + y0*t0 + y0*t3 + y0 + y1*y2*y3 + y1*y2*z2 + y1*y2*t1 + y1*y2*t2 + y1*z1 + y1*t1 + y1*t2 + y2*y3*z2 + y2*y3*t1 + y2*y3*t2 + y2*z2 + y2*t1 + y2*t2 + y2 + y3*z2 + y3*z3 + y3*t0 + y3*t3 + z3 + t1,
x0*x1 + x0*x3 + x0*y1 + x0*y3 + x0 + x1*x2 + x1*x3 + x1*y0 + x1*y1 + x1*z1 + x1*t1 + x1*t2 + x1 + x2*x3 + x2*y0 + x2*y1 + x3*y0 + x3*z1 + x3*t1 + x3*t2 + x3 + y0*y1 + y0*y2 + y0*z1 + y0*t1 + y0*t2 + y1*z1 + y1*t1 + y1*t2 + y1 + y3*z1 + y3*t1 + y3*t2 + z0 + z1 + t1 + t2 + t3 + 1,
x0*x1*x3 + x0*x1*y0 + x0*x1*y1 + x0*x1*y2 + x0*x1*z2 + x0*x1*t1 + x0*x1*t2 + x0*x1 + x0*x2 + x0*x3*y0 + x0*x3*y2 + x0*x3*y3 + x0*x3*z2 + x0*x3*t1 + x0*x3*t2 + x0*y0*y1 + x0*y0*y3 + x0*y1*y2 + x0*y1*y3 + x0*y1*z2 + x0*y1*t1 + x0*y1*t2 + x0*y1 + x0*y2*y3 + x0*y2 + x0*y3*z2 + x0*y3*t1 + x0*y3*t2 + x0*z2 + x0*t1 + x0*t2 + x1*x2*x3 + x1*x2*y0 + x1*x2*y1 + x1*x2*y2 + x1*x2*z2 + x1*x2*t1 + x1*x2*t2 + x1*x2 + x1*x3*y2 + x1*x3*y3 + x1*y0*y2 + x1*y0*y3 + x1*y1*y2 + x1*y1*y3 + x1*y2*y3 + x1*y2*z2 + x1*y2*t1 + x1*y2*t2 + x1*y3*z2 + x1*y3*t1 + x1*y3*t2 + x1*z1 + x1*z2 + x1 + x2*x3*y2 + x2*x3*z2 + x2*x3*t1 + x2*x3*t2 + x2*x3 + x2*y0*y2 + x2*y0*z2 + x2*y0*t1 + x2*y0*t2 + x2*y1*y2 + x2*y1*z2 + x2*y1*t1 + x2*y1*t2 + x2*y1 + x2*y2 + x2*y3 + x2*z1 + x2*z3 + x2*t0 + x2*t3 + x3*y0*z2 + x3*y0*t1 + x3*y0*t2 + x3*y2*y3 + x3*y2*z2 + x3*y2*t1 + x3*y2*t2 + x3*y2 + x3*y3 + x3*z2 + x3*z3 + x3*t0 + x3*t3 + x3 + y0*y1*z2 + y0*y1*t1 + y0*y1*t2 + y0*y1 + y0*y2*y3 + y0*z2 + y0*z3 + y0*t0 + y0*t3 + y1*y2*y3 + y1*y2*z2 + y1*y2*t1 + y1*y2*t2 + y1*y2 + y1*z1 + y1*t1 + y1*t2 + y2*y3*z2 + y2*y3*t1 + y2*y3*t2 + y2*y3 + y2*z2 + y2*t1 + y2*t2 + y2 + y3*z2 + y3*z3 + y3*t0 + y3*t3 + y3 + z0 + z1 + z3 + t0,
],
]
While the solutions of the new systems of equations changed (the input-output behaviour of each round), the overall input-output behaviour of the encryption function remains the same. Thus, encrypt(0x0, 0x0) with the new systems of equations will output the ciphertext(0x7, 0xf).
The transformation we just applied only protects the middle rounds, the round 1 in this case. To protect the first and last rounds, we need to compose the systems of equations of the first and last rounds with random permutations that will not be cancelled. These are called the external encodings; they make the implementation not functionally equivalent to the underlying cipher, but they are needed for security. Depending on the application there are different ways to deal with the external encodings, and you can read more about those in the first paper about white-box cryptography.
That was all for this brief introduction to the implicit framework. There are many details and many aspects of this method that were not mentioned here, but you can learn them in the paper. To generate the examples we used whiteboxarx, and you can also use this open-source tool to generate white-box implementations of ARX ciphers using the implicit framework.


