STM32L486xx HAL User Manual
Functions
AES extended processing functions
CRYPEx Exported Functions

Extended processing functions. More...

Functions

HAL_StatusTypeDef HAL_CRYPEx_AES (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout)
 Carry out in polling mode the ciphering or deciphering operation according to hcryp->Init structure fields, all operating modes (encryption, key derivation and/or decryption) and chaining modes ECB, CBC and CTR are managed by this function in polling mode.
HAL_StatusTypeDef HAL_CRYPEx_AES_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData)
 Carry out in interrupt mode the ciphering or deciphering operation according to hcryp->Init structure fields, all operating modes (encryption, key derivation and/or decryption) and chaining modes ECB, CBC and CTR are managed by this function in interrupt mode.
HAL_StatusTypeDef HAL_CRYPEx_AES_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData)
 Carry out in DMA mode the ciphering or deciphering operation according to hcryp->Init structure fields.
HAL_StatusTypeDef HAL_CRYPEx_AES_Auth (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout)
 Carry out in polling mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.
HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData)
 Carry out in interrupt mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.
HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData)
 Carry out in DMA mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.

Detailed Description

Extended processing functions.

  ==============================================================================
                      ##### AES extended processing functions #####
  ==============================================================================
    [..]  This section provides functions allowing to:
      (+) Encrypt plaintext or decrypt cipher text using AES algorithm in different chaining modes.
          Functions are generic (handles ECB, CBC and CTR and all modes) and are only differentiated
          based on the processing type. Three processing types are available:
          (++) Polling mode
          (++) Interrupt mode
          (++) DMA mode
      (+) Generate and authentication tag in addition to encrypt/decrypt a plain/cipher text using AES
          algorithm in different chaining modes.
          Functions are generic (handles GCM, GMAC, CMAC and CCM when applicable) and process only one phase
          so that steps can be skipped if so required. Functions are only differentiated based on the processing type.
          Three processing types are available:
          (++) Polling mode
          (++) Interrupt mode
          (++) DMA mode


Function Documentation

HAL_StatusTypeDef HAL_CRYPEx_AES ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint16_t  Size,
uint8_t *  pOutputData,
uint32_t  Timeout 
)

Carry out in polling mode the ciphering or deciphering operation according to hcryp->Init structure fields, all operating modes (encryption, key derivation and/or decryption) and chaining modes ECB, CBC and CTR are managed by this function in polling mode.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:Pointer to the plain text in case of encryption or cipher text in case of decryption or key derivation+decryption. Parameter is meaningless in case of key derivation.
Size,:Length of the input data buffer in bytes, must be a multiple of 16. Parameter is meaningless in case of key derivation.
pOutputData,:Pointer to the cipher text in case of encryption or plain text in case of decryption/key derivation+decryption, or pointer to the derivative keys in case of key derivation only.
Timeout,:Specify Timeout value
Return values:
HALstatus

Definition at line 182 of file stm32l4xx_hal_cryp_ex.c.

References CRYP_ProcessData(), and CRYP_ReadKey().

Referenced by HAL_CRYP_AESCBC_Decrypt(), HAL_CRYP_AESCBC_Encrypt(), HAL_CRYP_AESCTR_Decrypt(), HAL_CRYP_AESCTR_Encrypt(), HAL_CRYP_AESECB_Decrypt(), and HAL_CRYP_AESECB_Encrypt().

HAL_StatusTypeDef HAL_CRYPEx_AES_Auth ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint64_t  Size,
uint8_t *  pOutputData,
uint32_t  Timeout 
)

Carry out in polling mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:
  • pointer to payload data in GCM or CCM payload phase,
  • pointer to B0 block in CMAC header phase,
  • pointer to C block in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init, header and final phases.
Size,:
  • length of the input payload data buffer in bytes in GCM or CCM payload phase,
  • length of B0 block (in bytes) in CMAC header phase,
  • length of C block (in bytes) in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CCM final phase.
  • Parameter is message length in bytes in case of GCM final phase.
  • Parameter must be set to zero in case of GMAC final phase.
pOutputData,:
  • pointer to plain or cipher text in GCM/CCM payload phase,
  • pointer to authentication tag in GCM/GMAC/CCM/CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CMAC header phase.
Timeout,:Specify Timeout value
Note:
Supported operating modes are encryption and decryption, supported chaining modes are GCM, GMAC, CMAC and CCM when the latter is applicable.
Phases are singly processed according to hcryp->Init.GCMCMACPhase so that steps in these specific chaining modes can be skipped by the user if so required.
Return values:
HALstatus

Definition at line 448 of file stm32l4xx_hal_cryp_ex.c.

References CRYP_BUSY_TIMEOUTVALUE, CRYP_Padding(), CRYP_POLLING_ON, CRYP_WaitOnBusyFlagReset(), and CRYP_WaitOnCCFlag().

HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint64_t  Size,
uint8_t *  pOutputData 
)

Carry out in DMA mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:
  • pointer to payload data in GCM or CCM payload phase,
  • pointer to B0 block in CMAC header phase,
  • pointer to C block in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init, header and final phases.
Size,:
  • length of the input payload data buffer in bytes in GCM or CCM payload phase,
  • length of B0 block (in bytes) in CMAC header phase,
  • length of C block (in bytes) in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CCM final phase.
  • Parameter is message length in bytes in case of GCM final phase.
  • Parameter must be set to zero in case of GMAC final phase.
