Updated and Validated
[betaflight.git] / lib / main / STM32F7 / Drivers / STM32F7xx_HAL_Driver / Inc / stm32f7xx_hal_hash.h
blob3cf5c25900034cc6a23faca42c154a7511f6de18
1 /**
2 ******************************************************************************
3 * @file stm32f7xx_hal_hash.h
4 * @author MCD Application Team
5 * @brief Header file of HASH HAL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.</center></h2>
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_HASH_H
22 #define STM32F7xx_HAL_HASH_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
31 /** @addtogroup STM32F7xx_HAL_Driver
32 * @{
34 #if defined (HASH)
35 /** @addtogroup HASH
36 * @{
39 /* Exported types ------------------------------------------------------------*/
40 /** @defgroup HASH_Exported_Types HASH Exported Types
41 * @{
44 /**
45 * @brief HASH Configuration Structure definition
47 typedef struct
49 uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit data.
50 This parameter can be a value of @ref HASH_Data_Type. */
52 uint32_t KeySize; /*!< The key size is used only in HMAC operation. */
54 uint8_t* pKey; /*!< The key is used only in HMAC operation. */
56 } HASH_InitTypeDef;
58 /**
59 * @brief HAL State structures definition
61 typedef enum
63 HAL_HASH_STATE_RESET = 0x00U, /*!< Peripheral is not initialized */
64 HAL_HASH_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
65 HAL_HASH_STATE_BUSY = 0x02U, /*!< Processing (hashing) is ongoing */
66 HAL_HASH_STATE_TIMEOUT = 0x06U, /*!< Timeout state */
67 HAL_HASH_STATE_ERROR = 0x07U, /*!< Error state */
68 HAL_HASH_STATE_SUSPENDED = 0x08U /*!< Suspended state */
69 }HAL_HASH_StateTypeDef;
71 /**
72 * @brief HAL phase structures definition
74 typedef enum
76 HAL_HASH_PHASE_READY = 0x01U, /*!< HASH peripheral is ready to start */
77 HAL_HASH_PHASE_PROCESS = 0x02U, /*!< HASH peripheral is in HASH processing phase */
78 HAL_HASH_PHASE_HMAC_STEP_1 = 0x03U, /*!< HASH peripheral is in HMAC step 1 processing phase
79 (step 1 consists in entering the inner hash function key) */
80 HAL_HASH_PHASE_HMAC_STEP_2 = 0x04U, /*!< HASH peripheral is in HMAC step 2 processing phase
81 (step 2 consists in entering the message text) */
82 HAL_HASH_PHASE_HMAC_STEP_3 = 0x05U /*!< HASH peripheral is in HMAC step 3 processing phase
83 (step 3 consists in entering the outer hash function key) */
84 }HAL_HASH_PhaseTypeDef;
86 /**
87 * @brief HAL HASH mode suspend definitions
89 typedef enum
91 HAL_HASH_SUSPEND_NONE = 0x00U, /*!< HASH peripheral suspension not requested */
92 HAL_HASH_SUSPEND = 0x01U /*!< HASH peripheral suspension is requested */
93 }HAL_HASH_SuspendTypeDef;
95 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
96 /**
97 * @brief HAL HASH common Callback ID enumeration definition
99 typedef enum
101 HAL_HASH_MSPINIT_CB_ID = 0x00U, /*!< HASH MspInit callback ID */
102 HAL_HASH_MSPDEINIT_CB_ID = 0x01U, /*!< HASH MspDeInit callback ID */
103 HAL_HASH_INPUTCPLT_CB_ID = 0x02U, /*!< HASH input completion callback ID */
104 HAL_HASH_DGSTCPLT_CB_ID = 0x03U, /*!< HASH digest computation completion callback ID */
105 HAL_HASH_ERROR_CB_ID = 0x04U, /*!< HASH error callback ID */
106 }HAL_HASH_CallbackIDTypeDef;
107 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
111 * @brief HASH Handle Structure definition
113 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
114 typedef struct __HASH_HandleTypeDef
115 #else
116 typedef struct
117 #endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */
119 HASH_InitTypeDef Init; /*!< HASH required parameters */
121 uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */
123 uint8_t *pHashOutBuffPtr; /*!< Pointer to output buffer (digest) */
125 uint8_t *pHashKeyBuffPtr; /*!< Pointer to key buffer (HMAC only) */
127 uint8_t *pHashMsgBuffPtr; /*!< Pointer to message buffer (HMAC only) */
129 uint32_t HashBuffSize; /*!< Size of buffer to be processed */
131 __IO uint32_t HashInCount; /*!< Counter of inputted data */
133 __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */
135 __IO uint32_t HashKeyCount; /*!< Counter for Key inputted data (HMAC only) */
137 HAL_StatusTypeDef Status; /*!< HASH peripheral status */
139 HAL_HASH_PhaseTypeDef Phase; /*!< HASH peripheral phase */
141 DMA_HandleTypeDef *hdmain; /*!< HASH In DMA Handle parameters */
143 HAL_LockTypeDef Lock; /*!< Locking object */
145 __IO HAL_HASH_StateTypeDef State; /*!< HASH peripheral state */
147 HAL_HASH_SuspendTypeDef SuspendRequest; /*!< HASH peripheral suspension request flag */
149 FlagStatus DigestCalculationDisable; /*!< Digest calculation phase skip (MDMAT bit control) for multi-buffers DMA-based HMAC computation */
151 __IO uint32_t NbWordsAlreadyPushed; /*!< Numbers of words already pushed in FIFO before inputting new block */
153 __IO uint32_t ErrorCode; /*!< HASH Error code */
155 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
156 void (* InCpltCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH input completion callback */
158 void (* DgstCpltCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH digest computation completion callback */
160 void (* ErrorCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH error callback */
162 void (* MspInitCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH Msp Init callback */
164 void (* MspDeInitCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH Msp DeInit callback */
166 #endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */
167 } HASH_HandleTypeDef;
169 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
171 * @brief HAL HASH Callback pointer definition
173 typedef void (*pHASH_CallbackTypeDef)(HASH_HandleTypeDef * hhash); /*!< pointer to a HASH common callback functions */
174 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
177 * @}
180 /* Exported constants --------------------------------------------------------*/
182 /** @defgroup HASH_Exported_Constants HASH Exported Constants
183 * @{
186 /** @defgroup HASH_Algo_Selection HASH algorithm selection
187 * @{
189 #define HASH_ALGOSELECTION_SHA1 0x00000000U /*!< HASH function is SHA1 */
190 #define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */
191 #define HASH_ALGOSELECTION_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */
192 #define HASH_ALGOSELECTION_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */
194 * @}
197 /** @defgroup HASH_Algorithm_Mode HASH algorithm mode
198 * @{
200 #define HASH_ALGOMODE_HASH 0x00000000U /*!< Algorithm is HASH */
201 #define HASH_ALGOMODE_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */
203 * @}
206 /** @defgroup HASH_Data_Type HASH input data type
207 * @{
209 #define HASH_DATATYPE_32B 0x00000000U /*!< 32-bit data. No swapping */
210 #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */
211 #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */
212 #define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */
214 * @}
217 /** @defgroup HASH_HMAC_Long_key_only_for_HMAC_mode HMAC key length type
218 * @{
220 #define HASH_HMAC_KEYTYPE_SHORTKEY 0x00000000U /*!< HMAC Key size is <= 64 bytes */
221 #define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY /*!< HMAC Key size is > 64 bytes */
223 * @}
226 /** @defgroup HASH_flags_definition HASH flags definitions
227 * @{
229 #define HASH_FLAG_DINIS HASH_SR_DINIS /*!< 16 locations are free in the DIN : a new block can be entered in the IP */
230 #define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */
231 #define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */
232 #define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy, processing a block of data */
233 #define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : the input buffer contains at least one word of data */
236 * @}
239 /** @defgroup HASH_interrupts_definition HASH interrupts definitions
240 * @{
242 #define HASH_IT_DINI HASH_IMR_DINIE /*!< A new block can be entered into the input buffer (DIN) */
243 #define HASH_IT_DCI HASH_IMR_DCIE /*!< Digest calculation complete */
246 * @}
248 /** @defgroup HASH_alias HASH API alias
249 * @{
251 #define HAL_HASHEx_IRQHandler HAL_HASH_IRQHandler /*!< HAL_HASHEx_IRQHandler() is re-directed to HAL_HASH_IRQHandler() for compatibility with legacy code */
253 * @}
256 /** @defgroup HASH_Error_Definition HASH Error Definition
257 * @{
259 #define HAL_HASH_ERROR_NONE 0x00000000U /*!< No error */
260 #define HAL_HASH_ERROR_IT 0x00000001U /*!< IT-based process error */
261 #define HAL_HASH_ERROR_DMA 0x00000002U /*!< DMA-based process error */
262 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
263 #define HAL_HASH_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid Callback error */
264 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
266 * @}
270 * @}
273 /* Exported macros -----------------------------------------------------------*/
274 /** @defgroup HASH_Exported_Macros HASH Exported Macros
275 * @{
278 /** @brief Check whether or not the specified HASH flag is set.
279 * @param __FLAG__: specifies the flag to check.
280 * This parameter can be one of the following values:
281 * @arg @ref HASH_FLAG_DINIS A new block can be entered into the input buffer.
282 * @arg @ref HASH_FLAG_DCIS Digest calculation complete.
283 * @arg @ref HASH_FLAG_DMAS DMA interface is enabled (DMAE=1) or a transfer is ongoing.
284 * @arg @ref HASH_FLAG_BUSY The hash core is Busy : processing a block of data.
285 * @arg @ref HASH_FLAG_DINNE DIN not empty : the input buffer contains at least one word of data.
286 * @retval The new state of __FLAG__ (TRUE or FALSE).
288 #define __HAL_HASH_GET_FLAG(__FLAG__) (((__FLAG__) > 8U) ? \
289 ((HASH->CR & (__FLAG__)) == (__FLAG__)) :\
290 ((HASH->SR & (__FLAG__)) == (__FLAG__)) )
293 /** @brief Clear the specified HASH flag.
294 * @param __FLAG__: specifies the flag to clear.
295 * This parameter can be one of the following values:
296 * @arg @ref HASH_FLAG_DINIS A new block can be entered into the input buffer.
297 * @arg @ref HASH_FLAG_DCIS Digest calculation complete
298 * @retval None
300 #define __HAL_HASH_CLEAR_FLAG(__FLAG__) CLEAR_BIT(HASH->SR, (__FLAG__))
303 /** @brief Enable the specified HASH interrupt.
304 * @param __INTERRUPT__: specifies the HASH interrupt source to enable.
305 * This parameter can be one of the following values:
306 * @arg @ref HASH_IT_DINI A new block can be entered into the input buffer (DIN)
307 * @arg @ref HASH_IT_DCI Digest calculation complete
308 * @retval None
310 #define __HAL_HASH_ENABLE_IT(__INTERRUPT__) SET_BIT(HASH->IMR, (__INTERRUPT__))
312 /** @brief Disable the specified HASH interrupt.
313 * @param __INTERRUPT__: specifies the HASH interrupt source to disable.
314 * This parameter can be one of the following values:
315 * @arg @ref HASH_IT_DINI A new block can be entered into the input buffer (DIN)
316 * @arg @ref HASH_IT_DCI Digest calculation complete
317 * @retval None
319 #define __HAL_HASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(HASH->IMR, (__INTERRUPT__))
321 /** @brief Reset HASH handle state.
322 * @param __HANDLE__: HASH handle.
323 * @retval None
326 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
327 #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) do{\
328 (__HANDLE__)->State = HAL_HASH_STATE_RESET;\
329 (__HANDLE__)->MspInitCallback = NULL; \
330 (__HANDLE__)->MspDeInitCallback = NULL; \
331 }while(0)
332 #else
333 #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET)
334 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
337 /** @brief Reset HASH handle status.
338 * @param __HANDLE__: HASH handle.
339 * @retval None
341 #define __HAL_HASH_RESET_HANDLE_STATUS(__HANDLE__) ((__HANDLE__)->Status = HAL_OK)
344 * @brief Enable the multi-buffer DMA transfer mode.
345 * @note This bit is set when hashing large files when multiple DMA transfers are needed.
346 * @retval None
348 #define __HAL_HASH_SET_MDMAT() SET_BIT(HASH->CR, HASH_CR_MDMAT)
351 * @brief Disable the multi-buffer DMA transfer mode.
352 * @retval None
354 #define __HAL_HASH_RESET_MDMAT() CLEAR_BIT(HASH->CR, HASH_CR_MDMAT)
358 * @brief Start the digest computation.
359 * @retval None
361 #define __HAL_HASH_START_DIGEST() SET_BIT(HASH->STR, HASH_STR_DCAL)
364 * @brief Set the number of valid bits in the last word written in data register DIN.
365 * @param __SIZE__: size in bytes of last data written in Data register.
366 * @retval None
368 #define __HAL_HASH_SET_NBVALIDBITS(__SIZE__) MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8U * ((__SIZE__) % 4U))
371 * @brief Reset the HASH core.
372 * @retval None
374 #define __HAL_HASH_INIT() SET_BIT(HASH->CR, HASH_CR_INIT)
377 * @}
381 /* Private macros --------------------------------------------------------*/
382 /** @defgroup HASH_Private_Macros HASH Private Macros
383 * @{
386 * @brief Return digest length in bytes.
387 * @retval Digest length
389 #define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20U : \
390 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA224) ? 28U : \
391 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA256) ? 32U : 16U ) ) )
393 * @brief Return number of words already pushed in the FIFO.
394 * @retval Number of words already pushed in the FIFO
396 #define HASH_NBW_PUSHED() ((READ_BIT(HASH->CR, HASH_CR_NBW)) >> 8U)
399 * @brief Ensure that HASH input data type is valid.
400 * @param __DATATYPE__: HASH input data type.
401 * @retval SET (__DATATYPE__ is valid) or RESET (__DATATYPE__ is invalid)
403 #define IS_HASH_DATATYPE(__DATATYPE__) (((__DATATYPE__) == HASH_DATATYPE_32B)|| \
404 ((__DATATYPE__) == HASH_DATATYPE_16B)|| \
405 ((__DATATYPE__) == HASH_DATATYPE_8B) || \
406 ((__DATATYPE__) == HASH_DATATYPE_1B))
411 * @brief Ensure that input data buffer size is valid for multi-buffer HASH
412 * processing in polling mode.
413 * @note This check is valid only for multi-buffer HASH processing in polling mode.
414 * @param __SIZE__: input data buffer size.
415 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
417 #define IS_HASH_POLLING_MULTIBUFFER_SIZE(__SIZE__) (((__SIZE__) % 4U) == 0U)
419 * @brief Ensure that input data buffer size is valid for multi-buffer HASH
420 * processing in DMA mode.
421 * @note This check is valid only for multi-buffer HASH processing in DMA mode.
422 * @param __SIZE__: input data buffer size.
423 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
425 #define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__) ((READ_BIT(HASH->CR, HASH_CR_MDMAT) == 0U) || (((__SIZE__) % 4U) == 0U))
428 * @brief Ensure that input data buffer size is valid for multi-buffer HMAC
429 * processing in DMA mode.
430 * @note This check is valid only for multi-buffer HMAC processing in DMA mode.
431 * @param __HANDLE__: HASH handle.
432 * @param __SIZE__: input data buffer size.
433 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
435 #define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__,__SIZE__) ((((__HANDLE__)->DigestCalculationDisable) == RESET) || (((__SIZE__) % 4U) == 0U))
437 * @brief Ensure that handle phase is set to HASH processing.
438 * @param __HANDLE__: HASH handle.
439 * @retval SET (handle phase is set to HASH processing) or RESET (handle phase is not set to HASH processing)
441 #define IS_HASH_PROCESSING(__HANDLE__) ((__HANDLE__)->Phase == HAL_HASH_PHASE_PROCESS)
444 * @brief Ensure that handle phase is set to HMAC processing.
445 * @param __HANDLE__: HASH handle.
446 * @retval SET (handle phase is set to HMAC processing) or RESET (handle phase is not set to HMAC processing)
448 #define IS_HMAC_PROCESSING(__HANDLE__) (((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_1) || \
449 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_2) || \
450 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_3))
453 * @}
456 /* Include HASH HAL Extended module */
457 #include "stm32f7xx_hal_hash_ex.h"
458 /* Exported functions --------------------------------------------------------*/
460 /** @addtogroup HASH_Exported_Functions HASH Exported Functions
461 * @{
464 /** @addtogroup HASH_Exported_Functions_Group1 Initialization and de-initialization functions
465 * @{
468 /* Initialization/de-initialization methods **********************************/
469 HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash);
470 HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash);
471 void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash);
472 void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash);
473 void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash);
474 void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash);
475 void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash);
476 /* Callbacks Register/UnRegister functions ***********************************/
477 #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
478 HAL_StatusTypeDef HAL_HASH_RegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID, pHASH_CallbackTypeDef pCallback);
479 HAL_StatusTypeDef HAL_HASH_UnRegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID);
480 #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
484 * @}
487 /** @addtogroup HASH_Exported_Functions_Group2 HASH processing functions in polling mode
488 * @{
492 /* HASH processing using polling *********************************************/
493 HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
494 HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
495 HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
496 HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
499 * @}
502 /** @addtogroup HASH_Exported_Functions_Group3 HASH processing functions in interrupt mode
503 * @{
506 /* HASH processing using IT **************************************************/
507 HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
508 HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
509 void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash);
511 * @}
514 /** @addtogroup HASH_Exported_Functions_Group4 HASH processing functions in DMA mode
515 * @{
518 /* HASH processing using DMA *************************************************/
519 HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
520 HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
521 HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
522 HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
525 * @}
528 /** @addtogroup HASH_Exported_Functions_Group5 HMAC processing functions in polling mode
529 * @{
532 /* HASH-MAC processing using polling *****************************************/
533 HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
534 HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
537 * @}
540 /** @addtogroup HASH_Exported_Functions_Group6 HMAC processing functions in interrupt mode
541 * @{
544 HAL_StatusTypeDef HAL_HMAC_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
545 HAL_StatusTypeDef HAL_HMAC_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
548 * @}
551 /** @addtogroup HASH_Exported_Functions_Group7 HMAC processing functions in DMA mode
552 * @{
555 /* HASH-HMAC processing using DMA ********************************************/
556 HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
557 HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
560 * @}
563 /** @addtogroup HASH_Exported_Functions_Group8 Peripheral states functions
564 * @{
568 /* Peripheral State methods **************************************************/
569 HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash);
570 HAL_StatusTypeDef HAL_HASH_GetStatus(HASH_HandleTypeDef *hhash);
571 void HAL_HASH_ContextSaving(HASH_HandleTypeDef *hhash, uint8_t* pMemBuffer);
572 void HAL_HASH_ContextRestoring(HASH_HandleTypeDef *hhash, uint8_t* pMemBuffer);
573 void HAL_HASH_SwFeed_ProcessSuspend(HASH_HandleTypeDef *hhash);
574 HAL_StatusTypeDef HAL_HASH_DMAFeed_ProcessSuspend(HASH_HandleTypeDef *hhash);
575 uint32_t HAL_HASH_GetError(HASH_HandleTypeDef *hhash);
578 * @}
582 * @}
585 /* Private functions -----------------------------------------------------------*/
587 /** @addtogroup HASH_Private_Functions HASH Private Functions
588 * @{
591 /* Private functions */
592 HAL_StatusTypeDef HASH_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout, uint32_t Algorithm);
593 HAL_StatusTypeDef HASH_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
594 HAL_StatusTypeDef HASH_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Algorithm);
595 HAL_StatusTypeDef HASH_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
596 HAL_StatusTypeDef HASH_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
597 HAL_StatusTypeDef HMAC_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout, uint32_t Algorithm);
598 HAL_StatusTypeDef HMAC_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Algorithm);
599 HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
602 * @}
606 * @}
608 #endif /* HASH*/
610 * @}
614 #ifdef __cplusplus
616 #endif
619 #endif /* STM32F7xx_HAL_HASH_H */
621 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/