STM32L4xx_HAL_Driver  1.14.0
AES processing functions

Processing functions. More...

Functions

HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout)
 Encrypt pPlainData in AES ECB encryption mode. The cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout)
 Decrypt pCypherData in AES ECB decryption mode with key derivation, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout)
 Encrypt pPlainData in AES CBC encryption mode with key derivation. The cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout)
 Decrypt pCypherData in AES ECB decryption mode with key derivation, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout)
 Encrypt pPlainData in AES CTR encryption mode. The cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout)
 Decrypt pCypherData in AES CTR decryption mode, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES ECB encryption mode using Interrupt, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES CBC encryption mode using Interrupt, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES CTR encryption mode using Interrupt, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES ECB decryption mode using Interrupt, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES CTR decryption mode using Interrupt, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES CBC decryption mode using Interrupt, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES ECB encryption mode using DMA, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES ECB decryption mode using DMA, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES CBC encryption mode using DMA, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES CBC decryption mode using DMA, the decyphered data are available in pPlainData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData)
 Encrypt pPlainData in AES CTR encryption mode using DMA, the cypher data are available in pCypherData. More...
 
HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA (CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData)
 Decrypt pCypherData in AES CTR decryption mode using DMA, the decyphered data are available in pPlainData. More...
 

Detailed Description

Processing functions.

  ==============================================================================
                      ##### AES processing functions #####
  ==============================================================================
    [..]  This section provides functions allowing to:
      (+) Encrypt plaintext using AES algorithm in different chaining modes
      (+) Decrypt cyphertext using AES algorithm in different chaining modes
    [..]  Three processing functions are available:
      (+) Polling mode
      (+) Interrupt mode
      (+) DMA mode

Function Documentation

◆ HAL_CRYP_AESCBC_Decrypt()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData,
uint32_t  Timeout 
)

Decrypt pCypherData in AES ECB decryption mode with key derivation, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 678 of file stm32l4xx_hal_cryp.c.

