During cryptographic operations, a typical setup is to use the AHB DMA as the read FIFO source and the cipher output as
the write FIFO source. Data written to the write FIFO is always written out to the AHB DMA. This setup reads data from
memory and writes the encrypted or decrypted result back to memory.
A Cipher-based Message Authentication Code (CMAC) is similar to a digital signature or a Keyed-Hash Message
Authentication Code (HMAC). CMACs use a cipher in a block-chaining mode to form a cryptographic checksum. In this
mode, the AHB DMA is the read FIFO source, but the cipher output is not written back to memory. Only the final cipher
block is of interest, so set the write FIFO source to none.
You can use DMA to copy memory, similar to the memcpy standard C function, by setting the write FIFO source to the read
FIFO. If the Hamming ECC generator is enabled, you can copy flash memory pages to memory while simultaneously
calculating the error correction code.
You can fill memory with a block of data similar to the memset() standard C function by pointing the write FIFO source to
the read FIFO and setting the read FIFO to the APB. Similarly, you can fill memory with random data by pointing the read
FIFO source to the random number generator and the write FIFO source to the read FIFO.
To decrypt or encrypt data, set the write FIFO source to the cipher output. To implement memcpy() or memset() functions,
or to fill memory with random data, you should set the write FIFO source to the read FIFO. When calculating a hash or
CMAC, disable the write FIFO.