STM32L4xx_HAL_Driver  1.14.0
HASH processing functions in interrupt mode

HASH processing functions using interrupt mode. More...

Functions

HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
 Initialize the HASH peripheral in SHA1 mode, next process pInBuffer then read the computed digest in interruption mode. More...
 
HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate_IT (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 If not already done, initialize the HASH peripheral in SHA1 mode then processes pInBuffer in interruption mode. More...
 
HAL_StatusTypeDef HAL_HASH_MD5_Start_IT (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
 Initialize the HASH peripheral in MD5 mode, next process pInBuffer then read the computed digest in interruption mode. More...
 
HAL_StatusTypeDef HAL_HASH_MD5_Accumulate_IT (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 If not already done, initialize the HASH peripheral in MD5 mode then processes pInBuffer in interruption mode. More...
 
void HAL_HASH_IRQHandler (HASH_HandleTypeDef *hhash)
 Handle HASH interrupt request. More...
 

Detailed Description

HASH processing functions using interrupt mode.

 ===============================================================================
                 ##### Interruption mode HASH processing functions #####
 ===============================================================================
    [..]  This section provides functions allowing to calculate in interrupt mode
          the hash value using one of the following algorithms:
      (+) MD5
         (++) HAL_HASH_MD5_Start_IT()
      (+) SHA1
         (++) HAL_HASH_SHA1_Start_IT()

    [..]  API HAL_HASH_IRQHandler() manages each HASH interruption.

    [..] Note that HAL_HASH_IRQHandler() manages as well HASH Peripheral interruptions when in
         HMAC processing mode.

Function Documentation

◆ HAL_HASH_IRQHandler()

void HAL_HASH_IRQHandler ( HASH_HandleTypeDef hhash)

Handle HASH interrupt request.

Parameters
hhashHASH handle.
Note
HAL_HASH_IRQHandler() handles interrupts in HMAC processing as well.
In case of error reported during the HASH interruption processing, HAL_HASH_ErrorCallback() API is called so that user code can manage the error. The error type is available in hhash->Status field.
Return values
None

Definition at line 942 of file stm32l4xx_hal_hash.c.

943 {
944  hhash->Status = HASH_IT(hhash);
945  if (hhash->Status != HAL_OK)
946  {
947  hhash->ErrorCode |= HAL_HASH_ERROR_IT;
948 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
949  hhash->ErrorCallback(hhash);
950 #else
951  HAL_HASH_ErrorCallback(hhash);
952 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
953  /* After error handling by code user, reset HASH handle HAL status */
954  hhash->Status = HAL_OK;
955  }
956 }
static HAL_StatusTypeDef HASH_IT(HASH_HandleTypeDef *hhash)
HASH processing in interruption mode.
return HAL_OK
void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
Error callback.

◆ HAL_HASH_MD5_Accumulate_IT()

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

If not already done, initialize the HASH peripheral in MD5 mode then processes pInBuffer in interruption mode.

Note
Consecutive calls to HAL_HASH_MD5_Accumulate_IT() can be used to feed several input buffers back-to-back to the Peripheral that will yield a single HASH signature once all buffers have been entered. Wrap-up of input buffers feeding and retrieval of digest is done by a call to HAL_HASH_MD5_Start_IT().
Field hhash->Phase of HASH handle is tested to check whether or not the Peripheral has already been initialized.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted. Only HAL_HASH_MD5_Start_IT() is able to manage the ending buffer with a length in bytes not a multiple of 4.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (buffer to be hashed).
Sizelength of the input buffer in bytes, must be a multiple of 4.
Return values
HALstatus

Definition at line 889 of file stm32l4xx_hal_hash.c.

890 {
891  return HASH_Accumulate_IT(hhash, pInBuffer, Size,HASH_ALGOSELECTION_MD5);
892 }
HAL_StatusTypeDef HASH_Accumulate_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
If not already done, initialize the HASH peripheral then processes pInBuffer in interruption mode...

◆ HAL_HASH_MD5_Start_IT()

HAL_StatusTypeDef HAL_HASH_MD5_Start_IT ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size,
uint8_t *  pOutBuffer 
)

Initialize the HASH peripheral in MD5 mode, next process pInBuffer then read the computed digest in interruption mode.

Note
Digest is available in pOutBuffer.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (buffer to be hashed).
Sizelength of the input buffer in bytes.
pOutBufferpointer to the computed digest. Digest size is 16 bytes.
Return values
HALstatus

Definition at line 866 of file stm32l4xx_hal_hash.c.

867 {
868  return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_MD5);
869 }
HAL_StatusTypeDef HASH_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Algorithm)
Initialize the HASH peripheral, next process pInBuffer then read the computed digest in interruption ...

◆ HAL_HASH_SHA1_Accumulate_IT()

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

If not already done, initialize the HASH peripheral in SHA1 mode then processes pInBuffer in interruption mode.

Note
Consecutive calls to HAL_HASH_SHA1_Accumulate_IT() can be used to feed several input buffers back-to-back to the Peripheral that will yield a single HASH signature once all buffers have been entered. Wrap-up of input buffers feeding and retrieval of digest is done by a call to HAL_HASH_SHA1_Start_IT().
Field hhash->Phase of HASH handle is tested to check whether or not the Peripheral has already been initialized.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted. Only HAL_HASH_SHA1_Start_IT() is able to manage the ending buffer with a length in bytes not a multiple of 4.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (buffer to be hashed).
Sizelength of the input buffer in bytes, must be a multiple of 4.
Return values
HALstatus

Definition at line 928 of file stm32l4xx_hal_hash.c.

929 {
930  return HASH_Accumulate_IT(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA1);
931 }
HAL_StatusTypeDef HASH_Accumulate_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
If not already done, initialize the HASH peripheral then processes pInBuffer in interruption mode...

◆ HAL_HASH_SHA1_Start_IT()

HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT ( HASH_HandleTypeDef hhash,
uint8_t *  pInBuffer,
uint32_t  Size,
uint8_t *  pOutBuffer 
)

Initialize the HASH peripheral in SHA1 mode, next process pInBuffer then read the computed digest in interruption mode.

Note
Digest is available in pOutBuffer.
Parameters
hhashHASH handle.
pInBufferpointer to the input buffer (buffer to be hashed).
Sizelength of the input buffer in bytes.
pOutBufferpointer to the computed digest. Digest size is 20 bytes.
Return values
HALstatus

Definition at line 904 of file stm32l4xx_hal_hash.c.

905 {
906  return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA1);
907 }
HAL_StatusTypeDef HASH_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Algorithm)
Initialize the HASH peripheral, next process pInBuffer then read the computed digest in interruption ...