MAX32665-MAX32668 User Guide
Maxim Integrated Page 435 of 457
The following procedure is required to load a key of 128 bits or less:
1. Clear CRYPTO_CTRL.done = 0 and CRYPTO_CTRL.dma_done = 0.
2. Set CIPHER_CTRL.src = 0b01 to copy the contents of AES_KEY_2 into CIPHER_KEY_0.
3. Poll until hardware sets CRYPTO_CTRL.dma_done = 1.
4. Clear CRYPTO_CTRL.done = 0 and CRYPTO_CTRL.dma_done = 0.
The following procedure is required for key lengths greater than 128 bits:
1. Clear CRYPTO_CTRL.done = 0 and CRYPTO_CTRL.dma_done = 0.
2. Set CIPHER_CTRL.src = 0b01 to copy the contents of AES_KEY_2 into CIPHER_KEY_0.
3. Poll until hardware sets CRYPTO_CTRL.dma_done = 1.
4. Clear CRYPTO_CTRL.done = 0 and CRYPTO_CTRL.dma_done = 0.
5. Set CIPHER_CTRL.src = 0b11 to copy the contents of AES_KEY_3 into CIPHER_KEY_0.
6. Poll until hardware sets CRYPTO_CTRL.dma_done = 1.
7. Clear CRYPTO_CTRL.done = 0 and CRYPTO_CTRL.dma_done = 0.
23.2.2 Operation
The cipher algorithm and mode of operation are set in the cipher control register. The cipher key must be loaded before
starting a block cipher operation. The cipher starts operating once the FIFO is full.
1. Reset the cryptographic accelerator by setting CRYPTO_CTRL.rst=1.
2. Poll until hardware sets CRYPTO_CTRL.rdy = 1.
3. Select the cipher algorithm operation using CIPHER_CTRL.cipher.
4. Select the mode of operation using CIPHER_CTRL.mode.
5. Select encryption or decryption mode CIPHER_CTRL.enc.
6. Load CIPHER_INIT_0, CIPHER_INIT_1, CIPHER_INIT_2, CIPHER_INIT_3 with the initial vector if using CBC, CFB, OFB
or counter modes.
7. Set CRYPTO_CTRL.rdsrc = 0b01 to select the read FIFO source as DMA
8. Set CRYPTO_CTRL.wrsrc to 0b01 to select the cipher output FIFO source as DMA
9. Load DMA source address to DMA_SRC.
10. Load DMA destination address to DMA_SRC.
11. Load DMA count to DMA_CNT.
At the end of the DMA count:
• CRYPTO_CTRL.done = 1
• CRYPTO_CTRL.dma_done = 1
• CRYPTO_CTRL.cph_done = 1
An interrupt will be generated if CRYPTO_CTRL.int = 1
23.3 Hash Function Accelerator
A hash algorithm takes an input message of arbitrary length and summarizes it in a fixed-length message. The hash function
accelerator executes the SHA algorithms listed in Table 23-3. Hash Functions.