pOutputData,:
  • pointer to plain or cipher text in GCM/CCM payload phase,
  • pointer to authentication tag in GCM/GMAC/CCM/CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CMAC header phase.
Note:
Supported operating modes are encryption and decryption, supported chaining modes are GCM, GMAC and CMAC.
Phases are singly processed according to hcryp->Init.GCMCMACPhase so that steps in these specific chaining modes can be skipped by the user if so required.
pInputData and pOutputData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values:
HALstatus

Definition at line 1390 of file stm32l4xx_hal_cryp_ex.c.

References CRYP_Authentication_SetDMAConfig(), CRYP_CCF_TIMEOUTVALUE, CRYP_Padding(), CRYP_POLLING_OFF, CRYP_POLLING_ON, CRYP_WaitOnCCFlag(), and HAL_CRYP_OutCpltCallback().

HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint64_t  Size,
uint8_t *  pOutputData 
)

Carry out in interrupt mode the authentication tag generation as well as the ciphering or deciphering operation according to hcryp->Init structure fields.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:
  • pointer to payload data in GCM or CCM payload phase,
  • pointer to B0 block in CMAC header phase,
  • pointer to C block in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init, header and final phases.
Size,:
  • length of the input payload data buffer in bytes in GCM or CCM payload phase,
  • length of B0 block (in bytes) in CMAC header phase,
  • length of C block (in bytes) in CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CCM final phase.
  • Parameter is message length in bytes in case of GCM final phase.
  • Parameter must be set to zero in case of GMAC final phase.
pOutputData,:
  • pointer to plain or cipher text in GCM/CCM payload phase,
  • pointer to authentication tag in GCM/GMAC/CCM/CMAC final phase.
  • Parameter is meaningless in case of GCM/GMAC/CCM init and header phases.
  • Parameter is meaningless in case of CMAC header phase.
Note:
Supported operating modes are encryption and decryption, supported chaining modes are GCM, GMAC and CMAC.
Phases are singly processed according to hcryp->Init.GCMCMACPhase so that steps in these specific chaining modes can be skipped by the user if so required.
Return values:
HALstatus

Definition at line 943 of file stm32l4xx_hal_cryp_ex.c.

HAL_StatusTypeDef HAL_CRYPEx_AES_DMA ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint16_t  Size,
uint8_t *  pOutputData 
)

Carry out in DMA mode the ciphering or deciphering operation according to hcryp->Init structure fields.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:Pointer to the plain text in case of encryption or cipher text in case of decryption or key derivation+decryption.
Size,:Length of the input data buffer in bytes, must be a multiple of 16.
pOutputData,:Pointer to the cipher text in case of encryption or plain text in case of decryption/key derivation+decryption.
Note:
Chaining modes ECB, CBC and CTR are managed by this function in DMA mode.
Supported operating modes are encryption, decryption and key derivation with decryption.
No DMA channel is provided for key derivation only and therefore, access to AES_KEYRx registers must be done by software.
This API is not applicable to key derivation only; for such a mode, access to AES_KEYRx registers must be done by software thru HAL_CRYPEx_AES() or HAL_CRYPEx_AES_IT() APIs.
pInputData and pOutputData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values:
HALstatus

Definition at line 367 of file stm32l4xx_hal_cryp_ex.c.

References CRYP_SetDMAConfig().

Referenced by HAL_CRYP_AESCBC_Decrypt_DMA(), HAL_CRYP_AESCBC_Encrypt_DMA(), HAL_CRYP_AESCTR_Decrypt_DMA(), HAL_CRYP_AESCTR_Encrypt_DMA(), HAL_CRYP_AESECB_Decrypt_DMA(), and HAL_CRYP_AESECB_Encrypt_DMA().

HAL_StatusTypeDef HAL_CRYPEx_AES_IT ( CRYP_HandleTypeDef *  hcryp,
uint8_t *  pInputData,
uint16_t  Size,
uint8_t *  pOutputData 
)

Carry out in interrupt mode the ciphering or deciphering operation according to hcryp->Init structure fields, all operating modes (encryption, key derivation and/or decryption) and chaining modes ECB, CBC and CTR are managed by this function in interrupt mode.

Parameters:
hcryp,:pointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pInputData,:Pointer to the plain text in case of encryption or cipher text in case of decryption or key derivation+decryption. Parameter is meaningless in case of key derivation.
Size,:Length of the input data buffer in bytes, must be a multiple of 16. Parameter is meaningless in case of key derivation.
pOutputData,:Pointer to the cipher text in case of encryption or plain text in case of decryption/key derivation+decryption, or pointer to the derivative keys in case of key derivation only.
Return values:
HALstatus

Definition at line 262 of file stm32l4xx_hal_cryp_ex.c.

Referenced by HAL_CRYP_AESCBC_Decrypt_IT(), HAL_CRYP_AESCBC_Encrypt_IT(), HAL_CRYP_AESCTR_Decrypt_IT(), HAL_CRYP_AESCTR_Encrypt_IT(), HAL_CRYP_AESECB_Decrypt_IT(), and HAL_CRYP_AESECB_Encrypt_IT().