SLAU846A June 2023 – October 2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1
The cipher block chaining (CBC) cipher mode builds upon the ECB cipher mode to make the ciphertext output for each block dependent not only on the plaintext and the cipher key k, but also upon the ciphertext of the previous block. The CBC cipher is shown in Figure 23-6. Like ECB mode, the plaintext data is divided into 128-bit blocks. Unlike ECB mode, in CBC mode each new plaintext block is bit-wise XORed with the previous ciphertext block to create the input to the AES block cipher.
In CBC mode, an unpredictable initialization vector (IV) must be provided. The initialization vector is XORed with the first plaintext block, as there is no "previous" ciphertext block to XOR the first plaintext block with.
AES Operation | AES DMA Triggers | ||||
---|---|---|---|---|---|
CMEN | CMx | OPx | DMA_A (DMA_TRIG0) | DMA_B (DMA_TRIG1) | DMA_C (DMA_TRIG2) |
0x1 | 0x1 (CBC) | 0x0 (encryption) | Used to read ciphertext from AESADOUT | Used to write plaintext to AESAXIN, which also triggers start of block encryption when 128 bits are written to AESADIN | Not used |
0x1/0x2 (decryption) | Used to write the initialization vector and previous ciphertext block to AESAXIN | Used to read plaintext from AESADOUT | Used to write next ciphertext to AESADIN, which also triggers start of block decryption when 128 bits are written to AESADIN |