While working with AES 256 in CBC mode, I learned that it requires Key Expansion - forward (for encryption) and reverse (for decryption). Does AES CTR mode also requires such a step ? Or can the 256 bit key be used as is ?
1 Answer
When AES performs an encryption (or decryption) with a key, it internally converts the key into a series of subkeys (either 11, 13 or 15 subkeys, depending on whether you start with a 128 bit, 192 bit or 256 bit AES key). This process is known as key expansion and needs to be done, whether you encrypt and decrypt.
And, yes, this needs to be done for AES-CTR (or any other mode of operation of AES).
Now, when AES is implemented in software, we usually generate the subkeys once (and store them in memory); in hardware, it is not uncommon to generate the subkeys on the fly in parallel with processing the AES block (because the logic to do this on-the-fly generation is cheaper for hardware than storing the subkeys).
-
$\begingroup$ When you're saying "in hardware it's cheaper to calculate than to store" do you mean that the required FPGA / ASIC logic for the expansion is more compact than storing the pre-calculated 128 * 15 bits per AES256 key ? $\endgroup$– shaikoCommented Aug 18, 2023 at 13:11
-
$\begingroup$ @shaiko: I believe it might be. In addition, some hardware (including the ones I dealt with) can deal with multiple keys; the on-chip hardware to store all those subkeys, or alternatively, to shuffle in the subkeys from off-chip, is rather more expensive than the on-the-fly computation. $\endgroup$– ponchoCommented Aug 18, 2023 at 13:34