Plaintext
Ciphertext
AES128/192/256
encrypt
Key
Plaintext
Ciphertext
AES128/192/256
encrypt
Key
Plaintext
Ciphertext
AES128/192/256
encrypt
Key
A
B
AES Accelerator Operation
408
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
AES256 Accelerator
14.2.11.1 Electronic Codebook (ECB) Mode
The electronic codebook block cipher mode is the most simple cipher mode. The data is divided into 128-
bit blocks and encrypted and decrypted separately.
The disadvantage of the ECB is that the same 128-bit plaintext is always encrypted to the same
ciphertext, whereas the other modes encrypt each block differently, partly dependent on the already
executed encryptions.
14.2.11.1.1 ECB Encryption
Figure 14-6. ECB Encryption
To implement the ECB encryption without CPU interaction, two DMA channels are needed. Static DMA
priorities must be enabled. The DMA triggers must be configured as level-sensitive triggers.
Table 14-3. AES and DMA Configuration for ECB Encryption
AES
CMEN
AES
CMx
AES
OPx
DMA_A
Triggered by 'AES trigger 0'
DMA_B
Triggered by 'AES trigger 1'
1
00
00
Read ciphertext from AESADOUT
Write plaintext to AESADIN, which also
triggers the next encryption
The following pseudo code snippet shows the implementation of the ECB encryption in software:
ECB_Encryption(key, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Configure AES for block cipher:
AESCMEN= 1; AESCMx= ECB; AESOPx= 00;
Write key into AESAKEY;
Setup DMA:
DMA0: Triggered by AES trigger 0,
Source: AESADOUT,
Destination: ciphertext,
Size: num_blocks*8 words, Single Transfer mode
DMA1: Triggered by AES trigger 1,
Source: plaintext, Destination: AESADIN,
Size: num_blocks*8 words, Single Transfer mode
Start encryption:
AESBLKCNT= num_blocks;
End of encryption: DMA0IFG=1
}