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
415
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
AES256 Accelerator
14.2.11.4 Cipher Feedback (CFB) Mode
In the cipher feedback cipher mode, the plaintext of the new block is XORed to the last encryption result.
The result of the encryption is the input for the new encryption.
The initialization vector must be loaded by software (or by a separate DMA transfer).
14.2.11.4.1 CFB Encryption
Figure 14-12. CFB Encryption
To implement the CFB 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-9. AES and DMA Configuration for CFB Encryption
AES
CMEN
AES
CMx
AES
OPx
DMA_A
Triggered by 'AES trigger 0'
DMA_B
Triggered by 'AES trigger 1'
1
11
00
Write the plaintext of the current block to
AESAXIN
Read the ciphertext from AESADOUT,
which also triggers the next encryption
The following pseudo code snippet shows the implementation of the CFB encryption in software:
CFB_Encryption(Key, IV, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Reset AES Module (clears internal state memory):
AESSWRST= 1;
Configure AES:
AESCMEN= 1; AESCMx= CFB; 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: plaintext, Destination: AESAXIN,
Size: num_blocks*8 words, Single Transfer mode
DMA1: Triggered by AES trigger 1,
Source: AESADOUT,
Destination: ciphertext,
Size: num_blocks*8 words, Single Transfer mode
Start encryption:
AESBLKCNT= num_blocks;
Trigger encryption by setting AESDINWR= 1;
End of encryption: DMA1IFG=1
}