679 {
680  /* Re-initialize AES IP with proper parameters */
681  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
682  {
683  return HAL_ERROR;
684  }
685  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
686  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
687  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
688  if (HAL_CRYP_Init(hcryp) != HAL_OK)
689  {
690  return HAL_ERROR;
691  }
692 
693  return HAL_CRYPEx_AES(hcryp, pCypherData, Size, pPlainData, Timeout);
694 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESCBC_Decrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES CBC decryption mode using DMA, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 1047 of file stm32l4xx_hal_cryp.c.

1048 {
1049  /* Re-initialize AES IP with proper parameters */
1050  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
1051  {
1052  return HAL_ERROR;
1053  }
1054  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
1055  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
1056  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
1057  if (HAL_CRYP_Init(hcryp) != HAL_OK)
1058  {
1059  return HAL_ERROR;
1060  }
1061 
1062  return HAL_CRYPEx_AES_DMA(hcryp, pCypherData, Size, pPlainData);
1063 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESCBC_Decrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES CBC decryption mode using Interrupt, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 860 of file stm32l4xx_hal_cryp.c.

861 {
862  /* Re-initialize AES IP with proper parameters */
863  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
864  {
865  return HAL_ERROR;
866  }
867  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
868  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
869  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
870  if (HAL_CRYP_Init(hcryp) != HAL_OK)
871  {
872  return HAL_ERROR;
873  }
874 
875  return HAL_CRYPEx_AES_IT(hcryp, pCypherData, Size, pPlainData);
876 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...

◆ HAL_CRYP_AESCBC_Encrypt()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData,
uint32_t  Timeout 
)

Encrypt pPlainData in AES CBC encryption mode with key derivation. The cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 585 of file stm32l4xx_hal_cryp.c.

586 {
587  /* Re-initialize AES IP with proper parameters */
588  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
589  {
590  return HAL_ERROR;
591  }
592  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
593  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
594  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
595  if (HAL_CRYP_Init(hcryp) != HAL_OK)
596  {
597  return HAL_ERROR;
598  }
599 
600  return HAL_CRYPEx_AES(hcryp, pPlainData, Size, pCypherData, Timeout);
601 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESCBC_Encrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES CBC encryption mode using DMA, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 954 of file stm32l4xx_hal_cryp.c.

955 {
956  /* Re-initialize AES IP with proper parameters */
957  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
958  {
959  return HAL_ERROR;
960  }
961  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
962  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
963  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
964  if (HAL_CRYP_Init(hcryp) != HAL_OK)
965  {
966  return HAL_ERROR;
967  }
968 
969  return HAL_CRYPEx_AES_DMA(hcryp, pPlainData, Size, pCypherData);
970 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESCBC_Encrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES CBC encryption mode using Interrupt, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 769 of file stm32l4xx_hal_cryp.c.

770 {
771  /* Re-initialize AES IP with proper parameters */
772  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
773  {
774  return HAL_ERROR;
775  }
776  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
777  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CBC;
778  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
779  if (HAL_CRYP_Init(hcryp) != HAL_OK)
780  {
781  return HAL_ERROR;
782  }
783 
784  return HAL_CRYPEx_AES_IT(hcryp, pPlainData, Size, pCypherData);
785 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...

◆ HAL_CRYP_AESCTR_Decrypt()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData,
uint32_t  Timeout 
)

Decrypt pCypherData in AES CTR decryption mode, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 709 of file stm32l4xx_hal_cryp.c.

710 {
711  /* Re-initialize AES IP with proper parameters */
712  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
713  {
714  return HAL_ERROR;
715  }
716  hcryp->Init.OperatingMode = CRYP_ALGOMODE_DECRYPT;
717  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
718  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
719  if (HAL_CRYP_Init(hcryp) != HAL_OK)
720  {
721  return HAL_ERROR;
722  }
723 
724  return HAL_CRYPEx_AES(hcryp, pCypherData, Size, pPlainData, Timeout);
725 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESCTR_Decrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES CTR decryption mode using DMA, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 1078 of file stm32l4xx_hal_cryp.c.

1079 {
1080  /* Re-initialize AES IP with proper parameters */
1081  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
1082  {
1083  return HAL_ERROR;
1084  }
1085  hcryp->Init.OperatingMode = CRYP_ALGOMODE_DECRYPT;
1086  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
1087  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
1088  if (HAL_CRYP_Init(hcryp) != HAL_OK)
1089  {
1090  return HAL_ERROR;
1091  }
1092 
1093  return HAL_CRYPEx_AES_DMA(hcryp, pCypherData, Size, pPlainData);
1094 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESCTR_Decrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES CTR decryption mode using Interrupt, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 890 of file stm32l4xx_hal_cryp.c.

891 {
892  /* Re-initialize AES IP with proper parameters */
893  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
894  {
895  return HAL_ERROR;
896  }
897  hcryp->Init.OperatingMode = CRYP_ALGOMODE_DECRYPT;
898  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
899  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
900  if (HAL_CRYP_Init(hcryp) != HAL_OK)
901  {
902  return HAL_ERROR;
903  }
904 
905  return HAL_CRYPEx_AES_IT(hcryp, pCypherData, Size, pPlainData);
906 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...

◆ HAL_CRYP_AESCTR_Encrypt()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData,
uint32_t  Timeout 
)

Encrypt pPlainData in AES CTR encryption mode. The cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 616 of file stm32l4xx_hal_cryp.c.

617 {
618  /* Re-initialize AES IP with proper parameters */
619  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
620  {
621  return HAL_ERROR;
622  }
623  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
624  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
625  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
626  if (HAL_CRYP_Init(hcryp) != HAL_OK)
627  {
628  return HAL_ERROR;
629  }
630 
631  return HAL_CRYPEx_AES(hcryp, pPlainData, Size, pCypherData, Timeout);
632 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESCTR_Encrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES CTR encryption mode using DMA, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer.
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 985 of file stm32l4xx_hal_cryp.c.

986 {
987  /* Re-initialize AES IP with proper parameters */
988  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
989  {
990  return HAL_ERROR;
991  }
992  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
993  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
994  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
995  if (HAL_CRYP_Init(hcryp) != HAL_OK)
996  {
997  return HAL_ERROR;
998  }
999 
1000  return HAL_CRYPEx_AES_DMA(hcryp, pPlainData, Size, pCypherData);
1001 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESCTR_Encrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES CTR encryption mode using Interrupt, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 800 of file stm32l4xx_hal_cryp.c.

801 {
802  /* Re-initialize AES IP with proper parameters */
803  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
804  {
805  return HAL_ERROR;
806  }
807  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
808  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_CTR;
809  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
810  if (HAL_CRYP_Init(hcryp) != HAL_OK)
811  {
812  return HAL_ERROR;
813  }
814 
815  return HAL_CRYPEx_AES_IT(hcryp, pPlainData, Size, pCypherData);
816 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...

◆ HAL_CRYP_AESECB_Decrypt()

HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData,
uint32_t  Timeout 
)

Decrypt pCypherData in AES ECB decryption mode with key derivation, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 647 of file stm32l4xx_hal_cryp.c.

648 {
649  /* Re-initialize AES IP with proper parameters */
650  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
651  {
652  return HAL_ERROR;
653  }
654  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
655  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
656  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
657  if (HAL_CRYP_Init(hcryp) != HAL_OK)
658  {
659  return HAL_ERROR;
660  }
661 
662  return HAL_CRYPEx_AES(hcryp, pCypherData, Size, pPlainData, Timeout);
663 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESECB_Decrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES ECB decryption mode using DMA, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 1016 of file stm32l4xx_hal_cryp.c.

1017 {
1018  /* Re-initialize AES IP with proper parameters */
1019  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
1020  {
1021  return HAL_ERROR;
1022  }
1023  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
1024  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
1025  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
1026  if (HAL_CRYP_Init(hcryp) != HAL_OK)
1027  {
1028  return HAL_ERROR;
1029  }
1030 
1031  return HAL_CRYPEx_AES_DMA(hcryp, pCypherData, Size, pPlainData);
1032 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESECB_Decrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pCypherData,
uint16_t  Size,
uint8_t *  pPlainData 
)

Decrypt pCypherData in AES ECB decryption mode using Interrupt, the decyphered data are available in pPlainData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pCypherDataPointer to the cyphertext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pPlainDataPointer to the plaintext buffer.
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 830 of file stm32l4xx_hal_cryp.c.

831 {
832  /* Re-initialize AES IP with proper parameters */
833  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
834  {
835  return HAL_ERROR;
836  }
837  hcryp->Init.OperatingMode = CRYP_ALGOMODE_KEYDERIVATION_DECRYPT;
838  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
839  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
840  if (HAL_CRYP_Init(hcryp) != HAL_OK)
841  {
842  return HAL_ERROR;
843  }
844 
845  return HAL_CRYPEx_AES_IT(hcryp, pCypherData, Size, pPlainData);
846 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...

◆ HAL_CRYP_AESECB_Encrypt()

HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData,
uint32_t  Timeout 
)

Encrypt pPlainData in AES ECB encryption mode. The cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
TimeoutSpecify Timeout value
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES() API instead (usage recommended).
Return values
HALstatus

Definition at line 554 of file stm32l4xx_hal_cryp.c.

555 {
556  /* Re-initialize AES IP with proper parameters */
557  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
558  {
559  return HAL_ERROR;
560  }
561  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
562  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
563  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
564  if (HAL_CRYP_Init(hcryp) != HAL_OK)
565  {
566  return HAL_ERROR;
567  }
568 
569  return HAL_CRYPEx_AES(hcryp, pPlainData, Size, pCypherData, Timeout);
570 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
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 f...
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...

◆ HAL_CRYP_AESECB_Encrypt_DMA()

HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES ECB encryption mode using DMA, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_DMA() API instead (usage recommended).
pPlainData and pCypherData buffers must be 32-bit aligned to ensure a correct DMA transfer to and from the IP.
Return values
HALstatus

Definition at line 921 of file stm32l4xx_hal_cryp.c.

922 {
923  /* Re-initialize AES IP with proper parameters */
924  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
925  {
926  return HAL_ERROR;
927  }
928  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
929  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
930  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
931  if (HAL_CRYP_Init(hcryp) != HAL_OK)
932  {
933  return HAL_ERROR;
934  }
935 
936  return HAL_CRYPEx_AES_DMA(hcryp, pPlainData, Size, pCypherData);
937 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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 field...

◆ HAL_CRYP_AESECB_Encrypt_IT()

HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT ( CRYP_HandleTypeDef hcryp,
uint8_t *  pPlainData,
uint16_t  Size,
uint8_t *  pCypherData 
)

Encrypt pPlainData in AES ECB encryption mode using Interrupt, the cypher data are available in pCypherData.

Parameters
hcryppointer to a CRYP_HandleTypeDef structure that contains the configuration information for CRYP module
pPlainDataPointer to the plaintext buffer
SizeLength of the plaintext buffer in bytes, must be a multiple of 16.
pCypherDataPointer to the cyphertext buffer
Note
This API is provided only to maintain compatibility with legacy software. Users should directly resort to generic HAL_CRYPEx_AES_IT() API instead (usage recommended).
Return values
HALstatus

Definition at line 739 of file stm32l4xx_hal_cryp.c.

740 {
741  /* Re-initialize AES IP with proper parameters */
742  if (HAL_CRYP_DeInit(hcryp) != HAL_OK)
743  {
744  return HAL_ERROR;
745  }
746  hcryp->Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT;
747  hcryp->Init.ChainingMode = CRYP_CHAINMODE_AES_ECB;
748  hcryp->Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
749  if (HAL_CRYP_Init(hcryp) != HAL_OK)
750  {
751  return HAL_ERROR;
752  }
753 
754  return HAL_CRYPEx_AES_IT(hcryp, pPlainData, Size, pCypherData);
755 }
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
DeInitialize the CRYP peripheral.
return HAL_OK
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initialize the CRYP according to the specified parameters in the CRYP_InitTypeDef and initialize the ...
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...