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
745
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
AES256 Accelerator
16.2.11.4.2 CFB Decryption
Figure 16-13. CFB Decryption
(1)
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 16-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 half-words
DMA1: Triggered by AES trigger 1,
Source: AESADOUT,
Destination: plaintext, Size: num_blocks*8 half-words
DMA2: Triggered by AES trigger 2,
Source: ciphertext, Destination: AESADIN,
Size: num_blocks*8 half-words
Start decryption:
AESBLKCNT= num_blocks;
Trigger decryption by setting AESDINWR= 1;
End of decryption: DMA1IFG=1
}