
GD32L23x User Manual
572
(i)
Repeat (h) until all AAD data are supplied, wait until BUSY bit is cleared.
3. GCM encryption/decryption phase
This phase must be performed after GCM AAD phase. In this phase, the message is
authenticated and encrypted/decrypted.
(j)
Configure GCM_CCMPH[1:0] bits to ‘10’.
(k) Configure the computation direction in CAUDIR.
(l)
Write data into CAU_DI register, INF and IEM flags can be used to determine if the
input FIFO can receive data. ONE and OFU flags can be used to check if the output
FIFO is not empty. If so, read the CAU_DO register. DMA can also be used.
(m) Repeat (l) step until all payload blocks are processed.
4. GCM tag phase
In this phase, the final authentication tag is generated.
(n)
Configure GCM_CCMPH[1:0] bits to ‘11’.
(o) Write the input into the CAU_DI register, 4 times write operation is needed. The input
consists of the AAD data size (64bits) and the payload data size (64bits).
(p) Wait until the ONE flag is set to 1, and then read CAU_DO 4 times. The output
corresponds to the authentication tag.
(q) Disable the CAU.
Note:
The key should be prepared at the beginning when a decryption is performed.
AES-GMAC mode
The AES Galois message authentication code mode is also supported to authenticate the
message. It is processing based on the AES-GCM mode, while the encryption/decryption
phase is by-passed.
AES-CCM mode
The AES combined cipher machine mode, which is similar to AES-GCM mode, also allows
encrypting and authenticating message. It is also based on AES-CTR mode to ensure
confidentiality. In this mode, AES-CBC is used to generate a 128-bit tag.
The CCM standard (RFC 3610 Counter with CBC-MAC (CCM) dated September 2003)
defines particular encoding rules for the first authentication block (B0 in the standard). In
particular, the first block includes flags, a nonce and the payload length expressed in bytes.
The CCM standard specifies another format, called A or counter, for encryption/decryption.
The counter is incremented during the encryption/decryption phase and its 32 LSB bits are
initialized to ‘1’ during the tag generation (A0 packet in the CCM standard).
Note:
The formatting operation of B0 packet should be handled by software.
In this mode, four steps are required to perform an encryption/decryption: