STM32L4xx_HAL_Driver  1.14.0
Multi-buffer HMAC extended processing functions in DMA mode

HMAC extended processing functions in multi-buffer DMA mode. More...

Functions

HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 MD5 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 MD5 HMAC step 2 in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 MD5 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA1 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA1 HMAC step 2 in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA1 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA224 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA224 HMAC step 2 in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA224 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA256 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA256 HMAC step 2 in multi-buffer DMA mode. More...
 
HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 SHA256 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. More...
 

Detailed Description

HMAC extended processing functions in multi-buffer DMA mode.

 ===============================================================================
      ##### Multi-buffer DMA mode HMAC extended processing functions #####
 ===============================================================================
    [..]  This section provides functions to manage HMAC multi-buffer
          DMA-based processing for MD5, SHA1, SHA224 and SHA256 algorithms.
      (+) MD5
         (++) HAL_HMACEx_MD5_Step1_2_DMA()
         (++) HAL_HMACEx_MD5_Step2_DMA()
         (++) HAL_HMACEx_MD5_Step2_3_DMA()
      (+) SHA1
         (++) HAL_HMACEx_SHA1_Step1_2_DMA()
         (++) HAL_HMACEx_SHA1_Step2_DMA()
         (++) HAL_HMACEx_SHA1_Step2_3_DMA()

      (+) SHA256
         (++) HAL_HMACEx_SHA224_Step1_2_DMA()
         (++) HAL_HMACEx_SHA224_Step2_DMA()
         (++) HAL_HMACEx_SHA224_Step2_3_DMA()
      (+) SHA256
         (++) HAL_HMACEx_SHA256_Step1_2_DMA()
         (++) HAL_HMACEx_SHA256_Step2_DMA()
         (++) HAL_HMACEx_SHA256_Step2_3_DMA()

    [..]  User must first start-up the multi-buffer DMA-based HMAC computation in
          calling HAL_HMACEx_xxx_Step1_2_DMA(). This carries out HMAC step 1 and
          intiates step 2 with the first input buffer.

    [..]  The following buffers are next fed to the Peripheral with a call to the API
          HAL_HMACEx_xxx_Step2_DMA(). There may be several consecutive calls
          to this API.

    [..]  Multi-buffer DMA-based HMAC computation is wrapped up by a call to
          HAL_HMACEx_xxx_Step2_3_DMA(). This finishes step 2 in feeding the last input
          buffer to the Peripheral then carries out step 3.

    [..]  Digest is retrieved by a call to HAL_HASH_xxx_Finish() for MD-5 or
          SHA-1, to HAL_HASHEx_xxx_Finish() for SHA-224 or SHA-256.

    [..]  If only two buffers need to be consecutively processed, a call to
          HAL_HMACEx_xxx_Step1_2_DMA() followed by a call to HAL_HMACEx_xxx_Step2_3_DMA()
          is sufficient.

Function Documentation

◆ HAL_HMACEx_MD5_Step1_2_DMA()

HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

MD5 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.

Note
Step 1 consists in writing the inner hash function key in the Peripheral, step 2 consists in writing the message text.
The API carries out the HMAC step 1 then starts step 2 with the first buffer entered to the Peripheral. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 686 of file stm32l4xx_hal_hash_ex.c.

