5.4 Key Expansion

Key expansion is the process of generating the key schedule from the original 128-, 196-, or 256-bit cipher key. The flowchart for key expansion is shown as follows:

Figure 5-9. Key Expansion Flowchart

The algorithm uses operations already described, such as XOR addition, finite field multiplication, substitution, and word cycling. Refer to the source code for details.

Note: The key expansion is identical for both encryption and decryption. Therefore the S-box used for encryption is required even if only decryption is used. In the AVR implementation, the ordinary S-box is computed prior to key expansion, and then its memory is reused when computing the inverse S-box.