DocID018909 Rev 11
727/1731
RM0090
Cryptographic processor (CRYP)
757
1.
GCM init phase
During this first step, the HASH key is calculated and saved internally to be used for
processing all the blocks. It is recommended to follow the sequence below:
a) Make sure that the cryptographic processor is disabled by clearing the CRYPEN
bit in the CRYP_CR register.
b) Select the GCM chaining mode by programming ALGOMODE bits to ‘01000’ in
CRYP_CR.
c) Configure GCM_CCMPH bits to ‘00’ in CRYP_CR to start the GCM Init phase.
d) Initialize the key registers (128,192 and 256 bits) in CRYP_KEYRx as well as the
initialization vector (IV).
e) Set CRYPEN bit to ‘1’ to start the calculation of the HASH key.
f)
Wait for the CRYPEN bit to be cleared to ‘0’ before moving on to the next phase.
g) Set the CRYPEN bit to ‘1’.
2. GCM header phase
This step must be performed after the GCM Init phase:
h) Set the GCM_CCMPH bits to ‘01’ in CRYP_CR to indicate that the header phase
has started.
i)
Write the header data. Three methods can be used:
–
Program the 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 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.
j)
Once all header data have been supplied, wait until the BUSY bit is cleared in the
CRYP_SR register.
3. GCM payload phase (encryption/decryption)
This step must be performed after the GCM header phase:
k) Configure GCM_CCMPH to ‘10’ in the CRYP_CR register.
l)
Select the algorithm direction (encryption or decryption) by using the ALGODIR bit
in CRYP_CR.
m) 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