687 {
688  hhash->DigestCalculationDisable = SET;
689  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
690 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_MD5_Step2_3_DMA()

HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

MD5 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral, step 3 consists in writing the outer hash function key.
The API wraps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffer must be the last one of the multi-buffer thread) then carries out HMAC step 3.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
Once the DMA transfers are finished (indicated by hhash->State set back to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve the computed digest.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 733 of file stm32l4xx_hal_hash_ex.c.

734 {
735  hhash->DigestCalculationDisable = RESET;
736  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
737 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_MD5_Step2_DMA()

HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

MD5 HMAC step 2 in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral.
The API carries on the HMAC step 2, applied to the buffer entered as input parameter. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 707 of file stm32l4xx_hal_hash_ex.c.

708 {
709  if (hhash->DigestCalculationDisable != SET)
710  {
711  return HAL_ERROR;
712  }
713  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5);
714 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA1_Step1_2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA1 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.

Note
Step 1 consists in writing the inner hash function key in the Peripheral, step 2 consists in writing the message text.
The API carries out the HMAC step 1 then starts step 2 with the first buffer entered to the Peripheral. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 756 of file stm32l4xx_hal_hash_ex.c.

757 {
758  hhash->DigestCalculationDisable = SET;
759  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
760 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA1_Step2_3_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA1 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral, step 3 consists in writing the outer hash function key.
The API wraps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffer must be the last one of the multi-buffer thread) then carries out HMAC step 3.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
Once the DMA transfers are finished (indicated by hhash->State set back to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve the computed digest.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 803 of file stm32l4xx_hal_hash_ex.c.

804 {
805  hhash->DigestCalculationDisable = RESET;
806  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
807 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA1_Step2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA1 HMAC step 2 in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral.
The API carries on the HMAC step 2, applied to the buffer entered as input parameter. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 777 of file stm32l4xx_hal_hash_ex.c.

778 {
779  if (hhash->DigestCalculationDisable != SET)
780  {
781  return HAL_ERROR;
782  }
783  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1);
784 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA224_Step1_2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA224 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.

Note
Step 1 consists in writing the inner hash function key in the Peripheral, step 2 consists in writing the message text.
The API carries out the HMAC step 1 then starts step 2 with the first buffer entered to the Peripheral. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 825 of file stm32l4xx_hal_hash_ex.c.

826 {
827  hhash->DigestCalculationDisable = SET;
828  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
829 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA224_Step2_3_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA224 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral, step 3 consists in writing the outer hash function key.
The API wraps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffer must be the last one of the multi-buffer thread) then carries out HMAC step 3.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
Once the DMA transfers are finished (indicated by hhash->State set back to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve the computed digest.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 872 of file stm32l4xx_hal_hash_ex.c.

873 {
874  hhash->DigestCalculationDisable = RESET;
875  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
876 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA224_Step2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA224 HMAC step 2 in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral.
The API carries on the HMAC step 2, applied to the buffer entered as input parameter. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 846 of file stm32l4xx_hal_hash_ex.c.

847 {
848  if (hhash->DigestCalculationDisable != SET)
849  {
850  return HAL_ERROR;
851  }
852  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224);
853 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA256_Step1_2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA256 HMAC step 1 completion and step 2 start in multi-buffer DMA mode.

Note
Step 1 consists in writing the inner hash function key in the Peripheral, step 2 consists in writing the message text.
The API carries out the HMAC step 1 then starts step 2 with the first buffer entered to the Peripheral. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 894 of file stm32l4xx_hal_hash_ex.c.

895 {
896  hhash->DigestCalculationDisable = SET;
897  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
898 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA256_Step2_3_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA256 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral, step 3 consists in writing the outer hash function key.
The API wraps up the HMAC step 2 in processing the buffer entered as input parameter (the input buffer must be the last one of the multi-buffer thread) then carries out HMAC step 3.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
Once the DMA transfers are finished (indicated by hhash->State set back to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve the computed digest.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 941 of file stm32l4xx_hal_hash_ex.c.

942 {
943  hhash->DigestCalculationDisable = RESET;
944  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
945 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...

◆ HAL_HMACEx_SHA256_Step2_DMA()

HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size 
)

SHA256 HMAC step 2 in multi-buffer DMA mode.

Note
Step 2 consists in writing the message text in the Peripheral.
The API carries on the HMAC step 2, applied to the buffer entered as input parameter. DCAL bit is not automatically set after the message buffer feeding, allowing other messages DMA transfers to occur.
Same key is used for the inner and the outer hash functions; pointer to key and key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (message buffer).
Sizelength of the input buffer in bytes.
Return values
HALstatus

Definition at line 915 of file stm32l4xx_hal_hash_ex.c.

916 {
917  if (hhash->DigestCalculationDisable != SET)
918  {
919  return HAL_ERROR;
920  }
921  return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256);
922 }
HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode then initiate the required DMA transfers to feed the key ...