Aes1 2016
Aes1 2016
Aes1 2016
3.1 Introduction
In 2001 Rijndael became the official new encryption standard named Advanced
Encryption Standard (AES). It is the successor of the Data Encryption Standard
(DES) and won the competition, started by the National Institute for Standards
and Technology (NIST) in 1997, which we will briefly explain in Sect. 3.2. In this
competition Rijndael, which was proposed by Joan Daemen and Vincent Rijmen
[6], prevailed over the other proposals such as Mars by IBM [3], RC6 by RSA Labs
[19], Serpent by Ross Anderson et al. [1] and Twofish by Counterpane Inc. [20]. The
goal of this section is to give comprehensive explanations about the design criteria
of Rijndael and their specific realization.1
One of the AES requirements was that the submitted ciphers should be block
ciphers, which are used for computer security such as online banking, smart cards,
computer communication, etc. This means that input and output of the ciphers should
be one-dimensional array of bits.
In Sect. 3.3 we will show that there exists a bijection from the set of all one-
dimensional array of bits of length n to the set GF(2)[x]|n of all polynomials with
coefficients in GF(2) and degree less than n. Each of these polynomials and therewith
each one-dimensional array of bits of length n represents an element of the finite field
GF(2n ). In this section we will define the addition and multiplication of the finite field
GF(28 ) and the finite ring GF(232 ) and show how byte-addition, byte-multiplication,
4-byte-column-addition and 4-byte-column-multiplication are realized in Rijndael.
We will show that byte- and 4-byte-column-addition equal the bitwise XOR operation,
which can be efficiently evaluated. Further on, we show that byte-multiplication,
which equals the polynomial multiplication followed by the reduction via the modulo
1 Rudolf Ahlswede was invited with his group to the “Seminar Rijndael” in June 2001 in Paderborn.
There he noticed the very interesting mathematics of the new code. Therefore he decided to section
about it. His student Christian Heup wrote his dipolma thesis about this topic.
derive the unknown cipherkey. The set of chosen plaintexts are the so-called -sets,
which consists of 28 plaintexts in which all the 28 bytes at the same position of these
plaintexts sum up to zero. The property of Rijndael, which is exploited by this attack,
is that the steps SubBytes, ShiftRows and AddRoundKey do not destroy a -set and,
if the -sets are properly chosen, the MixColumns step maintains a -set two times.
This means that all the bytes at the same positions of the state sum up to zero until
the input of the third MixColumns step and since MixColumns is linear this property
is still true to its output state and therefore remains until the input of the fourth
MixColumns step. To obtain all bytes of one round key we then guess its value and
verify its correctness by summing up all bytes at the same position of the input state
of the fourth MixColumns step. If we obtain zero the guess was correct with some
probability, and if we do not obtain zero our guess was wrong. If we have found one
whole round key with this method, we are able to obtain the cipherkey by going the
Key Schedule algorithm the other way round.
The Data Encryption Standard (DES) describes the data encryption algorithm (DEA),
which is an improvement of the algorithm Lucifer developed by IBM in the early
1970s. This standard is up to now the most widely spread encryption algorithm in the
world. But since the development of the differential attack [2] and the linear attack
[13], it is no longer considered to be secure enough for security-critical applications.
For example the U.S. government is no longer allowed to use it. To gain a higher
security level, triple-DES was invented, which consists of the threefold application
of DES, but whose disadvantage is its efficiency.
In 1997 the National Institute for Standards and Technology (NIST) announced
the start of a competition, whose goal was to find an encryption algorithm to become
the Advanced Encryption Standard (AES).
The requirements to the submissions were that the algorithm should be a sym-
metric block cipher with 128-bit blocks and 128-, 192- and 256-bit keys, in contrast
to DES, which uses 56-bit keys and to 3-DES, which uses 112-bit keys. Further on,
the algorithm should offer at least as much security as 3-DES, but should be much
more efficient and finally the algorithm should be available royalty-free world-wide,
which includes that the security-testing would be realized by the world-wide cryptol-
ogy community and be therefore much more reliable. Another innovation was that the
submissions were international and not only reserved to American cryptographers.
In August 1998 the first AES conference was held and fifteen submissions were
accepted, where the first ones were submitted by companies and the last ones by
researchers:
158 3 The Mathematical Background of the Advanced Encryption Standard
At the second conference, which took place in Rome in 1999, the five finalists were
selected:
• Mars (IBM)
• RC6 (RSA)
• Rijndael (Daemen, Rijmen)
• Serpent (Anderson, Biham, Knudsen)
• Twofish (Counterpane Inc.)
The other submissions withdrew because of security or efficiency problems.
The final AES conference was held in 2000 in New York.
All finalists offered adequate security, but Rijndael was selected because of its
efficiency and its flexibility, which makes it usable on all kind of processors.
In this section we will introduce the theory of finite fields, especially the finite field
GF(28 ). We will represent the elements of GF(28 ) by polynomials of degree less
than 8 and show how byte-addition and byte-multiplication are defined in Rijndael.
We start with the two basic definitions of a finite field and the characteristic of a
finite field.
Definition 43 Let F be a set. A triple < F, ⊕, > is called a finite field of order
m, denoted by GF(m), if:
• < F, ⊕ > is an Abelian group, with 0 as the neutral element,
• < F\{0}, > is an Abelian group, with 1 as the neutral element,
• Distributivity holds: a (b ⊕ c) = a b ⊕ a c ∀ a, b, c ∈ F,
• |F| = m < ∞.
3.3 Finite Fields 159
Now we come to some well known results, for example see [12], from the theory of
finite fields, which we will need in the remaining section.
Theorem 57 A finite field exists and has order m, if and only if m is a prime power,
e.g. m = pk , with p ∈ Pand k ∈ N+ , where P is the set of all primes.
Theorem 58 All finite fields of the same order are isomorphic, they differ only in
the way of representing the elements.
From Theorems 57 and 58 it follows that for all p ∈ P and for all k ∈ N exists a
unique finite field with pk elements.
From Theorem 58 it follows that besides the definition of addition and multiplication,
we have to determine the representation of a finite field.
In Rijndael the polynomial representation is used, which means that every element
of GF(pk ) is represented by a polynomial of degree k − 1 and coefficients in GF(p).
This is done, because the definitions for addition and multiplication are quite intuitive
with the polynomial representation.
Definition 47 Let F be a field. F[x]|d is the set of all polynomials over F with degree
less than d.
In Rijndael we are only interested in the case F = GF(2k ). Since the construction of
both addition and multiplication does not depend on the structure of the underlying
field, we will do this in general for any field F.
160 3 The Mathematical Background of the Advanced Encryption Standard
In this section we will define the addition ⊕ and the multiplication in order to
give < F[x]|d , ⊕, > a field structure. To do this we have to choose a irreducible
reduction polynomial in order to make the multiplication closed.
ci = ai + bi ∀ i ∈ {0, . . . , d − 1},
Proof The associativity and commutativity follow directly from the field structure
of F. Now let z(x) ∈ F[x]|d be the polynomial with all its coefficients equal to
the neutral element for addition in the field F. It follows that z(x) is the neutral
element for addition in < F[x]|d , ⊕ > and it is denoted by 0. For a given polynomial
a(x) ∈ F[x]|d , the polynomial b(x) ∈ F[x]|d with bi = −ai , where −ai is the additive
inverse of ai in F, is the additive inverse of a(x) in < F[x]|d , ⊕ >. Finally, the above
defined addition is closed, which means a(x) ⊕ b(x) ∈ F[x]|d , because, on the one
hand, the addition in F is closed and from this it follows that all the coefficients
ai + bi are also in F. And on the other hand, deg(a(x) ⊕ b(x)) ≤ max{deg(a(x)),
deg(b(x))} < d.
As we can see this definition is equal to the known polynomial addition for any
polynomial over a field F. From now on we will denote both the above defined
addition and the normal polynomial addition with ⊕.
The definition for the multiplication is a bit more complicated, because we have
to do a so-called reduction in order to make the multiplication closed.
It is known that the polynomial multiplication ⊗ is associative, commutative,
distributive together with ⊕ and it has a neutral element e(x), denoted by 1, with
e0 = 1f and ei = 0f , for all i ≥ 1, where 1f is the neutral element for multiplication
and 0f is the neutral element for addition in the underlying field F. The problem is
that the multiplication of polynomials is not closed over F[x]|d , because deg(a(x) ⊗
b(x)) = deg(a(x)) + deg(b(x)), which could certainly be bigger than d − 1.
To solve this problem we select a reduction polynomial.
Claim q(x) and r(x) from the above definition are unique.
Proof Suppose there are q(x), r(x), q (x) and r (x), with:
(q(x) ⊗ m(x)) ⊕ r(x) = a(x) = (q (x) ⊗ m(x)) ⊕ r (x)
and deg(r(x)) < deg(m(x)), deg(r (x)) < deg(m(x))
⇒ (q(x) ⊕ (−q (x)))m(x) = r (x) ⊕ (−r(x))
⇒ q(x) = q (x) ⇒ r(x) = r (x),
because deg(m(x)) > max{deg(r(x)), deg(r (x))} ≥ deg(r (x) ⊕ (−r(x)))
Definition 51 Let F be a field and a(x), b(x) ∈ F[x]|d , then the multiplication is
defined by:
Together with the above definitions for the reduction polynomial and the residue
modulo m(x), it follows that the multiplication is closed over F[x]|d .
But it is still a Ring, because not every element of F[x]|d needs to have a mul-
tiplicative inverse. The reason for this is that until now the only restrictions to the
reduction polynomial are that its degree must equal d and md = 1f . So if we choose
the reduction polynomial m(x) = m1 (x) ⊗ m2 (x), with d > deg(m1 (x)) > 0 and
d > deg(m2 (x)) > 0, then any polynomial of the form a(x) = a1 (x) ⊗ m1 (x) or
b(x) = b1 (x) ⊗ m2 (x) has no multiplicative inverse. Because if we assume the oppo-
site that, for example for a(x) = a1 (x) ⊗ m1 (x) there exists a multiplicative inverse,
denoted by a−1 (x), it would hold that:
∃q(x) ∈ F[x] with: a(x) ⊗ a−1 (x) = (q(x) ⊗ m(x)) ⊕ 1
⇔ −(q(x) ⊗ m(x)) ⊕ (a(x) ⊗ a−1 (x)) = 1
⇔ (c1 (x) ⊗ m1 (x)) ⊕ (c2 (x) ⊗ m1 (x)) = 1,
where c1 (x) = −q(x) ⊗ m2 (x), c2 (x) = a1 (x) ⊗ a−1 (x)
⇔ m1 (x) ⊗ (c1 (x) ⊕ c2 (x)) = 1
And this is a contradiction. Because if c1 (x) ⊕ c2 (x) = 0, then
deg(m1 (x) ⊗ (c1 (x) ⊕ c2 (x))) > 0 and deg(1) = 0 and if c1 (x) ⊕ c2 (x) = 0,
it would follow that 0 = 1.
The same holds for any polynomial of the form b(x) = b1 (x) ⊗ m2 (x).
In order to obtain a field structure we have to choose a special kind of reduction
polynomial, which does not have the property that it can be decomposed into two
polynomials with degree bigger than zero. These polynomials are called irreducible.
Proof Given two polynomials a(x), m(x) ∈ F[x] the Extended Euclidean Algorithm,
which is described in Sect. 3.8 determines uniquely b(x), c(x) ∈ F[x], with (a(x) ⊗
b(x)) ⊕ (m(x) ⊗ c(x)) = gcd(a(x), m(x)) and deg(b(x)) < deg(m(x)). In our case
a(x) ∈ F[x]|d and m(x) is an irreducible reduction polynomial in F[x]|d .
It follows from Lemma 18 that gcd(a(x), m(x)) = 1.
⇒ (a(x) ⊗ b(x)) ⊕ (m(x) ⊗ c(x)) = 1
⇒ a(x) ⊗ b(x) = 1 (mod m(x))
⇒ a(x) b(x) = 1.
And since deg(b(x)) < deg(m(x)) = d, it follows b(x) ∈ F[x]|d .
That means, by applying the Extended Euclidean Algorithm we can determine the
unique multiplicative inverse for any given element of F[x]|d .
We showed that for any given field F we can construct a field < F[x]|d , ⊕, >
with |F|d elements. It follows that if |F| < ∞, also | < F[x]|d , ⊕, > | = |F|d <
∞. This means that if F is a finite field, for example F = GF(pk ), p ∈ P, then
< GF(pk )[x]|d , ⊕, >, is the finite field GF(pkd ). On the other hand, by starting
with GF(p), where F = {0, . . . , p − 1}, ⊕ is the addition modulo p and is the
multiplication modulo p, we can obtain the elements of GF(pkd ) for all k, d ∈ N, by
constructing the polynomials over GF(p) with degree less than kd.
The only thing left to do, is defining ⊕d and d . From this it immediately fol-
lows that both GF(p)[x]|kd and GF(pk )[x]|d represent the elements of GF(pkd ). That
means, with appropriate definitions for ⊕, , ⊕d and d , it follows that:
In Rijndael we are only interested in the finite fields with characteristic 2, in particular
in GF(28 ) and GF(232 ). The reason for that is that Rijndael is an block-cipher which
operates, on the one hand, on one-dimensional arrays of bits of length 8, called bytes,
which represent the elements of GF(28 ), and on the other hand, it deals with one-
dimensional arrays of bytes of length 4, called 4-byte columns, which represent the
elements of GF(232 ).
As shown above, there are different ways to construct GF(2kd ). In the case of
bytes, GF(28 ) is constructed via < GF(2)[x]|8 , ⊕, > and in the case of 4-byte
columns, GF(232 ) is constructed via < GF(28 )[x]|4 , ⊕, >.
3.3 Finite Fields 163
From now on we will denote both the addition of bytes and XOR by ⊕.
Remark 30 Since the characteristic of GF(28 ) is 2, every element is its own additive
inverse.
164 3 The Mathematical Background of the Advanced Encryption Standard
Byte-Multiplication
In order to define the multiplication of GF(28 ) we have to choose an irreducible
reduction polynomial m(x) in GF(2)[x]|8 .
In Rijndael m(x) := x 8 + x 4 + x 3 + x + 1 ∼ 100011011 = “11B” is chosen to
be this reduction polynomial.
The first step is to obtain the product of “57” with all the monomials of “13”.
Since “13” ∼ x 4 + x + 1, it suffices to apply xtime four times to obtain “10” ∼ x 4 .
“57” = 01010111
4-Byte-Column-Addition ⊕
As shown before the addition of a 4-byte-column consists of the addition of the
coefficients in GF(28 ). Since this addition is only a bitwise XOR of the individual
bits, again the addition of a 4-byte-column equals a bitwise XOR, not only over the
bits of one byte, but over all the bits of the two 4-byte-columns. Therefore we will
denote the 4-byte-column-addition also with ⊕.
4-Byte-Column-Multiplication •
In order to get a closed multiplication we have to choose a reduction polynomial. For
the multiplication of 4-byte-columns l(x) := x 4 + 1 ∈ GF(28 )[x]|4 was chosen. In
GF(2k ) this polynomial satisfies the “Freshman’s Dream”, which means that x 4 +1 =
(x + 1)4 , and from this it follows that l(x) is not irreducible. This property holds for
a
every polynomial x 2 + 1 ∈ GF(2k )[x]|d , where k ∈ N and 2a < d.
d0 = c0 a0
d1 = c1 a0 ⊕ c0 a1
d2 = c2 a0 ⊕ c1 a1 ⊕ c0 a2
d3 = c3 a0 ⊕ c2 a1 ⊕ c1 a2 ⊕ c0 a3
d4 = c3 a1 ⊕ c2 a2 ⊕ c1 a3
d5 = c3 a2 ⊕ c2 a3
d6 = c3 a3
Now we come to the claim, which is the basis for the choice of l(x) = x 4 + 1.
In this section we will give some important definitions about boolean functions and
introduce the key-iterated block cipher.
168 3 The Mathematical Background of the Advanced Encryption Standard
Firstly, we give the definition of a boolean vector, which is, as we will see, the input
and the output of Rijndael.
b ∈ GF(2)n .
Rijndael is a cipher, which operates on bytes. We have seen in the last section, that
any boolean vector of length n represents an element of the finite field GF(2n ). We
will now define a boolean function, which operates on the finite field GF(2n ).
χ : GF(2)n → GF(2)n .
We come now to three special boolean functions. The bricklayer function, the trans-
position and the iterative boolean function. As we will see, Rijndael is an iterative
boolean permutation, which concatenates several boolean round functions. These
boolean round functions are again iterative boolean permutations, which consist of
three individual boolean permutations, namely a non-linear bricklayer permutation,
a transposition and a linear bricklayer permutation.
The input of Rijndael consists of the plaintext and the cipherkey, the output is the
encrypted plaintext, called the ciphertext.
Rijndael is a symmetric cipher, which means that the same cipherkey is used for
both encryption and decryption.
A block cipher is a cipher, where the plaintext is a one-dimensional array of bits
of an arbitrary length, which is divided into several blocks, which are again one-
dimensional array of bits, but all of the same given length NB . All of these blocks are
encrypted separately and in the same way, which means with the same algorithm and
the same cipherkey. After the encryption of the blocks, the derived ciphertext-blocks,
which are still of the same length NB , are stuck together in order to obtain the whole
ciphertext.
From now on, we will speak of only one block to be the input of a block cipher
and therefore the output is also only one ciphertext block. Of course, every ciphertext
block has to be uniquely decryptable into the same plaintext block from which it was
encrypted in order to make a cipher work. In other words, the encryption has to be
invertible. Since the plaintext block is a one-dimensional array of bits of length NB ,
it follows that a block cipher is a boolean permutation which operates on an NB -bit
state.
An iterated block cipher consists of several rounds and in every round a round
transformation is applied to the block. Each round transformation does not change
the length of its input vector and since the whole cipher has to be invertible, every
single round transformation has to be invertible, too.
Similar to the whole cipher, the round transformations are also boolean permuta-
tions, which operate on NB -bit states. The individual round transformations depend
on individual roundkeys, which are derived form the cipherkey. So if we denote the
ith round transformation with ρi , the ith roundkey with κi , the whole block cipher
with B and the number of rounds with Nr , an iterated block cipher can be written as
follows:
B = ρNr [κNr ] ◦ ρNr −1 [κNr −1 ] ◦ · · · ◦ ρ1 [κ1 ].
In a key-alternating block cipher each key-depended round transformation can be
decomposed into a key-independent round transformation ρi and an addition of the
roundkey, which is denoted by σ[κi ], and an additional key-addition of the 0th
170 3 The Mathematical Background of the Advanced Encryption Standard
roundkey, which is applied before the first round transformation ρ1 . With this notation
a key-iterated block cipher can be written in the following form:
A key-iterated block cipher is a key-alternating block cipher, where all rounds, except
perhaps the first or the last, use the same round transformation ρ:
In this section we will introduce the Wide Trail Strategy, which was developed by
Joan Daemen in his doctoral dissertation [5]. The first section introduces linear trails.
In a linear attack of a key-iterated block cipher a attacker needs to find linear trails
over all but a few rounds with a high correlation. In the second section we come to
differential trails, which are needed in differential cryptanalysis. In the third section
the properties of linear and differential trails, derived in the first both sections, are
used to design a key-iterated block cipher, which is secure against both attacks.
Correlation
In this first subsection we will explain what is meant by a correlation between two
binary boolean functions.
C( f , g) := 2 · Prob( f = g) − 1,
where Prob(f = g) := 1
2n
· #{i ∈ {0, . . . , 2n − 1}|f (ai ) = g(ai ), ai ∈ GF(2)n }
⎛ ⎞
fˆ (a0 )
⎜ .. ⎟
⎝ . ⎠ (aj ∈ GF(2)n , j ∈ {0, . . . , 2n − 1}).
fˆ (a2n −1 )
fˆ (aj ) is then the jth component of this vector.
We denote the above vector by fˆ and since fˆ determines f uniquely, we will say
that the vector fˆ represents the binary boolean function f .
n
From the definitions of the inner product and the norm in < R2 , +, . > follow
directly the definitions of the inner product and the norm of two binary boolean
functions.
Definition 67 The inner product of two binary boolean functions f and g is defined
as:
2
n
−1
ˆ
< f , g >:=< f , ĝ >= fˆ (ai )ĝ(ai ).
i=0
It follows that: ||fˆ || = 2 2 , since fˆ (ai )fˆ (ai ) = 1, for all i ∈ {0, . . . , 2n − 1}.
n
< fˆ , ĝ >
C(f , g) = .
||fˆ || · ||ĝ||
172 3 The Mathematical Background of the Advanced Encryption Standard
Proof
−1
2n
<fˆ ,ĝ>
= 2−n fˆ (ai )ĝ(ai )
||fˆ ||·||ĝ|| i=0
= 2−n ( 1− 1)
f (ai )=g(ai ) f (ai )=g(ai )
= 2 · Prob(f = g) − 1
= C(f , g)
In other words, the correlation between two binary boolean functions is the angle
n
between their representing vectors in < R2 , +, . >.
i=0
2
n
−1 T
ai ⊕v T ai
= (−1)u
i=0
2
n
−1
(−1)(u⊕v)
T
= ai
i=0
Since we sum up over all ai ’s, the sum contains exactly 2n−1 1’s and 2n−1 (−1)’s, if
u ⊕ v = 0, and therefore sums up to 0.
And if u ⊕ v = 0, every addend equals 1 and we obtain 2n .
We have shown that all the 2n parities are pairwise orthogonal and therefore form
n
an orthogonal basis in < R2 , +, . >.
This means that the representing vector fˆ of every binary boolean function f can be
written as the linear combination of the parity vectors:
fˆ =
T
λu (−1)u _
.
u
The next proposition shows that the coefficients λu equal the correlation C(f , uT _ )
between the binary boolean function f and the parity uT _ , which means that a binary
boolean function f can be completely determined by the correlations between itself
and its input parities uT _ .
3.5 The Wide Trail Strategy 173
Proof
2
n
−1
= 2−n fˆ (aj )(−1)u aj ) (−1)u ai
T T T
C(f , uT _ )(−1)u ai
(
u u j=0
2
n
−1
= 2−n fˆ (aj )(−1)u aj (−1)u ai
T T
u j=0
2
n
−1
= 2−n fˆ (aj )(−1)u (aj ⊕ai )
T
u j=0
= 2−n (fˆ (ai ) + fˆ (aj )(−1)u (aj ⊕ai ) )
T
u j=i
= fˆ (ai ) + 2−n fˆ (aj )(−1)u (aj ⊕ai )
T
u j=i
= fˆ (ai ) + 2−n fˆ (aj )(−1)u (aj ⊕ai )
T
j=i u
=0
= fˆ (ai )
As a special case it holds for an output parity w T f of an binary boolean function and
for every ai that:
T
w T f (ai ) = C(w T f , uT _ )(−1)u ai .
u
F(u) := C(f , uT _ ).
Correlation Matrices
Up to now we have only considered binary boolean functions.
We come now to the more general case of boolean transformations, which can be
represented by their correlation matrix.
Reminding of Definition 57 a boolean transformation χ is a boolean function,
operating on a n-bit state:
174 3 The Mathematical Background of the Advanced Encryption Standard
χ : GF(2)n → GF(2)n .
C χ = (Cw,u
χ
), with
χ
Cw,u := C(w T χ, uT _ ).
It can be proved in the same way like in the proof of Proposition 19 that it holds for
every ai :
(−1)w χ(ai ) = χ
T T
Cw,u (−1)u ai .
u
Hence, each row of the correlation matrix expresses an output parity of a boolean
transformation with respect to its input parities.
χ χ
Definition 71 The linear weight wl (w, u) of a correlation Cw,u between an output
parity w χ and an input parity u _ of a boolean transformation χ is defined via:
T T
χ χ
wl (w, u) := −log2 (Cw,u ).
3.5 The Wide Trail Strategy 175
We will now consider two special cases of boolean transformations, iterative boolean
transformations and bricklayer transformations, which we will need in the remaining
section.
C π = C π1 × C π0 .
π1
π0 T
= Cw,v Cv,u (−1)u ai
v u
π1 π0 T
= Cw,v Cv,u (−1)u ai .
u v
From this proposition follows for π = π1 ◦ π0 that the correlation between an output
parity w T π and an input parity uT _ of π is given by:
C(w T π, uT _ ) = C(w T π1 , v T _ )C(v T π0 , uT _ ). (3.5.1)
v
C π = C πk−1 × · · · × C π0 .
We have n = knh and denote the ith nh bits of an n-bit state a by a(i) .
With this notation we have:
It follows that:
k−1
h= hi .
i=0
Lemma 19 For two binary boolean functions f and g, with spectra F(u) and G(v),
let h := f ⊕ g. Then it holds for the spectrum H(w) of h:
H(w) = F(u) ⊗ G(v) := F(v ⊕ w)G(v).
v
Proof Firstly, we show that the real-valued counterpart of the XOR ⊕ of two binary
boolean functions is the product of the individual real-valued counterparts.
F(u)G(v)(−1)(u⊕v)
T
= ai
u v
F(v ⊕ w)G(v) (−1)w
T
= ai
w v
As mentioned on p. 28, from this lemma follows that the spectrum Wχ of the output
parity w T χ of χ is:
Wχ (u) = C(w T χ, uT _ ) = Xi (u).
ui =1
The following property holds for the support space of the XOR of two binary boolean
functions.
Lemma 20 Let f and g be two binary boolean functions with support spaces Vf and
Vg and let h = f ⊕ g.
Then it holds for the support space Vh of h:
Vh = Vf ⊕g ⊆ Vf ⊕ Vg .
= F(v ⊕ w)G(v)
v∈Vg ∧(v⊕w)∈Vf
Definition 73 Two binary boolean functions f and g are called disjoint, if it holds
for their support spaces Vf and Vg :
178 3 The Mathematical Background of the Advanced Encryption Standard
Vf ∩ Vg = {0}.
Lemma 21 Let f and g be two disjoint binary boolean functions with spectra F(u)
and G(v) and let h = f ⊕ g.
Then there exist unique u ∈ Vf and v ∈ Vg , with w = u ⊕ v ∈ Vh and it holds for
the spectrum H(w) of h:
Proof Lemma 20 states that each w ∈ Vh can be written as the XOR of u ∈ Vf and
v ∈ Vg . Suppose there exist u, u ∈ Vf and v, v ∈ Vg and it holds that:
With this lemma we are able to show how the correlation matrix of a bricklayer
transformation can be derived from the correlation matrices of its underlying boolean
transformations.
k−1
k−1
Cw,u
h
= Cwhi(i) ,u(i) ⇔ wlh (w, u) = wlhi (w(i) , u(i) ),
i=0 i=0
Proof Like we have done above with the individual hi ’s, we write the individual
w(i) ’s in the following form:
j
w(i) = (w(i)
0
, . . . , w(i)
n−1
), with w(i) = 0, if j ∈
/ {inh , . . . , (i + 1)nh − 1}.
k−1
k−1
w= w(i) and u = u(i) .
i=0 i=0
Now we denote the spectrum of wT h by Wh (u) and the spectra of w(i) T hi by Whi (u(i) ).
Further on, we denote the support spaces of w(i) T hi by Vi .
From the structure of hi and w(i) it follows that:
We are now in the situation of Lemma 21 and an iterated application of this lemma
yields to:
k−1
Wh (u) = Whi (u(i) ).
i=0
Linear Trails
We will now define a linear trail and the weight of a linear trail and finish this
subsection with the Theorem of Linear Trail Composition.
Let ρ be an iterative boolean transformation, operating on a n-bit state:
ρ = ρr−1 ◦ · · · ◦ ρ0 .
C ρ := C ρr−1 × · · · × C ρ0 ,
Uρ = u(0) , . . . , u(r) ,
for which each of the r steps (u(i) , u(i+1) ) (i ∈ {0, . . . , r − 1}) has a correlation given
by:
ρ T T
Cu(i+1)
i
, u(i)
= C(u(i+1) ρi , u(i) _ ) = 0.
r−1
ρ
Cp (Uρ ) := Cu(i+1)
i
, u(i)
.
i=0
It follows that the weight of a linear trail is the sum of the linear weights of the
correlations of its steps:
r−1
ρ
wl (Uρ ) = wl i (u(i+1) , u(i) ). (3.5.2)
i=0
2
n
−1
χ −n
Prob (a , b ) := 2 δ(b ⊕ χ(ai ⊕ a ) ⊕ χ(ai )),
i=0
1, if x = 0
where δ(x) := is the Kronecker delta function.
0, if x = 0
χ
Definition 79 The differential weight wd (a , b ) of a difference propagation (a , b )
through χ is defined via:
χ
wd (a , b ) := −log2 (Probχ (a , b )).
b = χ(ai ⊕ a ) ⊕ χ(ai ).
For given difference patterns a and b , Probχ (a , b ) is the fraction of the set of all
n-bit vectors, for which a propagates to b .
We denote the set of all ai ’s, for which b = χ(ai ⊕ a ) ⊕ χ(ai ) by:
and obtain:
#M = 2n Probχ (a , b ) = 2k, for k ∈ {0, . . . , 2n−1 }.
If k = 0, we say that a and b are incompatible and from now on we will only
consider the case k = 0.
182 3 The Mathematical Background of the Advanced Encryption Standard
k−1
k−1
Probh (a , b ) = Probhi (a(i) , b(i) ) ⇔ wdh (a , b ) = wdhi (a(i) , b(i) ).
i=0 i=0
Proof Let:
M := {aj ∈ GF(2)n | b = h(aj ⊕ a ) ⊕ h(aj )}
k−1
#M = #Mi .
i=0
We obtain:
k−1
k−1
Probh (a , b ) = 2−n #M = 2−n #Mi = 2−ni #Mi
i=0 i=0
k−1
= Probhi (a(i) , b(i) )
i=0
Differential Trails
Let ρ = ρr−1 ◦ · · · ◦ ρ0 be an iterative boolean transformation with r rounds. We will
now define a differential trail and the weight of a differential trail.
3.5 The Wide Trail Strategy 183
Qρ := (q0 , . . . , qr ),
for which each of the r steps (qi , qi+1 ), for i ∈ {0, . . . , r − 1}, has a differential
weight given by:
ρ
wdi (qi , qi+1 ).
r−1
ρ
wd (Qρ ) := wdi (qi , qi+1 ).
i=0
With this definitions we are ready to define the difference propagation probability of
an iterative boolean transformation over r rounds.
In linear cryptanalysis the attacker needs to know a correlation over all but a few
rounds with a high amplitude and in differential cryptanalysis he needs to know an
input difference, which propagates to an output difference with a high probability.
The approach of the Wide Trail Strategy is to design a key-iterated block cipher,
which combines security and efficiency. By security we mean that there do not exist
any low weighted linear or differential trails.
The γλ Round Structure
Each round transformation ρ consists of two layers γ and λ, where γ is a non-linear
bricklayer permutation and λ is a linear permutation, which provides a high diffusion:
ρ = λ ◦ γ.
The Construction of γ
The first layer γ is a non-linear bricklayer permutation, which means that it consists
of nγ invertible S-boxes Sγi , operating independently on different bits of the state.
The first construction step is that all the Sγi ’s operate on the same number m of
bits. This restricts the block length n to be nγ · m.
This partition of the n-bit state according to γ, is called the bundle partition of γ.
The second construction step is that Sγi operates on the ith bundle a(i) :
From Proposition 22 follows that the linear weight of a correlation between an output
and an input parity of γ is the sum of the linear weights of the correlations between the
particular output and input parities of Sγi . And from Proposition 24 follows that the
differential weight of an difference propagation of two difference patterns through γ
is the sum of the differential weights of the difference propagations of the particular
difference patterns through Sγi .
u(i) = 0.
q(i) = 0.
Definition 90 The bundle weight wb (a) of a state a is the number of active bundles
in a.
Let us consider a linear trail. From the above definitions follows that:
wb (u) = wb (a),
if u is the input selection pattern and a is the input state of the same round.
The same holds for differential trails:
wb (q) = wb (a),
if q is the input difference pattern and a is the input state of the same round.
If the input selection pattern u(i) is zero it follows that the output selection w(i)
is zero, because otherwise:
2
m
−1
−m
(−1)w(i) Sγi (aj ) = 0
T
T
C(w(i) Sγi , 0) =2
j=0
and hence:
Sγ
wl i (0, 0) = 0. (3.5.3)
Similarly, if the input difference pattern a(i) is zero it follows that b(i) is zero and
therewith:
2
m
−1
−m
Prob (0, 0) = 2
Sγi
δ(Sγi (aj ) ⊕ Sγi (aj )) = 1
j=0
and hence:
Sγ
wd i (0, 0) = 0. (3.5.4)
Definition 91 The bundle weight wb (Uρ ) of a linear trail Uρ is the sum of the
bundle weights of the input states of the individual rounds.
Let us assume that the round transformation ρ consist only of the non-linear bricklayer
permutation γ and consider a linear (differential) trail Uρ = (u(0) , . . . , u(r) ) (Qρ =
(q0 , . . . , qr )) over r rounds.
Applying Eq. (3.5.2), Proposition 22 and Eq. (3.5.3) we obtain:
γ −1
r−1
ρ
r−1 n
Sγ(i+1) (i)
wl (Uρ ) = wl i (u(i+1) , (i)
u )= wl j (u(j) , u(j) )
i=0 i=0 j=0
Sγ(i+1) (i)
≥ wb (Uρ ) · min wl j (u(j) , u(j) ) (3.5.5)
i∈{0,...,r−1},j∈{0,...,nγ −1}
From this follows the third construction step, which is to find a S-box Sγ with good
non-linearity properties and use this on all nγ bundles a(i) .
S (i+1) (i)
By good non-linearity properties we mean that the minimum of wl γ (u(j) , u(j) )
S
and wdγ (q(j) i , q(j) i+1 ) should be high.
In [16] Kaisa Nyberg gave several examples for S-boxes with good non-linearity
properties.
With this construction step Eqs. (3.5.5) and (3.5.6) become:
S
wl (Uρ ) ≥ wb (Uρ ) · min wl γ (u(j)
i+1
, u(j)
i
) (3.5.7)
i∈{0,...,r−1},j∈{0,...,nγ −1}
and:
S
wd (Qρ ) ≥ wb (Qρ ) · min wdγ (q(j) i , q(j) i+1 ). (3.5.8)
i∈{0,...,r−1},j∈{0,...,nγ −1}
Equations (3.5.7) and (3.5.8) provide two possibilities to increase the lower bounds
of linear and differential trails. The first is, to construct a S-box with a high minimum
linear and differential weight, but both minimum weights are upper bounded by the
number of bits on which the S-box operates. This would mean we have to increase
the bundle size m. This has a high implementation cost and hence this disagrees with
the efficiency approach of the Wide Trail Strategy. The second possibility is to extend
the round transformation ρ by the linear diffusion step λ, which increases the bundle
weight of linear and differential trails.
Branch Numbers
All the discussions in this subsection are done with respect to the bundle partition
given by γ.
λ is a linear boolean permutation λ : GF(2)n → GF(2)n , with λ(a) = Ma, where
M is a binary n × n matrix.
3.5 The Wide Trail Strategy 187
= δ((MT w) ⊕ u).
If the boolean permutation is linear and denoted by λ, the branch number is defined
via:
Bl (λ) := min{wb (u) + wb (MT u)}.
u=0
If the boolean permutation is linear and denoted by λ, the branch number is defined
via:
Bd (λ) := min{wb (a ) + wb (Ma )}.
a =0
The remaining discussions of this subsection are valid both for linear and differential
branch numbers so that we denote both Bl and Bd by B and speak of a pattern, instead
of a selection or difference pattern.
Since the output pattern corresponding to an input pattern with a single non-zero
bundle has at least one and at most nγ non-zero bundle(s), it holds for the branch
number B(λ) of a linear permutation:
2 ≤ B(λ) ≤ nγ + 1. (3.5.9)
B(ϕ) = B(ϕ−1 ).
188 3 The Mathematical Background of the Advanced Encryption Standard
• a pattern is not affected by a key addition and hence its bundle weight is not affected
• a bricklayer permutation operates independently on individual bundles and there-
fore cannot turn an active bundle into a non-active bundle and vice versa. Hence,
it does not affect the bundle weight
• if ρ is a γλ round transformation it follows:
B(ρ) = B(λ).
Let us consider a key-iterated block cipher over two rounds with a γλ round trans-
formation ρ. The bundle weight of a two-round trail is the number of active bundles
at the input of the first and at the input of the second round. The state of the input
of of the second round is the XOR of the output of the first round and a round key.
With the above properties we obtain the following theorem.
The Construction of λ
According to Theorem 61, one possibility to obtain high lower bounds on the bundle
weight of multiple round trails would be to construct the linear diffusion layer λ as a
linear boolean permutation with a high branch number. Similar to large S-boxes this
has a high implementation cost and hence contradicts to the efficiency approach of
the Wide Trail Strategy.
Instead, the Wide Trail Strategy suggests the construction of a key-iterated block
cipher, whose linear diffusion layer λ consists of a sequence of two steps:
• θ: a linear bricklayer permutation, which offers a high local diffusion. The D-boxes
of θ operate independently on columns, which consists of bundles with respect to
the bundle partition of γ.
• π: a transposition, which provides a high dispersion. Dispersion means that bun-
dles, which are in the same column are moved to different columns.
The Construction of θ
The diffusion step θ is a linear bricklayer permutation, which consists of nθ D-boxes
Dθj operating independently on different bundles with respect to the bundle partition
of γ.
The first construction step of θ is that each of the D-boxes operates on the same
number nξ of bundles. This restricts the number nγ of bundles to be nθ · nξ and hence
the block size n to be nθ · nξ · m.
Definition 95 Let c ∈ GF(2)n which has been partitioned into bundles c(i) , for
i ∈ {0, . . . , nγ − 1}, with respect to the bundle partition of γ.
3.5 The Wide Trail Strategy 189
Similar to the construction of γ, the second construction step is that the D-box Dθj
operates on column c(j) . Since the D-boxes are linear, they can be written as a nξ × nξ
matrix Dθ(j) :
d (j) = Dθj (c(j) ) = Dθ(j) c(j) . (3.5.10)
The measure for diffusion is the branch number B(θ). Since the output state of θ
corresponding to the input state with one active bundle in one column active has at
least one and at most nξ active bundles, it follows:
2 ≤ B(θ) ≤ nξ + 1. (3.5.11)
The third construction step is then to find a D-box with the maximum branch number
nξ + 1 and once it is found this one is used on every column.
We can now define the diffusion step θ.
Definition 96 The linear bricklayer permutation θ : GF(2)mnξ → GF(2)mnξ is
defined by:
Since nξ = nθ−1 · nγ , the implementation cost of a linear diffusion step with branch
number nξ + 1 is much lower than the cost of one with branch number nγ + 1.
We can now adopt Theorem 61 and obtain the following proposition:
Proposition 25 For a key-iterated block cipher over two rounds, in which the first
round transformation has a γθ structure, it holds for any two-round trail Tγθ :
wb (Tγθ ) ≥ NB(θ),
where N is the number of active columns at the input of the second round.
Proof We can apply Theorem 61 to each column separately. Each active column at
the input of the second round imposes that the same column was active at the input
of the first round and hence there are at least B(θ) active bundles in that column in
both input states together.
190 3 The Mathematical Background of the Advanced Encryption Standard
The Construction of π
We will now define the transposition π and introduce the diffusion optimality, which
means that π offers the highest possible dispersion.
where p(i) is a permutation of the bundle partition of γ. The inverse bundle trans-
position π −1 is defined by:
Definition 98 A column c(j) is called active if at least one of its bundles c(jnξ ) ,
. . . , c((j+1)nξ −1) is active.
Definition 100 The column branch number B c () of a linear boolean permutation
is defined as:
We will show now that if π is properly chosen the column branch number of π ◦ θ ◦ π
equals the branch number of θ.
Definition 101 The bundle transposition π is called diffusion optimal, if and only
if all bundles, which were in the same column of the input state of π are in different
columns of its output state.
B c () = B(θ).
3.5 The Wide Trail Strategy 191
Proof Let a denote the input state of , d denote its output state and b and c its
intermediate states, with:
wb (b(j) ) = 1.
The property that θ has a maximum branch number B(θ) induces that there exists
exactly one column c(j) in c, with:
wb (c(j) ) = B(θ) − 1.
Since π is diffusion optimal, all the B(θ) − 1 active bundles in c(j) are mapped to
different columns of d and this yields to:
wc (d) = B(θ) − 1.
B c () ≤ B(θ).
If b(j) and hence c(j) would be the single active columns in b and c it would follow
by the diffusion optimality of π and π −1 that:
But if the number of active columns in b and c is greater than 1 it could occur that:
Altogether, we have:
(j)
wc (a) + wc (d) ≥ wb (b(j) ) + wb = B(θ).
Now we are able to prove the final statement of the Wide Trail Strategy.
192 3 The Mathematical Background of the Advanced Encryption Standard
Proof Consider four rounds of a key-iterated block cipher with a γπθ round trans-
formation:
B4 = (θ ◦ π) ◦ (θ ◦ π) ◦ (θ ◦ π) ◦ (θ ◦ π)
= θ ◦ π ◦ θ ◦ (π ◦ θ ◦ π) ◦ θ ◦ π.
Since π does not change the number of active bundles and θ does not change the
number of active columns, it holds inter alia:
(i) wb (a ) = wb (a)
(ii) wb (c ) = wb (c)
(iii) wc (d) = wc (c )
Since c = π(θ(π(b))), it follows from (3.5.12) and (iii):
Together we have:
and:
S
wd (Qρ ) ≥ B(θ)2 · min wdγ (q(j) i , q(j) i+1 ). (3.5.15)
i∈{0,...,r−1},j∈{0,...,nγ −1}
To construct a key-iterated block cipher, which resists linear and differentials attacks,
we have to give it a γπθ round transformation, where Sγ operates on only a small
number of bits with a high minimum linear and differential weight, π is diffusion
optimal and θ has the maximum possible branch number. It follows from Theorem 62
that Eqs. (3.5.14) and (3.5.15) hold for any four-round trail. To obtain a given security
level we only have to increase the number of rounds, which will increase the bundle
weight of any trails over all but a few rounds of the cipher.
In this section we will explain exact specifications of Rijndael and show how the
individual steps of the round transformations work.
Rijndael is a key-iterated block cipher. It was developed to work for different
values of the block length NB and the cipherkey length NC . Both are either 128,
192 or 256 bits. The number of rounds Nr depends on NB and NC and is defined as
follows:
⎧
⎨ 10, if max{NB , NC } = 128
Nr := 12, if max{NB , NC } = 192
⎩
14, if max{NB , NC } = 256
The design of Rijndael was derived from the Wide Trail Strategy and therefore it
has a linear and a non-linear layer. The non-linear layer consists of one step, the
SubBytes step, and the linear layer consists of two steps, the ShiftRows step and the
MixColumns step. Each round transformation is followed by a Key Addition with the
particular roundkey which is derived from the cipherkey via the Key Schedule.
194 3 The Mathematical Background of the Advanced Encryption Standard
The last section of this section covers the decryption, which has the nice added
feature that it can be done in mainly the same way as the encryption.
As explained in Sect. 3.4 the inputs of Rijndael are the plaintext block, which is an
one-dimensional array of bits of length NB and the cipherkey, a one-dimensional
array of bits of length NC . The plaintext block is also a one-dimensional array of
bytes of length 18 NB , which is denoted by p0 p1 . . . p 18 NB −1 . Similarly the output, which
is the ciphertext block, is a one-dimensional array of bytes of length 81 NB , denoted
by c0 c1 . . . c 18 NB −1 .
All steps of Rijndael, this means the round transformations and all their individual
steps and the roundkey addition, operate on the intermediate results, called the states.
Each state can be seen as a two-dimensional array of bytes with four rows and
Nb := 32 1
NB columns. Figure 3.1 shows the state for NB = 128.
The very first step of Rijndael is the mapping of the plaintext block p0 . . . p 18 NB −1
to the state. This is done via the following equation:
This means that the state is ‘filled up’ column by column from the upper left to the
lower right with the individual bytes of the plaintext block.
After the last step of the encryption the final state is mapped on the ciphertext
block via:
ci = ai mod 4, 4i , for i ∈ {0, . . . , 4Nb − 1}.
So the state is ‘released’ into the ciphertext block again column by column from the
upper left to the lower right.
g : GF(28 ) → GF(28 )
g(a) = a−1 ,
SRD
The disadvantages of this choice for the S-box are, on the one hand, the fact that
g(“00”) = “00” and on the other hand, this function has a very simple algebraic
expression, since a−1 = a254 in GF(28 ). This fact would offer vulnerability against
the interpolation attack [11], which was developed by Thomas Jakobsen and Lars
R. Knudsen.
To get rid of these two disadvantages we combine the non-linear permutation g
with the affine permutation f , which is defined as follows:
f : GF(28 ) → GF(28 )
f (a) = b
¨
⎛ ⎞ ⎛ ⎞⎛ ⎞ ⎛ ⎞
b0 1 0 0 0 1 1 1 1 a0 1
⎜ b1 ⎟ ⎜ 1 1 0 0 0 1 1 1⎟ ⎜ a1 ⎟ ⎜ 1 ⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ b2 ⎟ ⎜ 1 1 1 0 0 0 1 1⎟ ⎜ ⎟ ⎜ ⎟
⎜ ⎟ ⎜ ⎟ ⎜ a2 ⎟ ⎜ 0 ⎟
⎜ b3 ⎟ ⎜ 1 1 1 1 0 0 0 1⎟⎜ ⎟ ⎟ ⎜ ⎟
⎜ ⎟=⎜ ⎜ a3 ⎟ ⊕ ⎜ 0 ⎟
⎜ b4 ⎟ ⎜ 1 ⎟
1 1 1 1 0 0 0 ⎟ ⎜ a4 ⎟⎜ ⎜ ⎟
⎜ ⎟ ⎜ ⎟ ⎜0⎟
⎜ b5 ⎟ ⎜ 0 ⎟ ⎜
1 1 1 1 1 0 0 ⎟ ⎜ a5 ⎟ ⎜ ⎟ ⎟
⎜ ⎟ ⎜ ⎜1⎟
⎝ b6 ⎠ ⎝ 0 0 1 1 1 1 1 0 ⎠ ⎝ a6 ⎠ ⎝ 1⎠
b7 0 0 0 1 1 1 1 1 a7 0
SRD (a) = “05” a254 ⊕ “09” a253 ⊕ “F9” a251 ⊕ “25” a247
⊕ “F4” a239 ⊕ “01” a223 ⊕ “B5” a191 ⊕ “8F” a127 ⊕ “63”.
Together with the linear layer, consisting of ShiftRows and MixColumns, this expres-
sion offers sufficient security against the interpolation attack.
There is one other fact about the affine permutation f . As we see, the matrix
which defines f is a circulant (8 × 8)-matrix. So if we go the other way round as in
the subsection “The Finite Ring < GF(28 )[x]|4 , ⊕, • >” of Sect. 3.3.3, where we
showed that the multiplication by a fixed polynomial in < GF(28 )|4 , ⊕, • > can
be written as a circulant (4 × 4)-matrix, then we can show that f can be seen as
a multiplication by a fixed polynomial c(x), with m (x) = x 8 + 1 as the reducible
reduction polynomial, followed by an addition with d(x) = x 6 + x 5 + x + 1. Since in
this case, the first row of the matrix would be (c0 c7 c6 c5 c4 c3 c2 c1 ), this
fixed polynomial has to be c(x) = x 4 + x 3 + x 2 + x + 1.
Altogether f can be written as:
f (a) = ((x 4 +x 3 +x 2 +x +1)⊗(a7 x 7 +· · ·+a0 ))⊕(x 6 +x 5 +x +1) (mod x 8 +1).
3.6 The Specifications of Rijndael 197
If we denote the multiplication modulo m (x) of two polynomials, which are elements
of GF(2)[x]|8 , by , it follows that the triple
< GF[2][x]|8 , ⊕, > forms a Ring.
InvSubBytes
The inverse operation of SubBytes is called InvSubBytes and is obtained by the
application of the inverse permutation of f , called f −1 , followed by g, because g is
the inverse operation and therewith self-inverse.
For f −1 , it must hold that f −1 (f (a)) = a(x) ∼ a ∈ B, for all a ∈ B, where B is
the set of all bytes. Additionally, it should be of the same form like f , which means
that for suitable choices for the constant polynomials c (x) and d (x): f −1 (b) =
(c (x) b(x)) ⊕ d (x).
Together the following must hold for all a(x) ∼ a ∈ B:
f −1 (f (a)) = a(x)
⇔ (c (x) ((c(x) a(x)) ⊕ d(x))) ⊕ d (x) = a(x)
⇔ (c (x) c(x) a(x)) ⊕ (c (x) d(x)) ⊕ d (x) = a(x)
⇔ c (x) = c−1 (x) (mod x 8 + 1) ∧ d (x) = c−1 (x) d(x).
Since c(x) is coprime to x 8 + 1, c−1 (x) exists and therewith c (x) and d (x) are well-
defined. By applying the Extended Euclidean Algorithm we can determine c−1 (x) =
x 6 + x 3 + x and it follows that:
f −1 (b) = ((x 6 + x 3 + x) b(x)) ⊕ (x 2 + 1). Again f −1 (b) = a can be written as a
multiplication by a circulant (8 × 8)-matrix followed by an addition with d ∼ d (x):
⎛ ⎞ ⎛ ⎞⎛ ⎞ ⎛ ⎞
a0 0 0 1 0 0 1 0 1 b0 1
⎜ a1 ⎟ ⎜ 1 0 0 1 0 0 1 0 ⎟ ⎜ b1 ⎟ ⎜ 0 ⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ a2 ⎟ ⎜ 0 1 0 0 1 0 0 1 ⎟ ⎜ b2 ⎟ ⎜ 1 ⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ a3 ⎟ ⎜ 1 0 1 0 0 1 0 0 ⎟ ⎜ b3 ⎟ ⎜ 0 ⎟
⎜ ⎟=⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ a4 ⎟ ⎜ 0 1 0 1 0 0 1 0 ⎟ ⎜ b4 ⎟ ⊕ ⎜ 0 ⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
⎜ a5 ⎟ ⎜ 0 0 1 0 1 0 0 1 ⎟ ⎜ b5 ⎟ ⎜ 0 ⎟
⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟
⎝ a6 ⎠ ⎝ 1 0 0 1 0 1 0 0 ⎠ ⎝ b6 ⎠ ⎝ 0 ⎠
a7 0 1 0 0 1 0 1 0 b7 0
−1
SRD (β) := g(f −1 (β)),
NB C0 C1 C2 C3
128 0 1 2 3
192 0 1 2 3
256 0 1 3 4
Definition 104 Let aij be the byte in row i and column j of the input state sinput and
bij the byte in row i and column j of the output state soutput of ShiftRows SR.
SR is then defined by:
SR(sinput ) = soutput ,
with bij := ai,(j+Ci ) mod Nb and the Ci s are obtained from the above tabular.
InvShiftRows
The inverse of ShiftRows, which is denoted by InvShiftRows, is, of course, the byte
transposition, which cyclically shifts the bytes of row i over Ci bytes to the right.
Definition 105 Let bij be the byte in row i and column j of the input state tinput and
aij the byte in row i and column j of the output state toutput of InvShiftRows SR−1 .
SR−1 is then defined by:
DRD
GF(28 ) are multiplied by the application of the multiplication, which was defined in
subsection “The Finite Field GF(28 )” of Sect. 3.3.3.
In the same subsection it was shown that this multiplication can be done efficiently
by the application of xtime, if the coefficients of c(x) are ‘small’.
From this it follows that the criterion of efficient computability can be translated
into the requirement that the coefficients of c(x) are ‘small’.
Since also the inverse operation of MixColumns should be efficiently computable,
the criterion has to be extended in such a way that also the coefficients of the fixed
polynomial d(x) ∈ GF(28 )[x]|4 , by which a 4-byte-column in InvMixColumns is
multiplied, have to be ‘small’.
In Rijndael a coefficient of the fixed polynomials c(x), d(x) ∈ GF(28 )[x]|4 is said
to be ‘small’ if it is less than “10”.
The last design criterion is that the coefficients of c(x) are chosen in such a way
that the branch number of MixColumns is 5 which is the maximum branch number.
Following subsection “The Finite Ring < GF(28 )[x]|4 , ⊕, • >” of Sect. 3.3.3,
b(x) = b3 x 3 +b2 x 2 +b1 x +b0 = (“03” x 3 +x 2 +x + “02”)•(a3 x 3 +a2 x 2 +a1 x +a0 )
can be written as the multiplication by the following circulant matrix:
⎛ ⎞ ⎛ ⎞⎛ ⎞
b0 02 03 01 01 a0
⎜ b1 ⎟ ⎜ 01 02 03 01 ⎟ ⎜ a1 ⎟
⎜ ⎟=⎜ ⎟⎜ ⎟.
⎝ b2 ⎠ ⎝ 01 01 02 03 ⎠ ⎝ a2 ⎠
b3 03 01 01 01 a3
3.6 The Specifications of Rijndael 201
There is one other interesting way of rewriting MixColumns, denoted by MC. Let aij
denote the byte in row i and column j of the input state and bij denote the byte in row
i and column j of the output state.
It follows: bij = MC(aij ) := “02” aij ⊕ “03” ai+1,j ⊕ ai+2,j ⊕ ai+3,j , where
the (i + k)’s are taken modulo 4, for k ∈ {1, 2, 3}.
InvMixColumns
−1
InvMixColumns is also a bricklayer permutation, consisting of one D-box DRD , oper-
−1
ating on each of the Nb 4-byte-columns of the input state. Again DRD is the multipli-
cation by a fixed polynomial d(x) ∈ GF(28 )[x]|4 modulo l(x) = x 4 + 1.
It must hold that:
c(x) • d(x) = 1.
Again, a(x) = d(x) • b(x) can be written as the multiplication by the following
circulant matrix: ⎛ ⎞ ⎛ ⎞⎛ ⎞
a0 0E 0B 0D 09 b0
⎜ a1 ⎟ ⎜ 09 0E 0B 0D ⎟ ⎜ b1 ⎟
⎜ ⎟=⎜ ⎟⎜ ⎟
⎝ a2 ⎠ ⎝ 0D 09 0E 0B ⎠ ⎝ b2 ⎠ .
a3 0B 0D 09 0E b3
Let us suppose we have generated all the required RoundKeys rki . Since there
is an additional AddRoundKey step before the first round, we will need (Nr + 1)
different RoundKeys, all of the length NB .
Since the XOR operation on bits is self-inverse, it follows that the AddRoundKey
step is also self-inverse so that the AddRoundKey step is used in both encryption and
decryption.
The Key Schedule consists of two different parts. The first part is the Key Expansion,
where the cipherkey is expanded into the ExpandedKey and the second part is the
RoundKey Selection, where the ExpandedKey is decomposed into the individual
RoundKeys rki . Since we need (Nr + 1) RoundKeys, all of length NB , the length of
the ExpandedKey has to be NB (Nr + 1) bits.
The Key Expansion
The Key Expansion is a boolean function, consisting of several rounds
NKE := N1k Nb (Nr + 1), where Nk := 32 1
NC , with the cipherkey as its input and
the ExpandedKey, consisting of all the RoundKeys, as its output. Of course, this
is a security-critical part of Rijndael so that the Key Expansion was based on the
following design criteria:
• non-linearity
• diffusion
• no symmetry in the rounds
The non-linearity criterion is obtained by the application of a S-box, which is in
fact the same S-box SRD like in the SubBytes step. In order to offer diffusion, a shift
over the columns is applied and finally different constants for each round are used
to delete the symmetry of each round.
The ExpandedKey is a two-dimensional array of four rows and Nb (Nr + 1)
columns. The first round of the KeyExpansion is different than the other rounds,
since there only the cipherkey is used to fill up the first columns of the ExpandedKey
and in the other rounds the already filled up columns are used to fill up the remaining
columns.
We will visualize how the KeyExpansion works for NC = 128.
In the first round the cipherkey is mapped into the first Nk = 4 columns of the
ExpandedKey. This is done in the same way like the plaintext block is mapped into
the state. Let z = z0 z1 . . . z 18 NC −1 be the cipherkey, where the zi ’s are bytes and kij be
the byte in row i and column j of the ExpandedKey (Fig. 3.5).
3.6 The Specifications of Rijndael 203
K0 K1 K2 K3
Then:
kij = zi+4j , for 0 ≤ i < 4 and 0 ≤ j < Nk
The second to the last round all have the same structure and can be divided into
two different cases (Figs. 3.6 and 3.7).
If j = 0 mod Nk , then the jth column Kj is the XOR of the previous column Kj−1
and column Kj−Nk , written: Kj = Kj−Nk ⊕ Kj−1 .
And if j = 0 mod Nk , then the jth column Kj is a XOR of column Kj−Nk and the
previous column Kj−1 , after function F was applied to Kj−1 . This is written in the
following form: Kj = Kj−Nk ⊕ F(Kj−1 ).
The function F is the iterated application of the following parts.
Firstly, each byte of Kj−1 is transformed via SRD , then Kj−1 is shifted over one
byte to the top and, lastly, the round constant RC(m) := x m−1 , for m ∈ {2, . . . , NKE },
is added via the bitwise XOR-operation.
F
204 3 The Mathematical Background of the Advanced Encryption Standard
Altogether we have:
j
kij = ki,j−Nk ⊕ SRD (ki+1,j−1 ) ⊕ RC ,
Nk
3.6.6 Encryption
This encryption is written in pseudo-code, which means that both input and output
are arguments of the individual functions.
For example Rijndael(plaintext, cipherkey, ciphertext) means that the argu-
ments of the whole cipher are the plaintext, the cipherkey and the ciphertext,
where ciphertext is an empty argument and obtains its value during the execution
of the function Rijndael. For some functions like AddRoundKey, Round, FinalRound
and the individual steps of each round there is no particular output given. The out-
put of these functions is always the state.
For given NB , NC and Nr the encryption is done in the following way:
Nk = 6
Nb = 4
Round(state, roundkeys[i]);}
FinalRound(state, roundkeys[Nr ]);
StateToCipher(state, ciphertext);
}
with:
KeySchedule(cipherkey, roundkeys[i])
{
KeyExpansion(cipherkey, expkey);
RoundKeySelection(expkey, roundkeys[i]);
}
Round(state, roundkeys[i])
{
SubBytes(state);
ShiftRows(state);
MixColumns(state);
AddRoundKey(state, roundkeys[i]);
}
FinalRound(state, roundkeys[Nr ])
{
SubBytes(state);
ShiftRows(state);
AddRoundKey(state, roundkeys[Nr ]);
}
The variables of the Rijndael cipher and its individual functions are:
• plaintext, ciphertext:
one-dimensional arrays of bytes of length 18 NB
• cipherkey:
one-dimensional array of bytes of length 18 NC
• state:
1
two-dimensional array of bytes with 4 rows and 32 NB columns
• expkey:
one-dimensional array of bytes of length 18 (Nr + 1)NB
• roundkeys[i]:
one-dimensional array of round keys of length Nr + 1, where roundkeys[i] is the
ith round key
206 3 The Mathematical Background of the Advanced Encryption Standard
3.6.7 Decryption
There are two ways in which the decryption can be done. The first is the straight-
forward decryption, where the decryption is done by applying the operations exactly
the other way round.
Table 3.1 shows this for a three-round Rijndael.
The other way is called the equivalent decryption, where the decryption is done
in mainly the same way as the encryption. This can be done because of the following
properties of the individual steps of Rijndael.
Since InvSubBytes operates on each byte of the state independently and
InvShiftRows is a shift of the rows of the state and has no effect on the values of
the individual bytes, these two steps can be interchanged.
In order to interchange InvMixColumns and AddRoundKey we have to take advan-
tage of the linear structure of InvMixColumns.
From the linearity of InvMixColumns it follows that:
It follows that if the RoundKey rkj is changed into InvMixCoulmns(rkj ) then InvMix-
Columns and AddRoundKey can be interchanged, too.
Table 3.2 shows the equivalent decryption for a three-round Rijndael.
The advantage of the equivalent decryption is that it can be done by the same
algorithm as the encryption, where only the kes schedule has to be adapted. This is
especially important if the cipher is constructed in hardware, since we are able to
encrypt and decrypt with the same hardware.
3.6.8 Complexity
First we will calculate the complexity of the individual steps of Rijndael. The measure
of the complexity is how often the S-box SRD and the XOR-operation on bytes are
applied.
SubBytes:
In the SubBytes step the S-box SRD is applied to each of the 18 NB = 4Nb bytes of the
state so that its complexity is:
4Nb SRD ’s.
ShiftRows:
The ShiftRows step consists only of a shift on byte-level and therefore does not
contribute to the complexity of the cipher.
MixColumns:
If we denote one column of the input state of the MixColumns step with (a0 , a1 , a2 , a3 )
and the corresponding column of the output state with (b0 , b1 , b2 , b3 ), the Mix-
Columns step MC can be written as follows:
It follows that each application of the D-box of the MixColumns step consists of
four applications of the XOR-operations on bytes and two applications of xtime.
In subsection “The Finite Field GF(28 )” of Sect. 3.3.3 we have seen that the xtime
operation consists either only of a left-shift of bits or of a left-shift of bits followed
208 3 The Mathematical Background of the Advanced Encryption Standard
by one XOR-operation on bytes. Since the shift operation does not contribute to the
complexity, we assume that the xtime operation equals one XOR-operation on bytes.
The D-box is applied to each of the Nb columns so that the whole MixColumns
step has a complexity of:
6Nb XORs.
AddRoundKey:
The AddRoundKey step is the NB -fold application of the bitwise XOR of the state and
the particular RoundKey, which corresponds to the ( 18 NB = 4Nb )-fold application of
the XOR-operation on bytes and therefore its complexity is:
4Nb XORs.
Table 3.3 shows the complexity of each of the individual steps of Rijndael.
We can now calculate the complexity of the whole Rijndael cipher.
As shown in Sect. 3.6.6 Rijndael consists of the KeyExpansion, the
initial AddRoundKey step, the Round and the FinalRound.
KeyExpansion:
In subsection “The Key Expansion” of Sect. 3.6.5 we have seen that the KeyExpansion
consists of
NKE rounds, where NKE = N1k Nb (Nr + 1) and Nk = 32 1
NC .
In the first round no calculation is done, since there only the cipherkey is mapped
into the first Nk columns and in the following rounds each column Kj of the Expand-
edKey is derived from the previous columns.
If j = 0 (mod Nk ), Kj = Kj−Nk ⊕ Kj−1 , which corresponds to four XOR-
operations on bytes.
If j = 0 (mod Nk ), Kj = Kj−Nk ⊕ F(Kj−1 ).
The map F consists of four applications of the S-box SRD , one shift and four
XOR-operations on bytes, from which it follows that in this case four applications
of SRD and eight XOR-operations on bytes are done.
It follows that each round, besides the first, consists of four applications of SRD
and 4(Nk + 1) XOR-operations on bytes and therewith the complexity of the whole
KeyExpansion is:
4Nb XORs.
Round:
Each Round consists of all the previously calculated steps so that its complexity is:
FinalRound:
In the FinalRound the MixColumns step is omitted, which leads to a complexity of:
The complexity for the Rijndael cipher with block length NB = 32Nb bits and
cipherkey length NC = 32Nk bits over Nr rounds is:
3.6.9 Security
Rijndael has been designed according to the Wide Trail Strategy with the following
properties for:
• the bundle size m:
m=8
• the column size nθ :
nθ = 4
• the non-linear bricklayer permutation γ:
γ = SubBytes, whose S-box SRD has been selected from [16] so that its minimum
linear weight is at least 3 and its minimum differential weight is at least 6.
• the byte transposition π:
π = ShiftRows, which is diffusion optimal.
• the linear bricklayer permutation θ:
θ = MixColumns, where coefficients of the fixed polynomial c(x) has been chosen
in such a way that the branch number of MixColumns is 5, the maximum possible
branch number
From Eqs. (3.5.14) and (3.5.15) follows that the minimum weight for any linear trail
over four rounds is at least 75 and the minimum weight for any differential trail is
210 3 The Mathematical Background of the Advanced Encryption Standard
at least 150. Hence any eight round linear (differential) trail has a weight of at least
150 (300).
The authors of [6] “consider this sufficient to resist differential and linear attacks”.
3.7 Cryptanalysis
In this section we introduce the saturation attack. The saturation attack is an attack
by the authors of Rijndael themselves, which exploits the specific structure of the
round transformation, to launch an attack of up to six rounds of Rijndael.
This attack is based on the Square attack, developed by Lars Knudsen, which was
designed to attack the block cipher Square [7]. The block cipher Square by Joan
Daemen, Lars Knudsen and Vincent Rijmen is a precursor of Rijndael. Its round
structure is very similar to the round structure of Rijndael so that this attack was
improved by Joan Daemen and Vincent Rijmen to allow attacks on a round reduced
Rijndael of up to six rounds.
-Sets
The saturation attack is a chosen-plaintext attack, which means that we try to derive
the unknown cipherkey by encrypting several properly chosen plaintexts and exploit-
ing the particular structure of the attacked cipher. In this attack the set of chosen
plaintexts is called a -set and defined as follows.
Definition 109 A -set is a set of 28 states (or intermediate results) with the fol-
lowing properties.
Let x, y ∈ be two states of the -set and let I := {0, . . . , 3} × {0, . . . , Nb − 1}
be the index space of the individual bytes in the states within the -set.
For (i, j) ∈ I, xij , yij denote the byte in row i and column j of x, y ∈ .
It holds:
∃I1 , I2 , with I = I1 I2 , I1 I2 = ∅ and
−∀ (i, j) ∈ I1 ⇒ xij = yij ∀ x, y ∈
−∀ (i, j) ∈ I2 ⇒ xij = yij ∀ x, y ∈
Definition 110 In a -set the bytes at position (i1 , j1 ) ∈ I1 are called active bytes
and the bytes at position (i2 , j2 ) ∈ I2 are called passive bytes.
Definition 111 L = {0, . . . , 28 − 1} denotes the index space of the individual states
in a -set.
The reason for the choice of the plaintexts is given by the following proposition.
3.7 Cryptanalysis 211
Proposition 27 xijl = 0 ∀ (i, j) ∈ I.
l∈L
Proof Let (i, j) ∈ I1 , then all the bytes at position (i, j) of the individual states are
pairwise different. Since the -set contains 28 states, all the possible 28 values for
the bytes are obtained and therefore sum up to zero.
Let (i, j) ∈ I2 , then all the bytes at position (i, j) of the individual states are equal.
Since every byte is self-inverse under ⊕ and the -set contains 28 states, the bytes
sum up to zero.
In the saturation attack we exploit the fact that, if we choose the -sets properly,
all the individual steps of Rijndael are -maintaining. This fact is proved by the
following two propositions.
Proposition 28 The SubBytes, the ShiftRows and the AddRoundKey steps are -
maintaining.
Proof The SubBytes step does not change the position of the bytes of a state and it
consists of one S-box which operates independently on the individual bytes of each
state and is a bijection in GF(28 ). There are 28 states in a -set. If (i, j) ∈ I1 , after the
application of the S-box to the bytes xij the resulting bytes at this position are again
pairwise different. If (i, j) ∈ I2 , the resulting bytes are again all equal. It follows that
the output states of the SubBytes step form a -set.
The AddRoundKey step consists of the bitwise XOR of the states with a round-
key of length NB . If we decompose this roundkey into its 18 NB bytes rkl , for
l ∈ {0, . . . , 18 NB − 1}, this step equals the bitwise XOR of each byte of the state
and each byte of the roundkey. It follows that if (i, j) ∈ I1 the resulting bytes are
pairwise different and if (i, j) ∈ I2 the resulting bytes are all equal again. Hence, the
output states of the AddRoundKey step form a -set.
Since the ShiftRows step does not change the value of the individual bytes, but
only changes their positions, the application of ShiftRows to the states of a -set
results in states, which again form a -set.
is not -maintaining. Suppose the first two bytes a0j , a1j of column j of the input
state of MixColumns are active and the last two bytes a2j , a3j of column j are passive.
Now we look to three different input states al1 , al2 , al3 of the -set with the above
property, where l1 , l2 , l3 ∈ L, and assume that:
212 3 The Mathematical Background of the Advanced Encryption Standard
l2
a0j = (“02”)−1 “03” a1j
l1
l2
and a1j = (“03”)−1 “02” a0j
l1 l1
a1j .
lk
Applying MixColumns would result in the following output bytes b0j :
l1 l2 l1 l1
b0j = b0j = “02” a0j ⊕ “03” a1j ⊕c
l3 l3 l3
and b0j = “02” a0j ⊕ “03” a1j ⊕ c,
lk lk
where c = a2j ⊕ a3j .
l3 l1 l2
Since b0j = b0j = b0j , the resulting set of states do not form a -set.
Proposition 29 If the input states of the MixColumns step have at most one active
byte in each column, then the MixColumns step is -maintaining.
Proof Since the MixColumns step consists of one D-box operating independently
on each of the columns of the input state, the condition of the proposition equals the
condition that at most one byte of the input of the D-box is active.
If no byte is active, of course, the bytes of the resulting column are all passive and
the states form again a -set.
If one byte is active, without loss of generality we assume that this is the first byte
a0j of the column, we obtain the following equality for all l ∈ L:
bijl = di a0j
l
⊕ c,
where:
⎧
⎨ “02”, if i mod 4 = 0
di = “01”, if i mod 4 = 1, 2
⎩
“03”, if i mod 4 = 3
and:
c = di+1 a1j
l
⊕ di+2 a2j
l
⊕ di+3 a3j
l
.
l
Since the a0j ’s are pairwise different, so are the bijl ’s and the resulting states form
again a -set.
with one active byte. From Proposition 29 it follows that the output states of the
first MC step form a -set, where all the four bytes of one column are active. This
property remains until the output of the second SR step. The second SR step spreads
the active bytes over all the columns so that the input states of the second MC step
have one active byte per column. The output states of the second MC step form again
a -set with only active bytes and this remains until the input of the third MC step.
After the application of the third MC step the states do not usually form a -set, but
we obtain the following property.
Proposition 30 The bytes on each position (i, j) ∈ I of the input states of the fourth
round sum up to zero.
Proof We denote the input states of the third MC step by al , the output states by bl ,
for l ∈ L, and the individual bytes of each of them by aijl and bijl , where i ∈ {0, . . . , 3}
and j ∈ {0, . . . , Nb − 1}.
From Propositions 27, 28 and 29 it follows that all the bytes of the output states
of the third MC step sum up to zero:
l
bij = MC(aijl )
l∈L l∈L
= (“02” aijl ⊕ “03” ai+1,j
l
⊕ ai+2,j
l
⊕ ai+3,j
l
)
l∈L
= “02” aijl ⊕ “03” l
ai+1,j ⊕ l
ai+2,j ⊕ l
ai+3,j
l∈L l∈L l∈L l∈L
=0⊕0⊕0⊕0=0
(3) (3) (3)
Since ARK(bijl , rki+4j ) = bijl ⊕ rki+4j , where rki+4j is the (i + 4j)th byte of the third
roundkey, and since from this it follows that:
(3) (3) l (3)
ARK(bijl , rki+4j ) = (bijl ⊕ rki+4j )= bij ⊕ rki+4j = 0 ⊕ 0 = 0,
l∈L l∈L l∈L l∈L
this property holds until the input of the fourth round.
Now let cij , for all (i, j) ∈ I, denote the bytes of the input c of the fourth round, let
dij , for all (i, j) ∈ I, denote the bytes of the output of the fourth round, which is the
ciphertext, and let kij , for all (i, j) ∈ I, denote the bytes of the fourth roundkey. Then
the following equality holds for all (i, j) ∈ I:
It follows that each byte cij of the input state c of the fourth round can be expressed
in terms of the bytes di,j−Ci of the known ciphertext d and the bytes ki,j−Ci of the last
roundkey k:
−1
cij = SRD (di,j−Ci ⊕ ki,j−Ci ) ∀ (i, j) ∈ I.
214 3 The Mathematical Background of the Advanced Encryption Standard
The individual bytes di,j−Ci of the ciphertext d are known, which means that one can
now guess a value for each byte ki,j−Ci of the last roundkey k and check whether the
following equality holds:
−1 l
(SRD (di,j−Ci ⊕ ki,j−Ci )) = 0. (3.7.2)
l∈L
One of the 28 possible values for each byte of the last roundkey is the right value and
l
therefore the above equality will hold. If we assume that the 28 values di,j−C i
, l ∈ L,
of each byte of the ciphertext d are uniformly distributed, it follows that for each of
the 28 − 1 wrong values the 28 values cijl , l ∈ L, are uniformly distributed, since both
−1
the S-box SRD and the XOR operation ⊕ are bijective.
From this property it follows generally that:
1
Prob cijl =x = , ∀ x ∈ GF(28 )
28
l∈L
From this it follows that we can determine each byte kij(m) , ∀ (i, j) ∈ I, of the mth
roundkey k (m) , where m ∈ {0, . . . , 3}, uniquely from the last roundkey k (4) via the
following equation:
⎧ (m+1) (m+1)
⎨ kij ⊕ ki,j−1 , if j = 1, 2, 3
kij(m) = .
⎩ (m+1) (m)
ki,0 ⊕ SRD (ki+1,3 ) ⊕ RC(m), if j = 0
Attack Complexity
In this basic attack we need two -sets, which corresponds to 29 known plaintexts.
Checking Eq. (3.7.2) for each possible value of each byte of the last roundkey
−1
requires 16 × 28 × 28 = 220 applications of the S-box SRD and the same number
of XORs ⊕. Following Sect. 3.6.8, the complexity of a four round cipher execution
where both the block length and the cipherkey length are 128 bits is:
80 = 26 + 24 ≈ 26 applications of SRD
and 232 = 27 + 26 + 25 + 23 + 2 ≈ 27 XORs ⊕.
It follows that the attack complexity corresponds roughly to the number of 214 4-
round cipher executions.
Extension at the End
In this extension we add a fifth round at the end. We denote the bytes of the output state
e of the fifth round, which is the ciphertext, by eij , (i, j) ∈ I. Following Sect. 3.6.7
we can interchange the InvMixColumns and the AddRoundKey step if we adopt the
roundkey accordingly.
In order to calculate Eq. (3.7.1) we have to use the following expression for cij :
−1 −1 (5)
ci,j+Ci = SRD ((“0E” (SRD (ei,j−Ci ⊕ ki,j−Ci
)
−1 (5)
⊕(“0B” (SRD (ei+1,j−Ci ⊕ ki+1,j−Ci+1
)
(3.7.3)
−1 (5)
⊕(“0D” (SRD (ei+2,j−Ci ⊕ ki+2,j−C i+2
)
(5)
−1
⊕(“09” (SRD (ei+3,j−Ci ⊕ ki+3,j−Ci+3
) ⊕ kij∗(4) ),
This means that we have (28 )5 = 240 combinations of 28 values of the five bytes.
If we guess the right combination Eq. (3.7.1) will hold and again if we assume that
the bytes eij of the ciphertext e are unifromly distributed then Eq. (3.7.1) will hold
1
for every wrong combination with probability 256 . It follows that the amount of the
2 −1
40
(2 − 1) wrong combinations is reduced to 28 after the checking of (3.7.1) with
40
the first -set so that the amount of the remaining possible combinations is 1+ 2 2−1
40
8 .
If we repeat the whole calculation with another different -set the amount of the
remaining wrong combinations will be 2 216−1 . Again the right combination will sum
40
In general the amount of the remaining possible combinations after the calculation
of Eq. (3.7.1) with k different -sets is 1 + 2 28k−1 .
40
After the calculation of (3.7.1) with five -sets we will obtain two remaining
possible combinations so that the calculation with the sixth -set will determine the
right combination with probability 254 255
.
We have to repeat the whole attack four times in order to obtain all of the sixteen
bytes of the last roundkey.
Attack Complexity
This extension needs six different -sets which corresponds to 6 · 28 chosen plain-
texts.
The calculation of (3.7.3) requires four multiplications .
As shown in subsection “The Finite Field GF(28 )” of Sect. 3.3.3 the multiplication
can be done efficiently via the application of xtime. The multiplication by “0E”, “0B”
and “0D” requires three applications of xtime and two XORs ⊕ and the multiplication
by “09” requires three applications of xtime and one XOR ⊕.
If we follow Sect. 3.6.8 and simplify the xtime operation to equal one XOR oper-
ation we obtain that the calculation of (3.7.3) requires five applications of the S-box
−1
SRD and 27 XORs ⊕.
We have to check (3.7.1) 28 times for every of the 240 possible combinations. And
we have to do this six times for every needed -set.
After that we have uniquely determined four of the sixteen bytes of the last round-
key so that we have to repeat the whole calculation three more times.
This leads to a complexity of:
100 = 26 + 25 + 22 ≈ 26 S −1 RD ’s
and 272 = 28 + 24 ≈ 28 XORs,
the complexity of this attack corresponds roughly to 249 five-round cipher executions.
3.7 Cryptanalysis 217
the complexity of this attack corresponds roughly to 271 six-round cipher executions.
218 3 The Mathematical Background of the Advanced Encryption Standard
There are many actual approaches to cryptanalize Rijndael and we will now give
a short view on three of these. All three approaches take advantage of the specific
structure of Rijndael but do not yield to an actual attack to cryptanalize it.
In [8] Niels Ferguson, John Kelsey, Stefan Lucks, Bruce Schneier, Mike Stay,
David Wagner and Doug Whiting introduce the partial sum technique, which can be
used to lower the attack requirements of the six-round saturation attack to 246 cipher
executions and to launch an attack over seven and eight rounds of Rijndael. The
seven-round attack requires 2128 − 2119 chosen plaintexts and 2120 cipher executions.
The eight-round attack requires the same amount of chosen plaintexts and 2204 cipher
executions. Of course, these attacks are faster than the exhaustive key search attack,
which requires 2NC cipher executions, but the number of cipher executions is still to
great to be feasible.
In [9] Niels Ferguson, Richard Schroeppel and Doug Whiting show that the full
fourteen-round Rijndael cipher, with NC = 256, can be expressed as a single alge-
braic formula, which consists of 270 terms. This is an interesting result but the authors
are not aware of any technique to exploit this fact and launch an attack.
In [17] Josef Pieprzyk and Nicolas T. Courtois introduce the XSL attack, which can
applied on all block ciphers with a XSL round structure. The round transformation of
a XSL block cipher consists of a XOR with the roundkey (X), a non-linear substitution
layer (S) and a linear diffusion layer (L). As we have seen, Rijndael fulfills this
requirement. Firstly, the authors of [17] show that the cryptanalysis of Rijndael
can be reduced to the problem of solving multivariate quadratic equations, called
MQ-equations. In general this problem is NP-hard but its workload decreases if the
number of equations exceeds the number of variables, see [21]. The authors show,
that this can be achieved but T.T. Moh [15] and Dan Coppersmith [4] state that this
fact cannot be used to launch an actual attack on Rijndael.
We will now define the Extended Euclidean Algorithm in mainly same way as it
is done in [14]. We will show that given two polynomials m(x), a(x) ∈ F[x] the
Extended Euclidean Algorithm determines uniquely b(x), c(x) ∈ F[x], with (m(x)⊗
c(x)) ⊕ (a(x) ⊗ b(x)) = gcd(m(x), a(x)).
In Sect. 3.3.2 we have shown that a(x) b(x) = 1.
In the last section we will show that deg(b(x)) < deg(m(x)) = d.
Hence, b(x) is the multiplicative inverse of a(x) under field multiplication ,
defined in Sect. 3.3.2.
3.8 The Extended Euclidean Algorithm 219
The following proposition is the inductive basis for the Euclidean Algorithm for
polynomials.
Proposition 31 For any elements m(x), a(x), q(x) ∈ F[x], it holds that:
Proof Let D[x] ⊂ F[x] denote the set of common divisors of m(x) and a(x) and let
D [x] ⊂ F[x] denote the set of common divisors of a(x) and (m(x) − q(x) ⊗ a(x)).
If d(x) ∈ D[x]
⇒ d(x)|(m(x) − q(x) ⊗ a(x)) ⇒ d(x) ∈ D [x].
If d(x) ∈ D [x]
⇒ d|(m(x) = (m(x) − q(x) ⊗ a(x)) + q(x) ⊗ a(x)) ⇒ d(x) ∈ D[x].
It follows that D[x] = D [x] and from this follows the proposition.
The input of the Euclidean Algorithm are two polynomials m(x), a(x) ∈ F[x], with
deg(m(x)) ≥ deg(a(x)), and its output is gcd(m(x), a(x)) ∈ F[x], which is 1 if m(x)
is irreducible.
For a given input m(x), a(x) ∈ F[x], it follows from Definition 114 that there exist
unique q1 (x), r1 (x) ∈ F[x], with:
a(x) = q2 (x) ⊗ r1 (x) + r2 (x) and deg(r2 (x)) < deg(r1 (x)),
Since the sequence (deg(rk (x)))k is strictly decreasing and deg(rk (x)) ∈ N, it follows
that after a finite number n ∈ N of steps deg(rn (x)) = 0.
A polynomial of degree zero divides any other polynomial.
If rn (x) = 0, it follows that
The extended version of the Euclidean Algorithm has the same input as the Euclidean
Algorithm, two polynomials m(x), a(x) ∈ F[x], but in addition to gcd(m(x), a(x)) ∈
F[x], the output also includes two polynomials b(x), c(x) ∈ F[x] with m(x) ⊗ c(x) +
a(x) ⊗ b(x) = gcd(m(x), a(x)).
In the previous section we have seen that if we define r−1 (x) := m(x) and r0 (x) :=
a(x), there exist unique sequences (qk (x))k , (rk (x))k ,
for k ∈ {1, 2, . . . , n}, with:
rk−2 = qk (x) ⊗ rk−1 (x) + rk (x) and deg(rk (x)) < deg(rk−1 (x)).
3.8 The Extended Euclidean Algorithm 221
With these definitions we are able to prove the following proposition, which proves
the correctness of the Extended Euclidean Algorithm.
r−1 (x) = m(x), c−1 (x) = 1 and b−1 (x) = 0 ⇒ m(x) = 1 ⊗ m(x) + 0 ⊗ a(x).
For k = 0, we have:
If we now assume that the proposition is proved for k − 2 and k − 1, we have the
following equations:
3.8.3 Results
For all the results in this section we assume that deg(m(x)) > deg(a(x)) > 0.
Proof From Definition 114 and the construction of the Euclidean Algorithm it fol-
lows for all k ∈ {1, 2, . . . , n} that:
and:
deg(rk−2 (x)) = deg(qk (x) ⊗ rk−1 (x) + rk (x))
= deg(qk (x) ⊗ rk−1 (x))
= deg(qk (x)) + deg(rk−1 (x)).
It follows that:
Since deg(bk−1 (x)) ≥ deg(bk−2 (x)) and deg(qk (x)) > 0 (Lemma 22), it follows that:
References
1. R. Anderson, E. Biham, L. Knudsen, Serpent: a proposal for the advanced encryption standard,
in 1st AES Conference (1999)
2. E. Biham, A. Shamir, Differential Cryptanalysis of the Data Encryption Standard (Springer,
New York, 1993)
3. C. Burwick, D. Coppersmith, E. D’Avignon, R. Gennaro, S. Halevi, C. Jutla, S.M. Matyas,
L. O’Connor, M. Peyravian, D. Safford, N. Zunic, MARS a candidate cipher for AES, in 1st
AES Conference (1999)
4. D. Coppersmith, Re: impact of Courtois and Pieprzyk results, Entry at the AES discussion
forum (2002). http://aes.nist.gov/aes/
5. J. Daemen, Cipher and hash function design strategies based on linear and differential crypt-
analysis, Doctoral dissertation K.U. Leuven (1995)
6. J. Daemen, V. Rijmen, AES proposal: Rijndael, in 1st AES Conference (1999)
7. J. Daemen, L. Knudsen, V. Rijmen, The Block Cipher SQUARE, Fast Software Encryption’97
(Springer, New York, 1997)
8. N. Ferguson, J. Kelsey, S. Lucks, B. Schneier, M. Stay, D. Wagner, D. Whiting, Improved
Cryptanalysis of Rijndael, Fast Software Encryption 2000 (Springer, New York, 2001), pp.
213–231
9. N. Ferguson, R. Schroeppel, D. Whiting, A Simple Algebraic Representation of Rijndael, Lec-
ture Notes in Computer Science (Springer, New York, 2001)
10. S.W. Golomb, Shift Register Sequences (Holden-Day Inc., San Francisco, 1967)
11. T. Jakobsen, L.R. Knudsen, The Interpolation Attack on Block Ciphers, Fast Software Encryp-
tion’97 (Springer, New York, 1997), pp. 28–40
12. R. Lidl, H. Niederreiter, Introduction to Finite Fields and Their Applications (Cambridge
University Press, Cambridge, 1986)
13. M. Matsui, Linear cryptanalysis method for DES cipher, Advances in Cryptology, Proceedings
of Eurocrypt’93 (Springer, New York, 1994), pp. 386–397
14. R.J. McEliece, Finite Fields for Computer Scientists and Engineers (Kluwer Academic Pub-
lishers, Boston, 1987), pp. 3–9
15. T.T. Moh, On the Courtois-Pieprzyk’s attack on Rijndael (2002). http://www.usdsi.com/aes.
html
16. K. Nyberg, Differentially uniform mappings for cryptography, Advances in Cryptology, Pro-
ceedings of Eurocrypt’93 (Springer, New York, 1994), pp. 55–64
17. J. Pieprzyk, N.T. Courtois, Cryptanalysis of block ciphers with overdefined systems of equa-
tions, Advances in Cryptology - ASIACRYPT 2002, vol. 2501, Lecture Notes in Computer
Science (Springer, New York, 2002), pp. 267–287
18. B. Preneel, Analysis and design of cryptographic hash functions, Doctoral dissertation K.U.
Leuven (1993)
19. R.L. Rivest, M.J.B. Robshaw, R. Sidney, Y.L. Yin, The RC6 block cipher, 1st AES Conference
(1999)
20. B. Schneier, J. Kelsey, D. Whiting, D. Wagner, C. Hall, N. Ferguson, Twofish: a 128-bit block
cipher, 1st AES Conference (1999)
21. A. Shamir, A. Kipnis, Cryptanalysis of the HFE public key cryptosystem, in Proceedings of
Crypto’99 (Springer, New York, 1999)