Aes Counter (Ctr) Mode - ST STM32G0 1 Series Reference Manual

Table of Contents

Advertisement

RM0444
To resume the processing of a message, proceed as follows:
1.
If DMA is used, configure the DMA controller so as to complete the rest of the FIFO IN
and FIFO OUT transfers.
2.
Ensure that AES is disabled (the EN bit of the AES_CR must be 0).
3.
Restore AES_CR register (with correct KEYSIZE) then restore AES_KEYRx registers.
4.
Prepare the decryption key as described in
preparation
5.
Restore AES_IVRx registers using the saved configuration (only required in CBC
mode).
6.
Enable the AES peripheral by setting the EN bit of the AES_CR register.
7.
If DMA is used, enable AES DMA transfers by setting the DMAINEN and DMAOUTEN
bits of the AES_CR register.
Alternative single ECB/CBC decryption using Mode 4
The sequence of events to perform a single round of ECB/CBC decryption using Mode 4 is:
1.
Disable the AES peripheral by clearing the EN bit of the AES_CR register.
2.
Select the Mode 4 by setting to 11 the MODE[1:0] bitfield of the AES_CR register and
select ECB or CBC chaining mode by setting the CHMOD[2:0] bitfield of the AES_CR
register to 0x0 or 0x1, respectively.
3.
Select key length of 128 or 256 bits via KEYSIZE bitfield of the AES_CR register.
4.
Write the AES_KEYRx registers with the encryption key. Write the AES_IVRx registers
if the CBC mode is selected.
5.
Enable the AES peripheral by setting the EN bit of the AES_CR register.
6.
Write the AES_DINR register four times to input the cipher text (MSB first).
7.
Wait until the CCF flag is set in the AES_SR register.
8.
Read the AES_DOUTR register four times to get the plain text (MSB first). Then clear
the CCF flag by setting the CCFC bit of the AES_CR register.
Note:
When mode 4 is selected mode 3 cannot be used.
In mode 4, the AES_KEYRx registers contain the encryption key during all phases of the
processing. No derivation key is stored in these registers. It is stored internally in AES.
20.4.9

AES counter (CTR) mode

Overview
The counter mode (CTR) uses AES as a key-stream generator. The generated keys are
then XOR-ed with the plaintext to obtain the ciphertext.
CTR chaining is defined in NIST Special Publication 800-38A, Recommendation for Block
Cipher Modes of Operation. A typical message construction in CTR mode is given in
Figure
89.
(only required for ECB or CBC decryption).
RM0444 Rev 5
AES hardware accelerator (AES)
Section 20.4.5: AES decryption round key
489/1390
522

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32G0 1 Series and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF