AES key schedule explained

The Advanced Encryption Standard uses a key schedule to expand a short key into a number of separate round keys. The three AES variants have a different number of rounds. Each variant requires a separate 128-bit round key for each round plus one more.[1] The key schedule produces the needed round keys from the initial key.

Round constants

Values of in hexadecimal
1 2 3 4 5 6 7 8 9 10
01 02 04 08 10 20 40 80 1B 36
The round constant for round of the key expansion is the 32-bit word:

rconi=\begin{bmatrix}rci&0016&0016&0016\end{bmatrix}

where is an eight-bit value defined as :

rci= \begin{cases} 1&ifi=1\\ 2rci-1&ifi>1andrci-1<8016\\ (2rci-1)11B16&ifi>1andrci-1\ge8016\end{cases}

where

is the bitwise XOR operator and constants such as and are given in hexadecimal. Equivalently:

rci=xi-1

\rm{GF}(2)[x]/(x8+x4+x3+x+1)

, so that e.g.

rc10=3616=001101102

represents the polynomial

x5+x4+x2+x

.

AES uses up to for AES-128 (as 11 round keys are needed), up to for AES-192, and up to for AES-256.[2]

The key schedule

Define:

Also define as a one-byte left circular shift:

\operatorname{RotWord}(\begin{bmatrix}b0&b1&b2&b3\end{bmatrix})=\begin{bmatrix}b1&b2&b3&b0\end{bmatrix}

and as an application of the AES S-box to each of the four bytes of the word:

\operatorname{SubWord}(\begin{bmatrix}b0&b1&b2&b3\end{bmatrix})=\begin{bmatrix}\operatorname{S}(b0)&\operatorname{S}(b1)&\operatorname{S}(b2)&\operatorname{S}(b3)\end{bmatrix}

Then for

i=0\ldots4R-1

:

Wi= \begin{cases} Ki&ifi<N\\ Wi-N\operatorname{SubWord}(\operatorname{RotWord}(Wi-1))rconi/N&ifi\geNandi\equiv0\pmod{N}\\ Wi-N\operatorname{SubWord}(Wi-1)&ifi\geN,N>6,andi\equiv4\pmod{N}\\ Wi-NWi-1&otherwise.\\ \end{cases}

References

External links

Notes and References

  1. Non-AES Rijndael variants require up to 256 bits of expanded key per round
  2. The Rijndael variants with larger block sizes use more of these constants, up to for Rijndael with 128-bit keys and 256 bit blocks (needs 15 round keys of each 256 bit, which means 30 full rounds of key expansion, which means 29 calls to the key schedule core using the round constants). The remaining constants for are: 6C, D8, AB, 4D, 9A, 2F, 5E, BC, 63, C6, 97, 35, 6A, D4, B3, 7D, FA, EF and C5
  3. Other Rijndael variants require round keys, where is the block size in words
  4. Other Rijndael variants require words of expanded key, where is the block size in words