
Advanced encryption standard hardware accelerator (AES)
RM0351
DocID024597 Rev 5
28.3
AES functional description
shows the block diagram of the AES accelerator.
Figure 190. AES block diagram
The AES accelerator processes data blocks of 128-bits (4 words) using a key with a length
of either 256 bits or 128 bits, and an initialization vector when CBC, CTR, GCM, GMAC or
CMAC chaining mode is selected.
It provides 4 operating modes:
•
Mode 1: encryption using the encryption key stored in the AES_KEYRx registers.
•
Mode 2: key derivation stored internally in the AES_KEYRx registers at the end of the
key derivation processed from the encryption key stored in this register before enabling
the AES. This mode is independent from the AES chaining mode selection.
•
Mode 3: decryption using a given (pre-computed) decryption key stored in the
AES_KEYRx registers.
•
Mode 4: key deri decryption using an encryption key stored in the AES_KEYRx
registers (not used when the AES is configured in Counter mode for perform a chaining
algorithm).
The operating mode is selected by programming bits MODE[1:0] into the AES_CR register.
The mode must be changed only when the AES is disabled (bit EN = 0 in the AES_CR
register).
Note:
The AES_KEYRx registers must be stored before enabling the AES.
To select which one of the ECB, CBC, CTR, GCM, GMAC or CMAC mode is going to be
used for the cryptographic solution, it is mandatory to write the bit CHMOD[2:0] of the
AES_CR register and the AES_IVR register when the AES is disabled (bit EN = 0 in the
AES_CR register).
Once enabled (bit EN = 1 in AES_CR register), the AES is in the input phase, waiting for the
software to write the input data words into the AES_DINR (4 words) for the modes 1, 3 or 4.
The data correspond either to the plaintext message or the cipher message. A wait cycle is
automatically inserted between two consecutive writes to the AES_DINR register in order to
send, interleaved with the data, the key to the AES processor.
For mode 2, the key derivation processing is started immediately after the EN bit in the
AES_CR register is set. It requires that the AES_KEYRx registers are loaded with the
encrypted key before enabling the AES. At the end of the key derivation processing
computation complete flag (CCF) in AES_SR register is set. The derivative key is available
069
$(6KDUGZDUHDFFHOHUDWRU
$(6B
.(<5[
$(6B
'2875
$(6B',15
$(6B,95
$(6B&5
$(6B65
$(6B
6835[