Plaintext
Plaintext
Plaintext
AES128/192/256
encrypt
Key
Initialization Vector
Ciphertext
AES128/192/256
encrypt
Key
Ciphertext
AES128/192/256
encrypt
Key
Ciphertext
A
B
C
AES Accelerator Operation
416
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
AES256 Accelerator
14.2.11.4.2 CFB Decryption
Figure 14-13. CFB Decryption
To implement the CFB decryption without CPU interaction, three DMA channels are needed. Static DMA
priorities must be enabled. The DMA triggers must be configured as level-sensitive triggers.
(1)
Note, in this cipher mode, the decryption also uses AES encryption on block level thus the key used for decryption is identical
with the key used for encryption; therefore, no decryption key generation is required.
Table 14-10. AES and DMA Configuration for CFB Decryption
AES
CMEN
AES
CMx
AES
OPx
DMA_A
Triggered by 'AES trigger 0'
DMA_B
Triggered by 'AES trigger 1'
DMA_C
Triggered by 'AES trigger 2'
1
11
01 or
11
(1)
Write the ciphertext of the
current block to AESAXIN
Read the plaintext from
AESADOUT
Write the ciphertext of the
current block to AESADIN,
which also triggers the next
encryption
The following pseudo code snippets shows the implementation of the CFB encryption and decryption in
software:
CFB_Decryption(Key, IV, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Reset AES Module (clears internal state memory):
AESSWRST= 1;
Configure AES:
AESCMEN= 1; AESCMx= CFB; AESOPx= 01;
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: ciphertext, Destination: AESAXIN,
Size: num_blocks*8 words, Single Transfer mode
DMA1: Triggered by AES trigger 1,
Source: AESADOUT,
Destination: plaintext,
Size: num_blocks*8 words, Single Transfer mode
DMA2: Triggered by AES trigger 2,
Source: ciphertext, Destination: AESADIN,
Size: num_blocks*8 words, Single Transfer mode
Start decryption:
AESBLKCNT= num_blocks;
Trigger decryption by setting AESDINWR= 1;
End of decryption: DMA1IFG=1
}