Ciphertext
AES128/192/256
encrypt
Key
Initialization Vector
Plaintext
AES128/192/256
encrypt
Key
AES128/192/256
encrypt
Key
Plaintext
Plaintext
Ciphertext
Ciphertext
A
B
C
AES Accelerator Operation
743
SLAU356I – March 2015 – Revised June 2019
Copyright © 2015–2019, Texas Instruments Incorporated
AES256 Accelerator
16.2.11.3.2 OFB Decryption
Figure 16-11. OFB 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-8. AES and DMA Configuration for OFB 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
10
01 or
11
(1)
Write the ciphertext of the current
block to AESAXIN
Read plaintext from AESADOUT
Write the ciphertext of the current
block to AESAXDIN, which also
triggers the next encryption
The following pseudo code snippet shows the implementation of the OFB decryption in software:
OFB_Decryption(Key, IV, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Reset AES Module (clears internal state memory):
AESSWRST= 1;
Configure AES:
AESCMEN= 1; AESCMx= OFB; 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: AESAXDIN,
Size: num_blocks*8 half-words
Start decryption:
AESBLKCNT= num_blocks;
Trigger decryption by setting AESDINWR= 1;
End of decryption: DMA1IFG=1
}