Figure 85. Cbc Encryption; Figure 86. Cbc Decryption - ST STM32G0 1 Series Reference Manual

Table of Contents

Advertisement

AES hardware accelerator (AES)
Figure 85
Legend
input
output
XOR
In CBC encrypt mode, the first plaintext input block, after bit/byte/half-word swapping (P1'),
is XOR-ed with a 128-bit IVI bitfield (initialization vector and counter), producing the I1 input
data for encrypt with the AES core, using a 128- or 256-bit key. The resulting 128-bit output
block O1, after swapping operation, is used as ciphertext C1. The O1 data is then XOR-ed
with the second-block plaintext data P2' to produce the I2 input data for the AES core to
produce the second block of ciphertext data. The chaining of data blocks continues in this
way until the last plaintext block in the message is encrypted.
If the message size is not a multiple of 128 bits, the final partial data block is encrypted in
the way explained in
Figure 86
Legend
input
output
XOR
In CBC decrypt mode, like in ECB decrypt mode, the secret key must be prepared to
perform an AES decryption.
After the key preparation process, the decryption goes as follows: the first 128-bit ciphertext
block (after the swap operation) is used directly as the AES core input block I1 for decrypt
operation, using the 128-bit or 256-bit key. Its output O1 is XOR-ed with the 128-bit IVI field
(that must be identical to that used during encryption) to produce the first plaintext block P1.
486/1390
illustrates the cipher block chaining (CBC) encryption.

Figure 85. CBC encryption

AES_DINR (plaintext P1)
DATATYPE[1:0]
AES_IVRx (init. vector)
AES_KEYRx (KEY)
DATATYPE[1:0]
AES_DOUTR (ciphertext C1)
Section 20.4.6: AES ciphertext stealing and data
illustrates the cipher block chaining (CBC) decryption.

Figure 86. CBC decryption

AES_DINR (ciphertext C1)
DATATYPE[1:0]
AES_KEYRx (KEY)
AES_IVRx (IV)
DATATYPE[1:0]
AES_DOUTR (plaintext P1)
Block 1
Swap
management
P1'
IVI
I1
AES_KEYRx (KEY)
Block cipher
encryption
O1
Swap
management
Block 1
Swap
management
I1
AES_KEYRx (KEY)
Decrypt
O1
IVI
P1'
Swap
management
RM0444 Rev 5
Block 2
AES_DINR (plaintext P2)
Swap
DATATYPE[1:0]
management
Block cipher
encryption
Swap
DATATYPE[1:0]
management
AES_DOUTR (ciphertext C2)
padding.
Block 2
AES_DINR (ciphertext C2)
Swap
DATATYPE[1:0]
management
Decrypt
Swap
DATATYPE[1:0]
management
AES_DOUTR (plaintext P2)
RM0444
P2'
I2
O2
MSv19107V2
I2
O2
P2'
MSv19104V2

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