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
C
AES Accelerator Operation
413
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
AES256 Accelerator
14.2.11.3 Output Feedback (OFB) Mode
The output feedback cipher mode continuously encrypts the initialization vector. The ciphertext is
generated by XORing the corresponding plaintext with the encrypted initialization vector.
The initialization vector must be loaded by software (or by a separate DMA transfer).
14.2.11.3.1 OFB Encryption
Figure 14-10. OFB Encryption
To implement the OFB encryption without CPU interaction, three DMA channels are needed. Static DMA
priorities must be enabled. The DMA triggers must be configured as level-sensitive triggers.
Table 14-7. AES and DMA Configuration for OFB Encryption
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
00
Write the plaintext of the current
block to AESAXIN
Read ciphertext from
AESADOUT
Write the plaintext of the current
block to AESAXDIN, which also
triggers the next encryption
The following pseudo code snippet shows the implementation of the OFB encryption in software:
OFB_Encryption(Key, IV, plaintext, ciphertext, num_blocks)
// Pseudo Code
{
Reset AES Module (clears internal state memory):
AESSWRST= 1;
Configure AES:
AESCMEN= 1; AESCMx= OFB; 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
DMA2: Triggered by AES trigger 2,
Source: plaintext, Destination: AESAXDIN,
Size: num_blocks*8 words, Single Transfer mode
Start encryption:
AESBLKCNT= num_blocks;
Trigger encryption by setting AESDINWR= 1;
End of encryption: DMA1IFG=1
}