source: S-port/trunk/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_hash.h

Last change on this file was 1, checked in by AlexLir, 3 years ago
File size: 26.1 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32f4xx_hal_hash.h
4 * @author MCD Application Team
5 * @brief Header file of HASH HAL module.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
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
16 *
17 ******************************************************************************
18 */
19
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef STM32F4xx_HAL_HASH_H
22#define STM32F4xx_HAL_HASH_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#include "stm32f4xx_hal_def.h"
30
31/** @addtogroup STM32F4xx_HAL_Driver
32 * @{
33 */
34#if defined (HASH)
35/** @addtogroup HASH
36 * @{
37 */
38
39/* Exported types ------------------------------------------------------------*/
40/** @defgroup HASH_Exported_Types HASH Exported Types
41 * @{
42 */
43
44/**
45 * @brief HASH Configuration Structure definition
46 */
47typedef struct
48{
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. */
51
52 uint32_t KeySize; /*!< The key size is used only in HMAC operation. */
53
54 uint8_t *pKey; /*!< The key is used only in HMAC operation. */
55
56} HASH_InitTypeDef;
57
58/**
59 * @brief HAL State structures definition
60 */
61typedef enum
62{
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;
70
71/**
72 * @brief HAL phase structures definition
73 */
74typedef enum
75{
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;
85
86/**
87 * @brief HAL HASH mode suspend definitions
88 */
89typedef enum
90{
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;
94
95#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
96/**
97 * @brief HAL HASH common Callback ID enumeration definition
98 */
99typedef enum
100{
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 */
108
109
110/**
111 * @brief HASH Handle Structure definition
112 */
113#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
114typedef struct __HASH_HandleTypeDef
115#else
116typedef struct
117#endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */
118{
119 HASH_InitTypeDef Init; /*!< HASH required parameters */
120
121 uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */
122
123 uint8_t *pHashOutBuffPtr; /*!< Pointer to output buffer (digest) */
124
125 uint8_t *pHashKeyBuffPtr; /*!< Pointer to key buffer (HMAC only) */
126
127 uint8_t *pHashMsgBuffPtr; /*!< Pointer to message buffer (HMAC only) */
128
129 uint32_t HashBuffSize; /*!< Size of buffer to be processed */
130
131 __IO uint32_t HashInCount; /*!< Counter of inputted data */
132
133 __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */
134
135 __IO uint32_t HashKeyCount; /*!< Counter for Key inputted data (HMAC only) */
136
137 HAL_StatusTypeDef Status; /*!< HASH peripheral status */
138
139 HAL_HASH_PhaseTypeDef Phase; /*!< HASH peripheral phase */
140
141 DMA_HandleTypeDef *hdmain; /*!< HASH In DMA Handle parameters */
142
143 HAL_LockTypeDef Lock; /*!< Locking object */
144
145 __IO HAL_HASH_StateTypeDef State; /*!< HASH peripheral state */
146
147 HAL_HASH_SuspendTypeDef SuspendRequest; /*!< HASH peripheral suspension request flag */
148
149 FlagStatus DigestCalculationDisable; /*!< Digest calculation phase skip (MDMAT bit control) for multi-buffers DMA-based HMAC computation */
150
151 __IO uint32_t NbWordsAlreadyPushed; /*!< Numbers of words already pushed in FIFO before inputting new block */
152
153 __IO uint32_t ErrorCode; /*!< HASH Error code */
154
155 __IO uint32_t Accumulation; /*!< HASH multi buffers accumulation flag */
156
157#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
158 void (* InCpltCallback)(struct __HASH_HandleTypeDef *hhash); /*!< HASH input completion callback */
159
160 void (* DgstCpltCallback)(struct __HASH_HandleTypeDef *hhash); /*!< HASH digest computation completion callback */
161
162 void (* ErrorCallback)(struct __HASH_HandleTypeDef *hhash); /*!< HASH error callback */
163
164 void (* MspInitCallback)(struct __HASH_HandleTypeDef *hhash); /*!< HASH Msp Init callback */
165
166 void (* MspDeInitCallback)(struct __HASH_HandleTypeDef *hhash); /*!< HASH Msp DeInit callback */
167
168#endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */
169} HASH_HandleTypeDef;
170
171#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
172/**
173 * @brief HAL HASH Callback pointer definition
174 */
175typedef void (*pHASH_CallbackTypeDef)(HASH_HandleTypeDef *hhash); /*!< pointer to a HASH common callback functions */
176#endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
177
178/**
179 * @}
180 */
181
182/* Exported constants --------------------------------------------------------*/
183
184/** @defgroup HASH_Exported_Constants HASH Exported Constants
185 * @{
186 */
187
188/** @defgroup HASH_Algo_Selection HASH algorithm selection
189 * @{
190 */
191#define HASH_ALGOSELECTION_SHA1 0x00000000U /*!< HASH function is SHA1 */
192#define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */
193#define HASH_ALGOSELECTION_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */
194#define HASH_ALGOSELECTION_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */
195/**
196 * @}
197 */
198
199/** @defgroup HASH_Algorithm_Mode HASH algorithm mode
200 * @{
201 */
202#define HASH_ALGOMODE_HASH 0x00000000U /*!< Algorithm is HASH */
203#define HASH_ALGOMODE_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */
204/**
205 * @}
206 */
207
208/** @defgroup HASH_Data_Type HASH input data type
209 * @{
210 */
211#define HASH_DATATYPE_32B 0x00000000U /*!< 32-bit data. No swapping */
212#define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */
213#define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */
214#define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */
215/**
216 * @}
217 */
218
219/** @defgroup HASH_HMAC_Long_key_only_for_HMAC_mode HMAC key length type
220 * @{
221 */
222#define HASH_HMAC_KEYTYPE_SHORTKEY 0x00000000U /*!< HMAC Key size is <= 64 bytes */
223#define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY /*!< HMAC Key size is > 64 bytes */
224/**
225 * @}
226 */
227
228/** @defgroup HASH_flags_definition HASH flags definitions
229 * @{
230 */
231#define HASH_FLAG_DINIS HASH_SR_DINIS /*!< 16 locations are free in the DIN : a new block can be entered in the Peripheral */
232#define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */
233#define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */
234#define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy, processing a block of data */
235#define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : the input buffer contains at least one word of data */
236
237/**
238 * @}
239 */
240
241/** @defgroup HASH_interrupts_definition HASH interrupts definitions
242 * @{
243 */
244#define HASH_IT_DINI HASH_IMR_DINIE /*!< A new block can be entered into the input buffer (DIN) */
245#define HASH_IT_DCI HASH_IMR_DCIE /*!< Digest calculation complete */
246
247/**
248 * @}
249 */
250/** @defgroup HASH_alias HASH API alias
251 * @{
252 */
253#define HAL_HASHEx_IRQHandler HAL_HASH_IRQHandler /*!< Redirection for compatibility with legacy code */
254/**
255 * @}
256 */
257
258/** @defgroup HASH_Error_Definition HASH Error Definition
259 * @{
260 */
261#define HAL_HASH_ERROR_NONE 0x00000000U /*!< No error */
262#define HAL_HASH_ERROR_IT 0x00000001U /*!< IT-based process error */
263#define HAL_HASH_ERROR_DMA 0x00000002U /*!< DMA-based process error */
264#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U)
265#define HAL_HASH_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid Callback error */
266#endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
267/**
268 * @}
269 */
270
271/**
272 * @}
273 */
274
275/* Exported macros -----------------------------------------------------------*/
276/** @defgroup HASH_Exported_Macros HASH Exported Macros
277 * @{
278 */
279
280/** @brief Check whether or not the specified HASH flag is set.
281 * @param __FLAG__ specifies the flag to check.
282 * This parameter can be one of the following values:
283 * @arg @ref HASH_FLAG_DINIS A new block can be entered into the input buffer.
284 * @arg @ref HASH_FLAG_DCIS Digest calculation complete.
285 * @arg @ref HASH_FLAG_DMAS DMA interface is enabled (DMAE=1) or a transfer is ongoing.
286 * @arg @ref HASH_FLAG_BUSY The hash core is Busy : processing a block of data.
287 * @arg @ref HASH_FLAG_DINNE DIN not empty : the input buffer contains at least one word of data.
288 * @retval The new state of __FLAG__ (TRUE or FALSE).
289 */
290#define __HAL_HASH_GET_FLAG(__FLAG__) (((__FLAG__) > 8U) ? \
291 ((HASH->CR & (__FLAG__)) == (__FLAG__)) :\
292 ((HASH->SR & (__FLAG__)) == (__FLAG__)) )
293
294
295/** @brief Clear the specified HASH flag.
296 * @param __FLAG__ specifies the flag to clear.
297 * This parameter can be one of the following values:
298 * @arg @ref HASH_FLAG_DINIS A new block can be entered into the input buffer.
299 * @arg @ref HASH_FLAG_DCIS Digest calculation complete
300 * @retval None
301 */
302#define __HAL_HASH_CLEAR_FLAG(__FLAG__) CLEAR_BIT(HASH->SR, (__FLAG__))
303
304
305/** @brief Enable the specified HASH interrupt.
306 * @param __INTERRUPT__ specifies the HASH interrupt source to enable.
307 * This parameter can be one of the following values:
308 * @arg @ref HASH_IT_DINI A new block can be entered into the input buffer (DIN)
309 * @arg @ref HASH_IT_DCI Digest calculation complete
310 * @retval None
311 */
312#define __HAL_HASH_ENABLE_IT(__INTERRUPT__) SET_BIT(HASH->IMR, (__INTERRUPT__))
313
314/** @brief Disable the specified HASH interrupt.
315 * @param __INTERRUPT__ specifies the HASH interrupt source to disable.
316 * This parameter can be one of the following values:
317 * @arg @ref HASH_IT_DINI A new block can be entered into the input buffer (DIN)
318 * @arg @ref HASH_IT_DCI Digest calculation complete
319 * @retval None
320 */
321#define __HAL_HASH_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(HASH->IMR, (__INTERRUPT__))
322
323/** @brief Reset HASH handle state.
324 * @param __HANDLE__ HASH handle.
325 * @retval None
326 */
327
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; \
333 }while(0)
334#else
335#define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET)
336#endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
337
338
339/** @brief Reset HASH handle status.
340 * @param __HANDLE__ HASH handle.
341 * @retval None
342 */
343#define __HAL_HASH_RESET_HANDLE_STATUS(__HANDLE__) ((__HANDLE__)->Status = HAL_OK)
344
345/**
346 * @brief Enable the multi-buffer DMA transfer mode.
347 * @note This bit is set when hashing large files when multiple DMA transfers are needed.
348 * @retval None
349 */
350#define __HAL_HASH_SET_MDMAT() SET_BIT(HASH->CR, HASH_CR_MDMAT)
351
352/**
353 * @brief Disable the multi-buffer DMA transfer mode.
354 * @retval None
355 */
356#define __HAL_HASH_RESET_MDMAT() CLEAR_BIT(HASH->CR, HASH_CR_MDMAT)
357
358
359/**
360 * @brief Start the digest computation.
361 * @retval None
362 */
363#define __HAL_HASH_START_DIGEST() SET_BIT(HASH->STR, HASH_STR_DCAL)
364
365/**
366 * @brief Set the number of valid bits in the last word written in data register DIN.
367 * @param __SIZE__ size in bytes of last data written in Data register.
368 * @retval None
369 */
370#define __HAL_HASH_SET_NBVALIDBITS(__SIZE__) MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8U * ((__SIZE__) % 4U))
371
372/**
373 * @brief Reset the HASH core.
374 * @retval None
375 */
376#define __HAL_HASH_INIT() SET_BIT(HASH->CR, HASH_CR_INIT)
377
378/**
379 * @}
380 */
381
382
383/* Private macros --------------------------------------------------------*/
384/** @defgroup HASH_Private_Macros HASH Private Macros
385 * @{
386 */
387/**
388 * @brief Return digest length in bytes.
389 * @retval Digest length
390 */
391#if defined(HASH_CR_MDMAT)
392#define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20U : \
393 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA224) ? 28U : \
394 ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA256) ? 32U : 16U ) ) )
395#else
396#define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20U : 16)
397#endif /* HASH_CR_MDMAT*/
398/**
399 * @brief Return number of words already pushed in the FIFO.
400 * @retval Number of words already pushed in the FIFO
401 */
402#define HASH_NBW_PUSHED() ((READ_BIT(HASH->CR, HASH_CR_NBW)) >> 8U)
403
404/**
405 * @brief Ensure that HASH input data type is valid.
406 * @param __DATATYPE__ HASH input data type.
407 * @retval SET (__DATATYPE__ is valid) or RESET (__DATATYPE__ is invalid)
408 */
409#define IS_HASH_DATATYPE(__DATATYPE__) (((__DATATYPE__) == HASH_DATATYPE_32B)|| \
410 ((__DATATYPE__) == HASH_DATATYPE_16B)|| \
411 ((__DATATYPE__) == HASH_DATATYPE_8B) || \
412 ((__DATATYPE__) == HASH_DATATYPE_1B))
413
414/**
415 * @brief Ensure that input data buffer size is valid for multi-buffer HASH
416 * processing in DMA mode.
417 * @note This check is valid only for multi-buffer HASH processing in DMA mode.
418 * @param __SIZE__ input data buffer size.
419 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
420 */
421#define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__) ((READ_BIT(HASH->CR, HASH_CR_MDMAT) == 0U) || (((__SIZE__) % 4U) == 0U))
422
423/**
424 * @brief Ensure that input data buffer size is valid for multi-buffer HMAC
425 * processing in DMA mode.
426 * @note This check is valid only for multi-buffer HMAC processing in DMA mode.
427 * @param __HANDLE__ HASH handle.
428 * @param __SIZE__ input data buffer size.
429 * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid)
430 */
431#define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__,__SIZE__) ((((__HANDLE__)->DigestCalculationDisable) == RESET)\
432 || (((__SIZE__) % 4U) == 0U))
433/**
434 * @brief Ensure that handle phase is set to HASH processing.
435 * @param __HANDLE__ HASH handle.
436 * @retval SET (handle phase is set to HASH processing) or RESET (handle phase is not set to HASH processing)
437 */
438#define IS_HASH_PROCESSING(__HANDLE__) ((__HANDLE__)->Phase == HAL_HASH_PHASE_PROCESS)
439
440/**
441 * @brief Ensure that handle phase is set to HMAC processing.
442 * @param __HANDLE__ HASH handle.
443 * @retval SET (handle phase is set to HMAC processing) or RESET (handle phase is not set to HMAC processing)
444 */
445#define IS_HMAC_PROCESSING(__HANDLE__) (((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_1) || \
446 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_2) || \
447 ((__HANDLE__)->Phase == HAL_HASH_PHASE_HMAC_STEP_3))
448
449/**
450 * @}
451 */
452
453/* Include HASH HAL Extended module */
454#include "stm32f4xx_hal_hash_ex.h"
455/* Exported functions --------------------------------------------------------*/
456
457/** @addtogroup HASH_Exported_Functions HASH Exported Functions
458 * @{
459 */
460
461/** @addtogroup HASH_Exported_Functions_Group1 Initialization and de-initialization functions
462 * @{
463 */
464
465/* Initialization/de-initialization methods **********************************/
466HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash);
467HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash);
468void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash);
469void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash);
470void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash);
471void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash);
472void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash);
473/* Callbacks Register/UnRegister functions ***********************************/
474#if (USE_HAL_HASH_REGISTER_CALLBACKS == 1)
475HAL_StatusTypeDef HAL_HASH_RegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID,
476 pHASH_CallbackTypeDef pCallback);
477HAL_StatusTypeDef HAL_HASH_UnRegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID);
478#endif /* USE_HAL_HASH_REGISTER_CALLBACKS */
479
480
481/**
482 * @}
483 */
484
485/** @addtogroup HASH_Exported_Functions_Group2 HASH processing functions in polling mode
486 * @{
487 */
488
489
490/* HASH processing using polling *********************************************/
491HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
492 uint32_t Timeout);
493HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
494 uint32_t Timeout);
495HAL_StatusTypeDef HAL_HASH_MD5_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
496HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
497HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
498 uint8_t *pOutBuffer, uint32_t Timeout);
499HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
500 uint8_t *pOutBuffer, uint32_t Timeout);
501
502
503/**
504 * @}
505 */
506
507/** @addtogroup HASH_Exported_Functions_Group3 HASH processing functions in interrupt mode
508 * @{
509 */
510
511/* HASH processing using IT **************************************************/
512HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
513 uint8_t *pOutBuffer);
514HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
515HAL_StatusTypeDef HAL_HASH_SHA1_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
516 uint8_t *pOutBuffer);
517HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
518 uint8_t *pOutBuffer);
519HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
520HAL_StatusTypeDef HAL_HASH_MD5_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
521 uint8_t *pOutBuffer);
522void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash);
523/**
524 * @}
525 */
526
527/** @addtogroup HASH_Exported_Functions_Group4 HASH processing functions in DMA mode
528 * @{
529 */
530
531/* HASH processing using DMA *************************************************/
532HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
533HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout);
534HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
535HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout);
536
537/**
538 * @}
539 */
540
541/** @addtogroup HASH_Exported_Functions_Group5 HMAC processing functions in polling mode
542 * @{
543 */
544
545/* HASH-MAC processing using polling *****************************************/
546HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
547 uint32_t Timeout);
548HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
549 uint32_t Timeout);
550
551/**
552 * @}
553 */
554
555/** @addtogroup HASH_Exported_Functions_Group6 HMAC processing functions in interrupt mode
556 * @{
557 */
558
559HAL_StatusTypeDef HAL_HMAC_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
560 uint8_t *pOutBuffer);
561HAL_StatusTypeDef HAL_HMAC_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size,
562 uint8_t *pOutBuffer);
563
564/**
565 * @}
566 */
567
568/** @addtogroup HASH_Exported_Functions_Group7 HMAC processing functions in DMA mode
569 * @{
570 */
571
572/* HASH-HMAC processing using DMA ********************************************/
573HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
574HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
575
576/**
577 * @}
578 */
579
580/** @addtogroup HASH_Exported_Functions_Group8 Peripheral states functions
581 * @{
582 */
583
584
585/* Peripheral State methods **************************************************/
586HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash);
587HAL_StatusTypeDef HAL_HASH_GetStatus(HASH_HandleTypeDef *hhash);
588void HAL_HASH_ContextSaving(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer);
589void HAL_HASH_ContextRestoring(HASH_HandleTypeDef *hhash, uint8_t *pMemBuffer);
590void HAL_HASH_SwFeed_ProcessSuspend(HASH_HandleTypeDef *hhash);
591HAL_StatusTypeDef HAL_HASH_DMAFeed_ProcessSuspend(HASH_HandleTypeDef *hhash);
592uint32_t HAL_HASH_GetError(HASH_HandleTypeDef *hhash);
593
594/**
595 * @}
596 */
597
598/**
599 * @}
600 */
601
602/* Private functions -----------------------------------------------------------*/
603
604/** @addtogroup HASH_Private_Functions HASH Private Functions
605 * @{
606 */
607
608/* Private functions */
609HAL_StatusTypeDef HASH_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
610 uint32_t Timeout, uint32_t Algorithm);
611HAL_StatusTypeDef HASH_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
612HAL_StatusTypeDef HASH_Accumulate_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
613HAL_StatusTypeDef HASH_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
614 uint32_t Algorithm);
615HAL_StatusTypeDef HASH_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
616HAL_StatusTypeDef HASH_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout);
617HAL_StatusTypeDef HMAC_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
618 uint32_t Timeout, uint32_t Algorithm);
619HAL_StatusTypeDef HMAC_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t *pOutBuffer,
620 uint32_t Algorithm);
621HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint32_t Algorithm);
622
623/**
624 * @}
625 */
626
627/**
628 * @}
629 */
630#endif /* HASH*/
631/**
632 * @}
633 */
634
635
636#ifdef __cplusplus
637}
638#endif
639
640
641#endif /* STM32F4xx_HAL_HASH_H */
642
643/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.