GD32W51x User Manual
930
Figure 27-5. DES/TDES ECB decryption
SWAP
CAU_DI
DATAM
DEA, decrypt
DEA, decrypt
DEA, encrypt
KEY3
KEY2
KEY1
SWAP
CAU_DO
Ciphertext
Plaintext
DES/TDES CBC encryption
The input data of the DEA block in CBC mode consists of two aspects: the input plaintext
after data swapping according to the data type, and the initialization vectors. When the TDES
algorithm is configured, the XOR result of the swapped plaintext data block and the 64-bit
initialization vector CAU_IV0..1 is read in the DEA and encrypted using KEY1. The output is
fed back directly to next DEA and then decrypted using KEY2. After that, the output is fed
back directly to the last DEA and encrypted with KEY3. The result is then used as the next
initialization vector and exclusive-ORed with the next plaintext data block to process next
encryption. The above operations are repeated until the last plaintext block is encrypted. Note
if the plaintext message does not consist of an integral number of data blocks, the final partial
data block should be encrypted in a specified manner. At last, the output ciphertext is also
obtained after data swapping according to the data type. When the DES algorithm is
configured, the state and process of the second and third block of DEA should be omitted.
The procedure of DES/TDES CBC mode encryption is illustrated in
.