The usual implementation of AES first computes all the Round Keys sequentially starting from the key, and stores them in RAM for later uses. However, when enciphering a single block with a key that will be used for that purpose only, or when RAM is very sparse, or perhaps in hardware, it is advantageous to use the Round Keys a they are being generated, rather than store them. Quoting the Rijndael submission to NIST:
The key schedule can be implemented without explicit use of the array
W[Nb*(Nr+1)]
. For implementations where RAM is scarce, the Round Keys can be computed on-the-fly using a buffer ofNk
words with almost no computational overhead.
It is said this also works for deciphering:
The key expansion operation that generates
W
is defined in such a way that we can also start with the lastNk
words of Round Key information and roll back to the original Cipher Key. So, calculation ’on-the-fly' of the Round Keys, starting from an “Inverse Cipher Key”, is still possible.
However, the how-to is left as an exercise to the reader. In particular: Can the last Round Key (the first used when deciphering) be computed directly, rather than sequentially?