222#ifdef HAL_HASH_MODULE_ENABLED
233#define HASH_DIGEST_CALCULATION_NOT_STARTED ((uint32_t)0x00000000U)
234#define HASH_DIGEST_CALCULATION_STARTED ((uint32_t)0x00000001U)
242#define HASH_NUMBER_OF_CSR_REGISTERS 54U
250#define HASH_TIMEOUTVALUE 1000U
258#define HASH_DMA_SUSPENSION_WORDS_LIMIT 20U
339#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
350 if (hhash->MspInitCallback == NULL)
356 hhash->MspInitCallback(hhash);
385 MODIFY_REG(HASH->CR, HASH_CR_DATATYPE, hhash->
Init.
DataType);
386#if defined(HASH_CR_MDMAT)
429#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
430 if (hhash->MspDeInitCallback == NULL)
436 hhash->MspDeInitCallback(hhash);
544#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
560 pHASH_CallbackTypeDef pCallback)
564 if (pCallback == NULL)
567 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
577 case HAL_HASH_INPUTCPLT_CB_ID :
578 hhash->InCpltCallback = pCallback;
581 case HAL_HASH_DGSTCPLT_CB_ID :
582 hhash->DgstCpltCallback = pCallback;
585 case HAL_HASH_ERROR_CB_ID :
586 hhash->ErrorCallback = pCallback;
589 case HAL_HASH_MSPINIT_CB_ID :
590 hhash->MspInitCallback = pCallback;
593 case HAL_HASH_MSPDEINIT_CB_ID :
594 hhash->MspDeInitCallback = pCallback;
599 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
609 case HAL_HASH_MSPINIT_CB_ID :
610 hhash->MspInitCallback = pCallback;
613 case HAL_HASH_MSPDEINIT_CB_ID :
614 hhash->MspDeInitCallback = pCallback;
619 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
628 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
662 case HAL_HASH_INPUTCPLT_CB_ID :
666 case HAL_HASH_DGSTCPLT_CB_ID :
671 case HAL_HASH_ERROR_CB_ID :
675 case HAL_HASH_MSPINIT_CB_ID :
679 case HAL_HASH_MSPDEINIT_CB_ID :
685 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
695 case HAL_HASH_MSPINIT_CB_ID :
699 case HAL_HASH_MSPDEINIT_CB_ID :
705 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
714 hhash->
ErrorCode |= HAL_HASH_ERROR_INVALID_CALLBACK;
811 uint8_t *pOutBuffer, uint32_t Timeout)
869 uint8_t *pOutBuffer, uint32_t Timeout)
1010 uint8_t *pOutBuffer)
1030#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
1031 hhash->ErrorCallback(hhash);
1231 uint8_t *pOutBuffer)
1249 uint8_t *pOutBuffer)
1376 return hhash->
State;
1407 uint32_t mem_ptr = (uint32_t)pMemBuffer;
1408 uint32_t csr_ptr = (uint32_t)HASH->CSR;
1418 *(uint32_t *)(mem_ptr) = READ_BIT(HASH->STR, HASH_STR_NBLW);
1421#if defined(HASH_CR_MDMAT)
1422 *(uint32_t *)(mem_ptr) = READ_BIT(HASH->CR, HASH_CR_DMAE | HASH_CR_DATATYPE | HASH_CR_MODE | HASH_CR_ALGO |
1423 HASH_CR_LKEY | HASH_CR_MDMAT);
1425 *(uint32_t *)(mem_ptr) = READ_BIT(HASH->CR, HASH_CR_DMAE | HASH_CR_DATATYPE | HASH_CR_MODE | HASH_CR_ALGO |
1432 *(uint32_t *)(mem_ptr) = *(uint32_t *)(csr_ptr);
1453 uint32_t mem_ptr = (uint32_t)pMemBuffer;
1454 uint32_t csr_ptr = (uint32_t)HASH->CSR;
1461 WRITE_REG(HASH->IMR, (*(uint32_t *)(mem_ptr)));
1464 WRITE_REG(HASH->STR, (*(uint32_t *)(mem_ptr)));
1467 WRITE_REG(HASH->CR, (*(uint32_t *)(mem_ptr)));
1477 WRITE_REG((*(uint32_t *)(csr_ptr)), (*(uint32_t *)(mem_ptr)));
1511 uint32_t tmp_remaining_DMATransferSize_inWords;
1512 uint32_t tmp_initial_DMATransferSize_inWords;
1513 uint32_t tmp_words_already_pushed;
1523 tmp_remaining_DMATransferSize_inWords = ((DMA_Stream_TypeDef *)hhash->
hdmain->
Instance)->NDTR;
1560 CLEAR_BIT(HASH->CR, HASH_CR_DMAE);
1575 tmp_remaining_DMATransferSize_inWords = ((DMA_Stream_TypeDef *)hhash->
hdmain->
Instance)->NDTR;
1577 if (tmp_remaining_DMATransferSize_inWords == 0U)
1594 tmp_initial_DMATransferSize_inWords = (((hhash->
HashInCount % 4U) != 0U) ? \
1602 if (((tmp_words_already_pushed + tmp_initial_DMATransferSize_inWords - \
1605 tmp_remaining_DMATransferSize_inWords--;
1610 hhash->
pHashInBuffPtr += 4U * (tmp_initial_DMATransferSize_inWords - tmp_remaining_DMATransferSize_inWords) ;
1613 hhash->
HashInCount = 4U * tmp_remaining_DMATransferSize_inWords;
1659 uint32_t buffersize;
1666 CLEAR_BIT(HASH->CR, HASH_CR_DMAE);
1668 if (READ_BIT(HASH->CR, HASH_CR_MODE) == 0U)
1676#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
1677 hhash->InCpltCallback(hhash);
1700#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
1701 hhash->InCpltCallback(hhash);
1719#if defined(HASH_CR_MDMAT)
1739#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
1740 hhash->InCpltCallback(hhash);
1750 inputaddr = (uint32_t)hhash->
Init.
pKey;
1769 (((buffersize % 4U) != 0U) ? ((buffersize + (4U - (buffersize % 4U))) / 4U) : \
1770 (buffersize / 4U)));
1773 SET_BIT(HASH->CR, HASH_CR_DMAE);
1811#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
1812 hhash->ErrorCallback(hhash);
1835 uint32_t buffercounter;
1836 __IO uint32_t inputaddr = (uint32_t) pInBuffer;
1839 for (buffercounter = 0U; buffercounter < Size / 4U; buffercounter++)
1842 HASH->DIN = *(uint32_t *)inputaddr;
1850 if (buffercounter * 4 >= 64U)
1871 hhash->
HashInCount = Size - (buffercounter * 4 + 4U);
1898 if (Size % 4U != 0U)
1906 HASH->DIN = (uint32_t) * (uint16_t *)inputaddr;
1910 HASH->DIN = *(uint32_t *)inputaddr;
1920 HASH->DIN = (uint32_t) * (uint8_t *)inputaddr;
1924 HASH->DIN = (uint32_t) * (uint16_t *)inputaddr;
1928 tmp = *(uint8_t *)inputaddr;
1929 tmp |= *(uint8_t *)(inputaddr + 1U) << 8U ;
1930 tmp |= *(uint8_t *)(inputaddr + 2U) << 16U;
1937 HASH->DIN = *(uint32_t *)inputaddr;
1954 uint32_t msgdigest = (uint32_t)pMsgDigest;
1960 *(uint32_t *)(msgdigest) = __REV(HASH->HR[0]);
1962 *(uint32_t *)(msgdigest) = __REV(HASH->HR[1]);
1964 *(uint32_t *)(msgdigest) = __REV(HASH->HR[2]);
1966 *(uint32_t *)(msgdigest) = __REV(HASH->HR[3]);
1969 *(uint32_t *)(msgdigest) = __REV(HASH->HR[0]);
1971 *(uint32_t *)(msgdigest) = __REV(HASH->HR[1]);
1973 *(uint32_t *)(msgdigest) = __REV(HASH->HR[2]);
1975 *(uint32_t *)(msgdigest) = __REV(HASH->HR[3]);
1977 *(uint32_t *)(msgdigest) = __REV(HASH->HR[4]);
1980 *(uint32_t *)(msgdigest) = __REV(HASH->HR[0]);
1982 *(uint32_t *)(msgdigest) = __REV(HASH->HR[1]);
1984 *(uint32_t *)(msgdigest) = __REV(HASH->HR[2]);
1986 *(uint32_t *)(msgdigest) = __REV(HASH->HR[3]);
1988 *(uint32_t *)(msgdigest) = __REV(HASH->HR[4]);
1989#if defined(HASH_CR_MDMAT)
1991 *(uint32_t *)(msgdigest) = __REV(HASH_DIGEST->HR[5]);
1993 *(uint32_t *)(msgdigest) = __REV(HASH_DIGEST->HR[6]);
1997 *(uint32_t *)(msgdigest) = __REV(HASH->HR[0]);
1999 *(uint32_t *)(msgdigest) = __REV(HASH->HR[1]);
2001 *(uint32_t *)(msgdigest) = __REV(HASH->HR[2]);
2003 *(uint32_t *)(msgdigest) = __REV(HASH->HR[3]);
2005 *(uint32_t *)(msgdigest) = __REV(HASH->HR[4]);
2006#if defined(HASH_CR_MDMAT)
2008 *(uint32_t *)(msgdigest) = __REV(HASH_DIGEST->HR[5]);
2010 *(uint32_t *)(msgdigest) = __REV(HASH_DIGEST->HR[6]);
2012 *(uint32_t *)(msgdigest) = __REV(HASH_DIGEST->HR[7]);
2036 if (Status == RESET)
2043 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
2065 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
2134#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
2135 hhash->DgstCpltCallback(hhash);
2169#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
2170 hhash->InCpltCallback(hhash);
2237 uint32_t buffercounter;
2238 uint32_t inputcounter;
2247 for (buffercounter = 0U; buffercounter < 64U; buffercounter += 4U)
2249 HASH->DIN = *(uint32_t *)inputaddr;
2256 HASH->DIN = *(uint32_t *)inputaddr;
2293 for (buffercounter = 0U; buffercounter < ((inputcounter + 3U) / 4U); buffercounter++)
2295 HASH->DIN = *(uint32_t *)inputaddr;
2309#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
2310 hhash->InCpltCallback(hhash);
2508 uint32_t Timeout, uint32_t Algorithm)
2510 uint8_t *pInBuffer_tmp;
2519 if ((pInBuffer == NULL) || (pOutBuffer == NULL))
2535 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT, Algorithm | HASH_CR_INIT);
2542 pInBuffer_tmp = pInBuffer;
2566 pInBuffer_tmp = pInBuffer;
2646 uint8_t *pInBuffer_tmp;
2651 if ((Size % 4U) != 0U)
2660 if ((pInBuffer == NULL) || (Size == 0U))
2689 pInBuffer_tmp = pInBuffer;
2696 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT, Algorithm | HASH_CR_INIT);
2750 __IO uint32_t inputaddr = (uint32_t) pInBuffer;
2751 uint32_t SizeVar = Size;
2754 if ((Size % 4U) != 0U)
2763 if ((pInBuffer == NULL) || (Size == 0U))
2787 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT, Algorithm | HASH_CR_INIT);
2806 HASH->DIN = *(uint32_t *)inputaddr;
2873 __IO uint32_t inputaddr = (uint32_t) pInBuffer;
2874 uint32_t polling_step = 0U;
2875 uint32_t initialization_skipped = 0U;
2876 uint32_t SizeVar = Size;
2882 if ((pInBuffer == NULL) || (Size == 0U) || (pOutBuffer == NULL))
2901 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT, Algorithm | HASH_CR_INIT);
2920 initialization_skipped = 1;
2934 HASH->DIN = *(uint32_t *)inputaddr;
2939 if (polling_step == 1U)
2968 if (initialization_skipped == 1U)
2978 HASH->DIN = *(uint32_t *)inputaddr;
3034 #if defined (HASH_CR_MDMAT)
3043 if ((pInBuffer == NULL) || (Size == 0U) ||
3070 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT, Algorithm | HASH_CR_INIT);
3079 inputaddr = (uint32_t)pInBuffer;
3111 (((inputSize % 4U) != 0U) ? ((inputSize + (4U - (inputSize % 4U))) / 4U) : \
3115 SET_BIT(HASH->CR, HASH_CR_DMAE);
3149 if (pOutBuffer == NULL)
3205 uint32_t Timeout, uint32_t Algorithm)
3213 if ((pInBuffer == NULL) || (Size == 0U) || (hhash->
Init.
pKey == NULL) || (hhash->
Init.
KeySize == 0U)
3214 || (pOutBuffer == NULL))
3232 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3237 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3291 if ((pInBuffer == NULL) || (Size == 0U) || (hhash->
Init.
pKey == NULL) || (hhash->
Init.
KeySize == 0U)
3292 || (pOutBuffer == NULL))
3313 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3318 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3406 if ((pInBuffer == NULL) || (Size == 0U) || (hhash->
Init.
pKey == NULL) || (hhash->
Init.
KeySize == 0U) ||
3428#if defined(HASH_CR_MDMAT)
3433 MODIFY_REG(HASH->CR, HASH_CR_MDMAT | HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3438 MODIFY_REG(HASH->CR, HASH_CR_MDMAT | HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3445 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3450 MODIFY_REG(HASH->CR, HASH_CR_LKEY | HASH_CR_ALGO | HASH_CR_MODE | HASH_CR_INIT,
3463 inputaddr = (uint32_t)(hhash->
Init.
pKey);
3486 inputaddr = (uint32_t)pInBuffer;
3492#if defined(HASH_CR_MDMAT)
3532 (((inputSize % 4U) != 0U) ? ((inputSize + (4U - (inputSize % 4U))) / 4U) \
3533 : (inputSize / 4U)));
3536 SET_BIT(HASH->CR, HASH_CR_DMAE);
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
Aborts the DMA Transfer.
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
Start the DMA Transfer with interrupt enabled.
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define HASH_ALGOSELECTION_MD5
#define HASH_ALGOSELECTION_SHA1
#define HASH_ALGOMODE_HMAC
#define HASH_DMA_SUSPENSION_WORDS_LIMIT
#define HASH_DATATYPE_16B
#define HASH_DIGEST_CALCULATION_STARTED
#define HASH_DIGEST_CALCULATION_NOT_STARTED
#define HAL_HASH_ERROR_NONE
#define HAL_HASH_ERROR_DMA
#define HAL_HASH_ERROR_IT
void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH MSP.
void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash)
Digest computation complete call back.
HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH peripheral.
void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash)
Input data transfer complete call back.
HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash)
Initialize the HASH according to the specified parameters in the HASH_HandleTypeDef and create the as...
void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
Initialize the HASH MSP.
void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
Error callback.
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.
HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
End computation of a single HASH signature after several calls to HAL_HASH_MD5_Accmlt() API.
HAL_StatusTypeDef HAL_HASH_MD5_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
If not already done, initialize the HASH peripheral in MD5 mode then processes pInBuffer.
HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
End computation of a single HASH signature after several calls to HAL_HASH_SHA1_Accmlt() API.
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.
HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
If not already done, initialize the HASH peripheral in SHA1 mode then processes pInBuffer.
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 ...
HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
End computation of a single HASH signature after several calls to HAL_HASH_MD5_Accmlt_IT() API.
HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_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 interrupt...
HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
End computation of a single HASH signature after several calls to HAL_HASH_SHA1_Accmlt_IT() API.
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 i...
void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash)
Handle HASH interrupt request.
HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_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 interrup...
HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest in MD5 mode.
HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
Initialize the HASH peripheral in MD5 mode then initiate a DMA transfer to feed the input buffer to t...
HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
Initialize the HASH peripheral in SHA1 mode then initiate a DMA transfer to feed the input buffer to ...
HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest in SHA1 mode.
HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
Initialize the HASH peripheral in HMAC MD5 mode, next process pInBuffer then read the computed digest...
HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout)
Initialize the HASH peripheral in HMAC SHA1 mode, next process pInBuffer then read the computed diges...
HAL_StatusTypeDef HAL_HMAC_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
Initialize the HASH peripheral in HMAC SHA1 mode, next process pInBuffer then read the computed diges...
HAL_StatusTypeDef HAL_HMAC_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer)
Initialize the HASH peripheral in HMAC MD5 mode, next process pInBuffer then read the computed digest...
HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
Initialize the HASH peripheral in HMAC MD5 mode then initiate the required DMA transfers to feed the ...
HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
Initialize the HASH peripheral in HMAC SHA1 mode then initiate the required DMA transfers to feed the...
void HAL_HASH_ContextSaving(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer)
Save the HASH context in case of processing suspension.
HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash)
Return the HASH handle state.
HAL_StatusTypeDef HAL_HASH_GetStatus(HASH_HandleTypeDef *hhash)
Return the HASH HAL status.
uint32_t HAL_HASH_GetError(HASH_HandleTypeDef *hhash)
Return the HASH handle error code.
void HAL_HASH_ContextRestoring(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer)
Restore the HASH context in case of processing resumption.
void HAL_HASH_SwFeed_ProcessSuspend(HASH_HandleTypeDef *hhash)
Initiate HASH processing suspension when in polling or interruption mode.
HAL_StatusTypeDef HAL_HASH_DMAFeed_ProcessSuspend(HASH_HandleTypeDef *hhash)
Suspend the HASH processing when in DMA mode.
#define __HAL_HASH_SET_MDMAT()
Enable the multi-buffer DMA transfer mode.
#define __HAL_HASH_INIT()
Reset the HASH core.
#define __HAL_HASH_SET_NBVALIDBITS(__SIZE__)
Set the number of valid bits in the last word written in data register DIN.
#define __HAL_HASH_DISABLE_IT(__INTERRUPT__)
Disable the specified HASH interrupt.
#define __HAL_HASH_ENABLE_IT(__INTERRUPT__)
Enable the specified HASH interrupt.
#define __HAL_HASH_GET_FLAG(__FLAG__)
Check whether or not the specified HASH flag is set.
#define __HAL_HASH_RESET_MDMAT()
Disable the multi-buffer DMA transfer mode.
#define __HAL_HASH_START_DIGEST()
Start the digest computation.
HAL_HASH_StateTypeDef
HAL State structures definition.
@ HAL_HASH_PHASE_HMAC_STEP_1
@ HAL_HASH_PHASE_HMAC_STEP_3
@ HAL_HASH_PHASE_HMAC_STEP_2
@ HAL_HASH_STATE_SUSPENDED
#define HASH_HMAC_KEYTYPE_LONGKEY
#define HASH_NUMBER_OF_CSR_REGISTERS
static uint32_t HASH_Write_Block_Data(HASH_HandleTypeDef *hhash)
Write a block of data in HASH Peripheral in interruption mode.
static void HASH_DMAXferCplt(DMA_HandleTypeDef *hdma)
DMA HASH Input Data transfer completion callback.
static HAL_StatusTypeDef HASH_WaitOnFlagUntilTimeout(HASH_HandleTypeDef *hhash, uint32_t Flag, FlagStatus Status, uint32_t Timeout)
Handle HASH processing Timeout.
static void HASH_GetDigest(uint8_t *pMsgDigest, uint8_t Size)
Retrieve the message digest.
static HAL_StatusTypeDef HMAC_Processing(HASH_HandleTypeDef *hhash, uint32_t Timeout)
HMAC processing in polling mode.
HAL_StatusTypeDef HMAC_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Timeout, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode, next process pInBuffer then read the computed digest.
static HAL_StatusTypeDef HASH_WriteData(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
Feed the input buffer to the HASH Peripheral.
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_StatusTypeDef HASH_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm)
Initialize the HASH peripheral then initiate a DMA transfer to feed the input buffer to the Periphera...
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.
static HAL_StatusTypeDef HASH_IT(HASH_HandleTypeDef *hhash)
HASH processing in interruption mode.
HAL_StatusTypeDef HASH_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest.
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_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 ...
static void HASH_DMAError(DMA_HandleTypeDef *hdma)
DMA HASH communication error callback.
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_StatusTypeDef HMAC_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer, uint32_t Algorithm)
Initialize the HASH peripheral in HMAC mode, next process pInBuffer then read the computed digest in ...
#define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__, __SIZE__)
Ensure that input data buffer size is valid for multi-buffer HMAC processing in DMA mode.
#define IS_HASH_PROCESSING(__HANDLE__)
Ensure that handle phase is set to HASH processing.
#define HASH_NBW_PUSHED()
Return number of words already pushed in the FIFO.
#define IS_HMAC_PROCESSING(__HANDLE__)
Ensure that handle phase is set to HMAC processing.
#define HASH_DIGEST_LENGTH()
Return digest length in bytes.
#define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__)
Ensure that input data buffer size is valid for multi-buffer HASH processing in DMA mode.
#define IS_HASH_DATATYPE(__DATATYPE__)
Ensure that HASH input data type is valid.
#define HASH_TIMEOUTVALUE
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
#define __HAL_UNLOCK(__HANDLE__)
#define __HAL_LOCK(__HANDLE__)
HASH Handle Structure definition.
__IO uint32_t NbWordsAlreadyPushed
HAL_HASH_PhaseTypeDef Phase
uint8_t * pHashOutBuffPtr
__IO HAL_HASH_StateTypeDef State
__IO uint32_t HashInCount
FlagStatus DigestCalculationDisable
uint8_t * pHashMsgBuffPtr
__IO uint32_t HashITCounter
__IO uint32_t HashKeyCount
DMA_HandleTypeDef * hdmain
uint8_t * pHashKeyBuffPtr
HAL_HASH_SuspendTypeDef SuspendRequest
__IO uint32_t Accumulation
DMA handle Structure definition.
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
DMA_Stream_TypeDef * Instance