STM32L4xx_HAL_Driver  1.14.0
HASH processing functions in polling mode

HASH processing functions using polling mode. More...

Functions

HAL_StatusTypeDef HAL_HASH_SHA1_Start (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
 Initialize the HASH peripheral in SHA1 mode, next process pInBuffer then read the computed digest. More...
 
HAL_StatusTypeDef HAL_HASH_MD5_Start (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
 Initialize the HASH peripheral in MD5 mode, next process pInBuffer then read the computed digest. More...
 
HAL_StatusTypeDef HAL_HASH_MD5_Accumulate (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 If not already done, initialize the HASH peripheral in MD5 mode then processes pInBuffer. More...
 
HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate (HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
 If not already done, initialize the HASH peripheral in SHA1 mode then processes pInBuffer. More...
 

Detailed Description

HASH processing functions using polling mode.

 ===============================================================================
                 ##### Polling mode HASH processing functions #####
 ===============================================================================
    [..]  This section provides functions allowing to calculate in polling mode
          the hash value using one of the following algorithms:
      (+) MD5
         (++) HAL_HASH_MD5_Start()
         (++) HAL_HASH_MD5_Accumulate()
      (+) SHA1
         (++) HAL_HASH_SHA1_Start()
         (++) HAL_HASH_SHA1_Accumulate()

    [..] For a single buffer to be hashed, user can resort to HAL_HASH_xxx_Start().

    [..]  In case of multi-buffer HASH processing (a single digest is computed while
          several buffers are fed to the Peripheral), the user can resort to successive calls
          to HAL_HASH_xxx_Accumulate() and wrap-up the digest computation by a call
          to HAL_HASH_xxx_Start().

Function Documentation

◆ HAL_HASH_MD5_Accumulate()

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

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

Note
Consecutive calls to HAL_HASH_MD5_Accumulate() 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().
Field hhash->Phase of HASH handle is tested to check whether or not the Peripheral has already been initialized.
Digest is not retrieved by this API, user must resort to HAL_HASH_MD5_Start() to read it, feeding at the same time the last input buffer to the Peripheral.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted. Only HAL_HASH_MD5_Start() 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 781 of file stm32l4xx_hal_hash.c.

782 {
783  return HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_MD5);
784 }
HAL_StatusTypeDef HASH_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
If not already done, initialize the HASH peripheral then processes pInBuffer.

◆ HAL_HASH_MD5_Start()

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

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

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.
TimeoutTimeout value
Return values
HALstatus

Definition at line 756 of file stm32l4xx_hal_hash.c.

757 {
758  return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_MD5);
759 }
HAL_StatusTypeDef HASH_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout, uint32_t Algorithm)
Initialize the HASH peripheral, next process pInBuffer then read the computed digest.

◆ HAL_HASH_SHA1_Accumulate()

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

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

Note
Consecutive calls to HAL_HASH_SHA1_Accumulate() 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().
Field hhash->Phase of HASH handle is tested to check whether or not the Peripheral has already been initialized.
Digest is not retrieved by this API, user must resort to HAL_HASH_SHA1_Start() to read it, feeding at the same time the last input buffer to the Peripheral.
The input buffer size (in bytes) must be a multiple of 4 otherwise, the HASH digest computation is corrupted. Only HAL_HASH_SHA1_Start() 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 822 of file stm32l4xx_hal_hash.c.

823 {
824  return HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA1);
825 }
HAL_StatusTypeDef HASH_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
If not already done, initialize the HASH peripheral then processes pInBuffer.

◆ HAL_HASH_SHA1_Start()

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

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

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.
TimeoutTimeout value
Return values
HALstatus

Definition at line 797 of file stm32l4xx_hal_hash.c.

798 {
799  return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA1);
800 }
HAL_StatusTypeDef HASH_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout, uint32_t Algorithm)
Initialize the HASH peripheral, next process pInBuffer then read the computed digest.