Cryptographic processor (CRYP)
RM0090
730/1731
DocID018909 Rev 11
Note:
The first block B1 must be formatted with the header length. This task should be handled by
software.
k) Once all header data have been supplied, wait until the BUSY flag is cleared.
3. CCM payload phase (encryption/decryption)
This step must be performed after the CCM header phase. During this phase, the
encrypted/decrypted payload is stored in the CRYP_DOUT register.
The following sequence must be followed:
l)
Configure GCM_CCMPH bits to ‘10’ in CRYP_CR.
m) Select the algorithm direction (encryption or decryption) by using the ALGODIR bit
in CRYP_CR.
n) Program the payload message into the CRYP_DIN register, and use the IFNF flag
to determine if the input FIFO can receive data. Alternatively, the data could be
programmed into the CRYP_DIN register by blocks of 8 words and the IFEM flag
used to determine if the input FIFO can receive data (IFEM=’1’). In parallel, the
OFNE/OFFU flag of the CRYP_DOUT register can be monitored to check if the
output FIFO is not empty.
o) Repeat the previous step until all payload blocks have been encrypted or
decrypted. Alternatively, DMA could be used.
4. CCM final phase
This step generates the authentication tag. During this phase, the authentication tag of
the message is generated and stored in the CRYP_DOUT register.
p) Configure GCM_CCMPH[1:0] bits to ‘11’ in CRYP_CR.
q) Load the A0 initialized counter, and program the 128-bit A0 value by writing 4
times 32 bits into the CRYP_DIN register.
r) Wait
till
the
OFNE flag
(FIFO output not empty) is set to ‘1’ in the CRYP_SR
register.
s) Read the CRYP_DOUT register 4 times: the output corresponds to the encrypted
authentication tag.
t)
Disable the cryptographic processor (CRYPEN bit in CRYP_CR = ‘0’)
Note:
The hardware does not perform the formatting of the original B0 and B1 packets and the tag
comparison between encryption and decryption. They have to be handled by software.
The
cryptographic
processor does not need to be disabled/enabled when moving from the
header phase to the tag phase.
AES cipher message authentication code (CMAC)
The CMAC algorithm allows authenticating the plaintext, and generating the corresponding
tag. The CMAC sequence is identical to the CCM one, except that the payload phase is
skipped.
23.3.3 Data
type
Data enter the CRYP processor 32 bits (word) at a time as they are written into the
CRYP_DIN register. The principle of the DES is that streams of data are processed 64 bits
by 64 bits and, for each 64-bit block, the bits are numbered from M1 to M64, with M1 the left-
most bit and M64 the right-most bit of the block. The same principle is used for the AES, but
with a 128-bit block size.