Configure the priority and enable the NVIC for the transfer complete interrupt
on the two DMA Streams. The output stream should have higher priority
than the input stream HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ()
2. Initialize the CRYP HAL using HAL_CRYP_Init(). This function configures mainly:
a. The data type: 1-bit, 8-bit, 16-bit and 32-bit
b. The key size: 128, 192 and 256. This parameter is relevant only for AES
c. The encryption/decryption key. It's size depends on the algorithm used for
encryption/decryption
d. The initialization vector (counter). It is not used ECB mode.
3. Three processing (encryption/decryption) functions are available:
a. Polling mode: encryption and decryption APIs are blocking functions i.e. they
process the data and wait till the processing is finished, e.g.
HAL_CRYP_AESCBC_Encrypt()
b. Interrupt mode: encryption and decryption APIs are not blocking functions i.e.
they process the data under interrupt, e.g. HAL_CRYP_AESCBC_Encrypt_IT()
c. DMA mode: encryption and decryption APIs are not blocking functions i.e. the
data transfer is ensured by DMA, e.g. HAL_CRYP_AESCBC_Encrypt_DMA()
4. When the processing function is called at first time after HAL_CRYP_Init() the CRYP
peripheral is initialized and processes the buffer in input. At second call, the
processing function performs an append of the already processed buffer. When a new
data block is to be processed, call HAL_CRYP_Init() then the processing function.
5. Call HAL_CRYP_DeInit() to deinitialize the CRYP peripheral.
11.2.2 Initialization and de-initialization functions
This section provides functions allowing to:
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef
and creates the associated handle
DeInitialize the CRYP peripheral
Initialize the CRYP MSP
DeInitialize CRYP MSP
This section contains the following APIs:
HAL_CRYP_Init()
HAL_CRYP_DeInit()
HAL_CRYP_MspInit()
HAL_CRYP_MspDeInit()
11.2.3 AES processing functions
This section provides functions allowing to:
Encrypt plaintext using AES-128/192/256 using chaining modes
Decrypt cyphertext using AES-128/192/256 using chaining modes
Three processing functions are available:
Polling mode
Interrupt mode
DMA mode
This section contains the following APIs:
HAL_CRYP_AESECB_Encrypt()
HAL_CRYP_AESCBC_Encrypt()
HAL_CRYP_AESCTR_Encrypt()
HAL_CRYP_AESECB_Decrypt()