21 #ifndef STM32L4xx_HAL_HASH_H 22 #define STM32L4xx_HAL_HASH_H 95 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) 113 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 114 typedef struct __HASH_HandleTypeDef
153 __IO uint32_t ErrorCode;
157 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 158 void (* InCpltCallback)(
struct __HASH_HandleTypeDef * hhash);
160 void (* DgstCpltCallback)(
struct __HASH_HandleTypeDef * hhash);
162 void (* ErrorCallback)(
struct __HASH_HandleTypeDef * hhash);
164 void (* MspInitCallback)(
struct __HASH_HandleTypeDef * hhash);
166 void (* MspDeInitCallback)(
struct __HASH_HandleTypeDef * hhash);
171 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) 191 #define HASH_ALGOSELECTION_SHA1 0x00000000U 192 #define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 193 #define HASH_ALGOSELECTION_SHA224 HASH_CR_ALGO_1 194 #define HASH_ALGOSELECTION_SHA256 HASH_CR_ALGO 202 #define HASH_ALGOMODE_HASH 0x00000000U 203 #define HASH_ALGOMODE_HMAC HASH_CR_MODE 211 #define HASH_DATATYPE_32B 0x00000000U 212 #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 213 #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 214 #define HASH_DATATYPE_1B HASH_CR_DATATYPE 222 #define HASH_HMAC_KEYTYPE_SHORTKEY 0x00000000U 223 #define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY 231 #define HASH_FLAG_DINIS HASH_SR_DINIS 232 #define HASH_FLAG_DCIS HASH_SR_DCIS 233 #define HASH_FLAG_DMAS HASH_SR_DMAS 234 #define HASH_FLAG_BUSY HASH_SR_BUSY 235 #define HASH_FLAG_DINNE HASH_CR_DINNE 244 #define HASH_IT_DINI HASH_IMR_DINIE 245 #define HASH_IT_DCI HASH_IMR_DCIE 253 #define HAL_HASHEx_IRQHandler HAL_HASH_IRQHandler 261 #define HAL_HASH_ERROR_NONE 0x00000000U 262 #define HAL_HASH_ERROR_IT 0x00000001U 263 #define HAL_HASH_ERROR_DMA 0x00000002U 264 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) 265 #define HAL_HASH_ERROR_INVALID_CALLBACK 0x00000004U 290 #define __HAL_HASH_GET_FLAG(__FLAG__) (((__FLAG__) > 8U) ? \ 291 ((HASH->CR & (__FLAG__)) == (__FLAG__)) :\ 292 ((HASH->SR & (__FLAG__)) == (__FLAG__)) ) 302 #define __HAL_HASH_CLEAR_FLAG(__FLAG__) CLEAR_BIT(HASH->SR, (__FLAG__)) 312 #define __HAL_HASH_ENABLE_IT(__INTERRUPT__) SET_BIT(HASH->IMR, (__INTERRUPT__)) 321 #define __HAL_HASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(HASH->IMR, (__INTERRUPT__)) 328 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 329 #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) do{\ 330 (__HANDLE__)->State = HAL_HASH_STATE_RESET;\ 331 (__HANDLE__)->MspInitCallback = NULL; \ 332 (__HANDLE__)->MspDeInitCallback = NULL; \ 335 #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET) 343 #define __HAL_HASH_RESET_HANDLE_STATUS(__HANDLE__) ((__HANDLE__)->Status = HAL_OK) 350 #define __HAL_HASH_SET_MDMAT() SET_BIT(HASH->CR, HASH_CR_MDMAT) 356 #define __HAL_HASH_RESET_MDMAT() CLEAR_BIT(HASH->CR, HASH_CR_MDMAT) 363 #define __HAL_HASH_START_DIGEST() SET_BIT(HASH->STR, HASH_STR_DCAL) 370 #define __HAL_HASH_SET_NBVALIDBITS(__SIZE__) MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8U * ((__SIZE__) % 4U)) 376 #define __HAL_HASH_INIT() SET_BIT(HASH->CR, HASH_CR_INIT) 391 #define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20U : \ 392 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA224) ? 28U : \ 393 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA256) ? 32U : 16U ) ) ) 398 #define HASH_NBW_PUSHED() ((READ_BIT(HASH->CR, HASH_CR_NBW)) >> 8U) 405 #define IS_HASH_DATATYPE(__DATATYPE__) (((__DATATYPE__) == HASH_DATATYPE_32B)|| \ 406 ((__DATATYPE__) == HASH_DATATYPE_16B)|| \ 407 ((__DATATYPE__) == HASH_DATATYPE_8B) || \ 408 ((__DATATYPE__) == HASH_DATATYPE_1B)) 417 #define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__) ((READ_BIT(HASH->CR, HASH_CR_MDMAT) == 0U) || (((__SIZE__) % 4U) == 0U)) 427 #define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__,__SIZE__) ((((__HANDLE__)->DigestCalculationDisable) == RESET) || (((__SIZE__) % 4U) == 0U)) 433 #define IS_HASH_PROCESSING(__HANDLE__) ((__HANDLE__)->Phase == HAL_HASH_PHASE_PROCESS) 440 #define IS_HMAC_PROCESSING(__HANDLE__) (((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_1) || \ 441 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_2) || \ 442 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_3)) 469 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) 586 HAL_StatusTypeDef
HASH_Start(
HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout, uint32_t Algorithm);
592 HAL_StatusTypeDef
HMAC_Start(
HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout, uint32_t Algorithm);
uint8_t * pHashMsgBuffPtr
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_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest in SHA1 mode.
struct __HASH_HandleTypeDef else typedef struct endif HASH_HandleTypeDef
HASH Handle Structure definition.
DMA_HandleTypeDef * hdmain
void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
Initialize the HASH MSP.
void HAL_HASH_ContextRestoring(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer)
Restore the HASH context in case of processing resumption.
HAL_HASH_CallbackIDTypeDef
HAL HASH common Callback ID enumeration definition.
HAL_HASH_PhaseTypeDef Phase
void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH MSP.
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 ...
DMA handle Structure definition.
HAL_StatusTypeDef HAL_HASH_RegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID, pHASH_CallbackTypeDef pCallback)
Register a User HASH Callback To be used instead of the weak (surcharged) predefined callback...
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...
void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash)
Input data transfer complete call back.
uint8_t * pHashKeyBuffPtr
HAL_StatusTypeDef HASH_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest.
void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash)
Digest computation complete call back.
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_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 interrup...
uint8_t * pHashOutBuffPtr
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_HASH_PhaseTypeDef
HAL phase structures definition.
Header file of HASH HAL module.
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_Init(HASH_HandleTypeDef *hhash)
Initialize the HASH according to the specified parameters in the HASH_HandleTypeDef and create the as...
HAL_HASH_SuspendTypeDef
HAL HASH mode suspend definitions.
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.
void(* pHASH_CallbackTypeDef)(HASH_HandleTypeDef *hhash)
HAL HASH Callback pointer definition.
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 ...
HAL_StatusTypeDef HAL_HASH_GetStatus(HASH_HandleTypeDef *hhash)
Return the HASH HAL status.
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_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 interrupt...
__IO HAL_HASH_StateTypeDef State
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...
void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
Error callback.
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(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.
uint32_t HAL_HASH_GetError(HASH_HandleTypeDef *hhash)
Return the HASH handle error code.
void HAL_HASH_SwFeed_ProcessSuspend(HASH_HandleTypeDef *hhash)
Initiate HASH processing suspension when in polling or interruption mode.
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_DeInit(HASH_HandleTypeDef *hhash)
DeInitialize the HASH peripheral.
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...
FlagStatus DigestCalculationDisable
__IO uint32_t HashInCount
__IO uint32_t Accumulation
HAL_LockTypeDef
HAL Lock structures definition.
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_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 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 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 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...
HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash)
Return the HASH handle state.
ADC handle Structure definition.
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_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout)
Return the computed digest in MD5 mode.
void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash)
Handle HASH interrupt request.
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...
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...
__IO uint32_t NbWordsAlreadyPushed
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.
HAL_StatusTypeDef HAL_HASH_UnRegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID)
Unregister a HASH Callback HASH Callback is redirected to the weak (surcharged) predefined callback...
__IO uint32_t HashITCounter
HAL_HASH_SuspendTypeDef SuspendRequest
__IO uint32_t HashKeyCount
HAL_StatusTypeDef HAL_HASH_DMAFeed_ProcessSuspend(HASH_HandleTypeDef *hhash)
Suspend the HASH processing when in DMA mode.
HAL_HASH_StateTypeDef
HAL State structures definition.
void HAL_HASH_ContextSaving(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer)
Save the HASH context in case of processing suspension.