Cryptographic processor (CRYP)
RM0090
728/1731
DocID018909 Rev 11
OFNE/OFFU flag of the CRYP_DOUT register can be monitored to check if the
output FIFO is not empty.
n) Repeat the previous step until all payload blocks have been encrypted or
decrypted. Alternatively, DMA could be used.
4. GCM final phase
This step generates the authentication tag:
o) Configure
GCM_CCMPH[1:0] to ‘11’ in CRYP_CR.
p) Write the input into the CRYP_DIN register 4 times. The input must contain the
number of bits in the header (64 bits) concatenated with the number of bits in the
payload (64 bits).
q) Wait
till
the
OFNE flag
(FIFO output not empty) is set to ‘1’ in the CRYP_SR
register.
r)
Read the CRYP_DOUT register 4 times: the output corresponds to the
authentication tag.
s) Disable the cryptographic processor (CRYPEN bit in CRYP_CR = ‘0’)
Note:
When a decryption is performed, it is not required to compute the key at the beginning. At
the end of the decryption, the generated tag should be compared with the expected tag
passed with the message. In addition,
the ALGODIR bit (algorithm direction)
must be set to ‘1’.
No need to disable/enable CRYP processor when moving from header phase to tag phase.
AES Galois message authentication code (GMAC)
The cryptographic processor also supports GMAC to authenticate the plaintext. It uses the
GCM algorithm and a multiplier over a fixed finite field to generate the corresponding tag.
An initialization vector is required at the beginning of the algorithm.
Actually, the GMAC algorithm corresponds to the GCM algorithm applied on a message
composed of the header only. As a consequence, the payload phase is not required.
AES combined cipher machine (CCM)
The CCM algorithm allows encrypting and authenticating the plaintext, as well as generating
the corresponding ciphertext and tag (also known as message authentication code or
message integrity check). This algorithm is based on AES counter mode to ensure
confidentiality. It uses the AES CBC mode 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 (called 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 payload phase and its 32 LSB
bits are initialized to ‘1’ during the tag generation (called A0 packet in the CCM standard).
Note:
The hardware does not perform the formatting operation of the B0 packet. It should be
handled by the software.
As for the GCM algorithm, the message to be processed is split into 2 parts:
•
The header (also knows as additional authentication data): data which is authenticated
but no protected (such as information for routing the packet)
•
The payload (also knows as plaintext or ciphertext): the message itself which is
authenticated and encrypted.