Plaintext
Ciphertext
AES128/192/256
encrypt
Key
Initialization Vector
Plaintext
Ciphertext
AES128/192/256
encrypt
Key
Plaintext
Ciphertext
AES128/192/256
encrypt
Key
A
B
AES Accelerator Operation
740
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
AES256 Accelerator
16.2.11.2 Cipher Block Chaining (CBC) Mode
The cipher block chaining ciphermode always performs an XOR on the ciphertext of the previous block
with the current block. Therefore, the encryption of each block depends on not only the key but also on the
previous encryption.
16.2.11.2.1 CBC Encryption
For encryption, the initialization vector must be loaded by software (or by a separate DMA transfer) into
AESXIN before the DMA can be enabled to write the first 16 bytes of the plaintext into AESAXDIN (see
Figure 16-8. CBC Encryption
Table 16-5. AES and DMA Configuration for CBC Encryption
AES
CMEN
AES
CMx
AES
OPx
DMA_A
Triggered by 'AES trigger 0'
DMA_B
Triggered by 'AES trigger 1'
1
01
00
Read ciphertext from AESADOUT
Write plaintext to AESAXDIN, which also
triggers the next encryption
The following pseudo code snippet shows the implementation of the CBC encryption in software:
CBC_Encryption(key, IV, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Reset AES Module (clears internal state memory):
AESSWRST= 1;
Configure AES for block cipher:
AESCMEN= 1; AESCMx= CBC; AESOPx= 00;
Write key into AESAKEY;
Write IV into AESAXIN; // Does not trigger encryption.
// Assumes that state is reset (=> XORing with Zeros).
Setup DMA:
DMA0: Triggered by AES trigger 0,
Source: AESADOUT,
Destination: ciphertext, Size: num_blocks*8 half-words
DMA1: Triggered by AES trigger 1,
Source: plaintext, Destination: AESAXDIN,
Size: num_blocks*8 half-words
Start encryption:
AESBLKCNT= num_blocks;
End of encryption: DMA0IFG=1
}