
Advanced encryption standard hardware accelerator (AES)
RM0351
828/1830
DocID024597 Rev 5
Repeat (p), (q), (r) and (s) until ciphering or deciphering of all the payload blocks.
Alternatively, DMA may be used.
•
GCM Final Phase:
In this last step, we generate the authentication tag.
t)
Choose the combination GCMPH[1:0] = 11 in AES_CR.
u) Write 4 times the input into the AES_DINR register: the input must be composed
of the length of header coded on 64 bits followed with the length of payload coded
on 64 bits.
v) Wait until the computation flag CCF in AES_SR register is set to 1 (or use the
corresponding interrupt).
w) Read 4 times the AES_DOUTR register: the output is the “auth tag”.
x) Clear CCF flag in AES_SR register by setting CCFC bit in AES_CR to 1.
y) Disable
AES
processor by setting bit EN in AES_CR to 0.
No need to disable / enable AES processor when moving from header phase to tag phase.
AES can move directly from init to payload or/and to tag (bypassing header phase or/and
payload phase) in this case AES enable step should be added after selecting the next
phase.
AES Galois message authentication code (GMAC)
The AES processor supports also GMAC to authenticate the plaintext based on GCM
algorithm for generating the corresponding TAG.
It is based on a multiplier over a fixed finite field for generating the TAG. It requires an
initialization vector at the beginning.
Actually GMAC is the same as GCM applied on a message composed only by the header,
so all steps and settings are the same except phase 3 will not be used.
Suspend mode in GCM
In GCM algorithm, suspend mode can be performed during header phase and payload
phase. It is advised to not use suspend mode in init phase or tag phase since suspend
mode has no benefit in these phases:
Suspend mode during header phase: the user must respect the following steps:
•
Before interrupting the current message:
a) Make sure that CCF flag read from AES_SR is set to 1.
b) Clear CCF flag in AES_SR register by setting CCFC in AES_CR to 1.
c) Save AES_SUSPxR registers in the memory.
d) Disable AES processor by setting EN in AES_CR to 0.
e) Save the current AES configuration in the memory.
•
To resume:
f)
Make sure that AES processor is disabled by reading the bit EN in AES_CR.
g) Write back AES_SUSPxR registers into their corresponding suspend registers.
h) Re-configure AES with the initial setting values in CR register, IV register and key
registers.
i)
Enable the AES processor by setting EN in AES_CR register.