DocID018909 Rev 11
729/1731
RM0090
Cryptographic processor (CRYP)
757
Note:
The header part must precede the payload and the two parts cannot be mixed together.
In CCM mode, 4 steps are required to perform and encryption or decryption:
1.
CCM init phase
In this first step, the B0 packet of the CCM message (1st packet) is programmed into
the CRYP_DIN register. During this phase, the CRYP_DOUT register does not contain
any output data.
The following sequence must be followed:
a) Make sure that the cryptographic processor is disabled by clearing the CRYPEN
bit in the CRYP_CR register.
b) Select the CCM chaining mode by programming the ALGOMODE bits to ‘01001’
in the CRYP_CR register.
c) Configure the GCM_CCMPH bits to ‘00’ in CRYP_CR to start the CCM Init phase.
d) Initialize the key registers (128,192 and 256 bits) in CRYP_KEYRx as well as the
initialization vector (IV).
e) Set the CRYPEN bit to ‘1’ in CRYP_CR.
f)
Program the B0 packet into the input data register.
g) Wait for the CRYPEN bit to be cleared before moving on to the next phase.
h) Set CRYPEN to ‘1’.
2. CCM header phase
This step must be performed after the CCM Init phase. The sequence is identical for
encryption and decryption.
During this phase, the CRYP_DOUT register does not contain any output data.
This phase can be skipped if there is no additional authenticated data.
The following sequence must be followed:
i)
Set the GCM_CCMPH bit to ’01’ in CRYP_CR to indicate that the header phase
has started.
j)
Three methods can be used:
–
Program the header data by blocks of 32 bits into the CRYP_DIN register, and use
the IFNF flag to determine if the input FIFO can receive data. The size of the
header must be a multiple of 128 bits (4 words).
–
Program the header data into the CRYP_DIN register by blocks of 8 words, and
use the IFEM flag to determine if the input FIFO can receive data (IFEM=’1’). The
size of the header must be a multiple of 128 bits (4 words).
–
Use the DMA.