[303] | 1 | /**
|
---|
| 2 | ******************************************************************************
|
---|
| 3 | * @file stm32f4xx_hal_hash.h
|
---|
| 4 | * @author MCD Application Team
|
---|
| 5 | * @version V1.4.1
|
---|
| 6 | * @date 09-October-2015
|
---|
| 7 | * @brief Header file of HASH HAL module.
|
---|
| 8 | ******************************************************************************
|
---|
| 9 | * @attention
|
---|
| 10 | *
|
---|
| 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
---|
| 12 | *
|
---|
| 13 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 14 | * are permitted provided that the following conditions are met:
|
---|
| 15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 16 | * this list of conditions and the following disclaimer.
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 18 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 19 | * and/or other materials provided with the distribution.
|
---|
| 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
---|
| 21 | * may be used to endorse or promote products derived from this software
|
---|
| 22 | * without specific prior written permission.
|
---|
| 23 | *
|
---|
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
---|
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
---|
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
---|
| 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
| 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
| 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 34 | *
|
---|
| 35 | ******************************************************************************
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | /* Define to prevent recursive inclusion -------------------------------------*/
|
---|
| 39 | #ifndef __STM32F4xx_HAL_HASH_H
|
---|
| 40 | #define __STM32F4xx_HAL_HASH_H
|
---|
| 41 |
|
---|
| 42 | #ifdef __cplusplus
|
---|
| 43 | extern "C" {
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 | #if defined(STM32F415xx) || defined(STM32F417xx) || defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx)
|
---|
| 47 |
|
---|
| 48 | /* Includes ------------------------------------------------------------------*/
|
---|
| 49 | #include "stm32f4xx_hal_def.h"
|
---|
| 50 |
|
---|
| 51 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
| 52 | * @{
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /** @addtogroup HASH
|
---|
| 56 | * @brief HASH HAL module driver
|
---|
| 57 | * @{
|
---|
| 58 | */
|
---|
| 59 |
|
---|
| 60 | /* Exported types ------------------------------------------------------------*/
|
---|
| 61 | /** @defgroup HASH_Exported_Types HASH Exported Types
|
---|
| 62 | * @{
|
---|
| 63 | */
|
---|
| 64 |
|
---|
| 65 | /** @defgroup HASH_Exported_Types_Group1 HASH Configuration Structure definition
|
---|
| 66 | * @{
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | typedef struct
|
---|
| 70 | {
|
---|
| 71 | uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
|
---|
| 72 | This parameter can be a value of @ref HASH DataType */
|
---|
| 73 |
|
---|
| 74 | uint32_t KeySize; /*!< The key size is used only in HMAC operation */
|
---|
| 75 |
|
---|
| 76 | uint8_t* pKey; /*!< The key is used only in HMAC operation */
|
---|
| 77 | }HASH_InitTypeDef;
|
---|
| 78 |
|
---|
| 79 | /**
|
---|
| 80 | * @}
|
---|
| 81 | */
|
---|
| 82 |
|
---|
| 83 | /** @defgroup HASH_Exported_Types_Group2 HASH State structures definition
|
---|
| 84 | * @{
|
---|
| 85 | */
|
---|
| 86 |
|
---|
| 87 | typedef enum
|
---|
| 88 | {
|
---|
| 89 | HAL_HASH_STATE_RESET = 0x00, /*!< HASH not yet initialized or disabled */
|
---|
| 90 | HAL_HASH_STATE_READY = 0x01, /*!< HASH initialized and ready for use */
|
---|
| 91 | HAL_HASH_STATE_BUSY = 0x02, /*!< HASH internal process is ongoing */
|
---|
| 92 | HAL_HASH_STATE_TIMEOUT = 0x03, /*!< HASH timeout state */
|
---|
| 93 | HAL_HASH_STATE_ERROR = 0x04 /*!< HASH error state */
|
---|
| 94 | }HAL_HASH_STATETypeDef;
|
---|
| 95 |
|
---|
| 96 | /**
|
---|
| 97 | * @}
|
---|
| 98 | */
|
---|
| 99 |
|
---|
| 100 | /** @defgroup HASH_Exported_Types_Group3 HASH phase structures definition
|
---|
| 101 | * @{
|
---|
| 102 | */
|
---|
| 103 |
|
---|
| 104 | typedef enum
|
---|
| 105 | {
|
---|
| 106 | HAL_HASH_PHASE_READY = 0x01, /*!< HASH peripheral is ready for initialization */
|
---|
| 107 | HAL_HASH_PHASE_PROCESS = 0x02, /*!< HASH peripheral is in processing phase */
|
---|
| 108 | }HAL_HASHPhaseTypeDef;
|
---|
| 109 |
|
---|
| 110 | /**
|
---|
| 111 | * @}
|
---|
| 112 | */
|
---|
| 113 |
|
---|
| 114 | /** @defgroup HASH_Exported_Types_Group4 HASH Handle structures definition
|
---|
| 115 | * @{
|
---|
| 116 | */
|
---|
| 117 |
|
---|
| 118 | typedef struct
|
---|
| 119 | {
|
---|
| 120 | HASH_InitTypeDef Init; /*!< HASH required parameters */
|
---|
| 121 |
|
---|
| 122 | uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */
|
---|
| 123 |
|
---|
| 124 | uint8_t *pHashOutBuffPtr; /*!< Pointer to input buffer */
|
---|
| 125 |
|
---|
| 126 | __IO uint32_t HashBuffSize; /*!< Size of buffer to be processed */
|
---|
| 127 |
|
---|
| 128 | __IO uint32_t HashInCount; /*!< Counter of inputed data */
|
---|
| 129 |
|
---|
| 130 | __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */
|
---|
| 131 |
|
---|
| 132 | HAL_StatusTypeDef Status; /*!< HASH peripheral status */
|
---|
| 133 |
|
---|
| 134 | HAL_HASHPhaseTypeDef Phase; /*!< HASH peripheral phase */
|
---|
| 135 |
|
---|
| 136 | DMA_HandleTypeDef *hdmain; /*!< HASH In DMA handle parameters */
|
---|
| 137 |
|
---|
| 138 | HAL_LockTypeDef Lock; /*!< HASH locking object */
|
---|
| 139 |
|
---|
| 140 | __IO HAL_HASH_STATETypeDef State; /*!< HASH peripheral state */
|
---|
| 141 | } HASH_HandleTypeDef;
|
---|
| 142 |
|
---|
| 143 | /**
|
---|
| 144 | * @}
|
---|
| 145 | */
|
---|
| 146 |
|
---|
| 147 |
|
---|
| 148 | /**
|
---|
| 149 | * @}
|
---|
| 150 | */
|
---|
| 151 |
|
---|
| 152 | /* Exported constants --------------------------------------------------------*/
|
---|
| 153 | /** @defgroup HASH_Exported_Constants HASH Exported Constants
|
---|
| 154 | * @{
|
---|
| 155 | */
|
---|
| 156 |
|
---|
| 157 | /** @defgroup HASH_Exported_Constants_Group1 HASH Algorithm Selection
|
---|
| 158 | * @{
|
---|
| 159 | */
|
---|
| 160 | #define HASH_ALGOSELECTION_SHA1 ((uint32_t)0x0000) /*!< HASH function is SHA1 */
|
---|
| 161 | #define HASH_ALGOSELECTION_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */
|
---|
| 162 | #define HASH_ALGOSELECTION_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */
|
---|
| 163 | #define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */
|
---|
| 164 | /**
|
---|
| 165 | * @}
|
---|
| 166 | */
|
---|
| 167 |
|
---|
| 168 | /** @defgroup HASH_Exported_Constants_Group2 HASH Algorithm Mode
|
---|
| 169 | * @{
|
---|
| 170 | */
|
---|
| 171 | #define HASH_ALGOMODE_HASH ((uint32_t)0x00000000) /*!< Algorithm is HASH */
|
---|
| 172 | #define HASH_ALGOMODE_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */
|
---|
| 173 | /**
|
---|
| 174 | * @}
|
---|
| 175 | */
|
---|
| 176 |
|
---|
| 177 | /** @defgroup HASH_Exported_Constants_Group3 HASH DataType
|
---|
| 178 | * @{
|
---|
| 179 | */
|
---|
| 180 | #define HASH_DATATYPE_32B ((uint32_t)0x0000) /*!< 32-bit data. No swapping */
|
---|
| 181 | #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */
|
---|
| 182 | #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */
|
---|
| 183 | #define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */
|
---|
| 184 | /**
|
---|
| 185 | * @}
|
---|
| 186 | */
|
---|
| 187 |
|
---|
| 188 | /** @defgroup HASH_Exported_Constants_Group4 HASH HMAC Long key
|
---|
| 189 | * @brief HASH HMAC Long key used only for HMAC mode
|
---|
| 190 | * @{
|
---|
| 191 | */
|
---|
| 192 | #define HASH_HMAC_KEYTYPE_SHORTKEY ((uint32_t)0x00000000) /*!< HMAC Key is <= 64 bytes */
|
---|
| 193 | #define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY /*!< HMAC Key is > 64 bytes */
|
---|
| 194 | /**
|
---|
| 195 | * @}
|
---|
| 196 | */
|
---|
| 197 |
|
---|
| 198 | /** @defgroup HASH_Exported_Constants_Group5 HASH Flags definition
|
---|
| 199 | * @{
|
---|
| 200 | */
|
---|
| 201 | #define HASH_FLAG_DINIS HASH_SR_DINIS /*!< 16 locations are free in the DIN : A new block can be entered into the input buffer */
|
---|
| 202 | #define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */
|
---|
| 203 | #define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */
|
---|
| 204 | #define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy : processing a block of data */
|
---|
| 205 | #define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : The input buffer contains at least one word of data */
|
---|
| 206 | /**
|
---|
| 207 | * @}
|
---|
| 208 | */
|
---|
| 209 |
|
---|
| 210 | /** @defgroup HASH_Exported_Constants_Group6 HASH Interrupts definition
|
---|
| 211 | * @{
|
---|
| 212 | */
|
---|
| 213 | #define HASH_IT_DINI HASH_IMR_DINIE /*!< A new block can be entered into the input buffer (DIN) */
|
---|
| 214 | #define HASH_IT_DCI HASH_IMR_DCIE /*!< Digest calculation complete */
|
---|
| 215 | /**
|
---|
| 216 | * @}
|
---|
| 217 | */
|
---|
| 218 |
|
---|
| 219 | /**
|
---|
| 220 | * @}
|
---|
| 221 | */
|
---|
| 222 |
|
---|
| 223 | /* Exported macro ------------------------------------------------------------*/
|
---|
| 224 | /** @defgroup HASH_Exported_Macros HASH Exported Macros
|
---|
| 225 | * @{
|
---|
| 226 | */
|
---|
| 227 |
|
---|
| 228 | /** @brief Reset HASH handle state
|
---|
| 229 | * @param __HANDLE__: specifies the HASH handle.
|
---|
| 230 | * @retval None
|
---|
| 231 | */
|
---|
| 232 | #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET)
|
---|
| 233 |
|
---|
| 234 | /** @brief Check whether the specified HASH flag is set or not.
|
---|
| 235 | * @param __FLAG__: specifies the flag to check.
|
---|
| 236 | * This parameter can be one of the following values:
|
---|
| 237 | * @arg HASH_FLAG_DINIS: A new block can be entered into the input buffer.
|
---|
| 238 | * @arg HASH_FLAG_DCIS: Digest calculation complete
|
---|
| 239 | * @arg HASH_FLAG_DMAS: DMA interface is enabled (DMAE=1) or a transfer is ongoing
|
---|
| 240 | * @arg HASH_FLAG_BUSY: The hash core is Busy : processing a block of data
|
---|
| 241 | * @arg HASH_FLAG_DINNE: DIN not empty : The input buffer contains at least one word of data
|
---|
| 242 | * @retval The new state of __FLAG__ (TRUE or FALSE).
|
---|
| 243 | */
|
---|
| 244 | #define __HAL_HASH_GET_FLAG(__FLAG__) (((__FLAG__) > 8U) ? ((HASH->CR & (__FLAG__)) == (__FLAG__)) :\
|
---|
| 245 | ((HASH->SR & (__FLAG__)) == (__FLAG__)))
|
---|
| 246 |
|
---|
| 247 | /**
|
---|
| 248 | * @brief Enable the multiple DMA mode.
|
---|
| 249 | * This feature is available only in STM32F429x and STM32F439x devices.
|
---|
| 250 | * @retval None
|
---|
| 251 | */
|
---|
| 252 | #define __HAL_HASH_SET_MDMAT() HASH->CR |= HASH_CR_MDMAT
|
---|
| 253 |
|
---|
| 254 | /**
|
---|
| 255 | * @brief Disable the multiple DMA mode.
|
---|
| 256 | * @retval None
|
---|
| 257 | */
|
---|
| 258 | #define __HAL_HASH_RESET_MDMAT() HASH->CR &= (uint32_t)(~HASH_CR_MDMAT)
|
---|
| 259 |
|
---|
| 260 | /**
|
---|
| 261 | * @brief Start the digest computation
|
---|
| 262 | * @retval None
|
---|
| 263 | */
|
---|
| 264 | #define __HAL_HASH_START_DIGEST() HASH->STR |= HASH_STR_DCAL
|
---|
| 265 |
|
---|
| 266 | /**
|
---|
| 267 | * @brief Set the number of valid bits in last word written in Data register
|
---|
| 268 | * @param SIZE: size in byte of last data written in Data register.
|
---|
| 269 | * @retval None
|
---|
| 270 | */
|
---|
| 271 | #define __HAL_HASH_SET_NBVALIDBITS(SIZE) do{HASH->STR &= ~(HASH_STR_NBLW);\
|
---|
| 272 | HASH->STR |= 8 * ((SIZE) % 4);\
|
---|
| 273 | }while(0)
|
---|
| 274 |
|
---|
| 275 | /**
|
---|
| 276 | * @}
|
---|
| 277 | */
|
---|
| 278 |
|
---|
| 279 | /* Include HASH HAL Extension module */
|
---|
| 280 | #include "stm32f4xx_hal_hash_ex.h"
|
---|
| 281 | /* Exported functions --------------------------------------------------------*/
|
---|
| 282 |
|
---|
| 283 | /** @defgroup HASH_Exported_Functions HASH Exported Functions
|
---|
| 284 | * @{
|
---|
| 285 | */
|
---|
| 286 |
|
---|
| 287 | /** @addtogroup HASH_Exported_Functions_Group1
|
---|
| 288 | * @{
|
---|
| 289 | */
|
---|
| 290 | HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash);
|
---|
| 291 | HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash);
|
---|
| 292 | /**
|
---|
| 293 | * @}
|
---|
| 294 | */
|
---|
| 295 |
|
---|
| 296 | /** @addtogroup HASH_Exported_Functions_Group2
|
---|
| 297 | * @{
|
---|
| 298 | */
|
---|
| 299 | HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 300 | HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 301 | HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 302 | HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 303 | /**
|
---|
| 304 | * @}
|
---|
| 305 | */
|
---|
| 306 |
|
---|
| 307 | /** @addtogroup HASH_Exported_Functions_Group3
|
---|
| 308 | * @{
|
---|
| 309 | */
|
---|
| 310 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 311 | HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 312 | /**
|
---|
| 313 | * @}
|
---|
| 314 | */
|
---|
| 315 |
|
---|
| 316 | /** @addtogroup HASH_Exported_Functions_Group4
|
---|
| 317 | * @{
|
---|
| 318 | */
|
---|
| 319 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
|
---|
| 320 | HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer);
|
---|
| 321 | /**
|
---|
| 322 | * @}
|
---|
| 323 | */
|
---|
| 324 |
|
---|
| 325 | /** @addtogroup HASH_Exported_Functions_Group5
|
---|
| 326 | * @{
|
---|
| 327 | */
|
---|
| 328 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 329 | HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 330 | HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 331 | HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout);
|
---|
| 332 | /**
|
---|
| 333 | * @}
|
---|
| 334 | */
|
---|
| 335 |
|
---|
| 336 | /** @addtogroup HASH_Exported_Functions_Group6
|
---|
| 337 | * @{
|
---|
| 338 | */
|
---|
| 339 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 340 | HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size);
|
---|
| 341 | /**
|
---|
| 342 | * @}
|
---|
| 343 | */
|
---|
| 344 |
|
---|
| 345 | /** @addtogroup HASH_Exported_Functions_Group7
|
---|
| 346 | * @{
|
---|
| 347 | */
|
---|
| 348 | void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash);
|
---|
| 349 | /**
|
---|
| 350 | * @}
|
---|
| 351 | */
|
---|
| 352 |
|
---|
| 353 | /** @addtogroup HASH_Exported_Functions_Group8
|
---|
| 354 | * @{
|
---|
| 355 | */
|
---|
| 356 | HAL_HASH_STATETypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash);
|
---|
| 357 | void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash);
|
---|
| 358 | void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash);
|
---|
| 359 | void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash);
|
---|
| 360 | void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash);
|
---|
| 361 | void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash);
|
---|
| 362 | /**
|
---|
| 363 | * @}
|
---|
| 364 | */
|
---|
| 365 |
|
---|
| 366 | /**
|
---|
| 367 | * @}
|
---|
| 368 | */
|
---|
| 369 |
|
---|
| 370 | /* Private types -------------------------------------------------------------*/
|
---|
| 371 | /** @defgroup HASH_Private_Types HASH Private Types
|
---|
| 372 | * @{
|
---|
| 373 | */
|
---|
| 374 |
|
---|
| 375 | /**
|
---|
| 376 | * @}
|
---|
| 377 | */
|
---|
| 378 |
|
---|
| 379 | /* Private variables ---------------------------------------------------------*/
|
---|
| 380 | /** @defgroup HASH_Private_Variables HASH Private Variables
|
---|
| 381 | * @{
|
---|
| 382 | */
|
---|
| 383 |
|
---|
| 384 | /**
|
---|
| 385 | * @}
|
---|
| 386 | */
|
---|
| 387 |
|
---|
| 388 | /* Private constants ---------------------------------------------------------*/
|
---|
| 389 | /** @defgroup HASH_Private_Constants HASH Private Constants
|
---|
| 390 | * @{
|
---|
| 391 | */
|
---|
| 392 |
|
---|
| 393 | /**
|
---|
| 394 | * @}
|
---|
| 395 | */
|
---|
| 396 |
|
---|
| 397 | /* Private macros ------------------------------------------------------------*/
|
---|
| 398 | /** @defgroup HASH_Private_Macros HASH Private Macros
|
---|
| 399 | * @{
|
---|
| 400 | */
|
---|
| 401 | #define IS_HASH_ALGOSELECTION(__ALGOSELECTION__) (((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA1) || \
|
---|
| 402 | ((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA224) || \
|
---|
| 403 | ((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA256) || \
|
---|
| 404 | ((__ALGOSELECTION__) == HASH_ALGOSELECTION_MD5))
|
---|
| 405 |
|
---|
| 406 |
|
---|
| 407 | #define IS_HASH_ALGOMODE(__ALGOMODE__) (((__ALGOMODE__) == HASH_ALGOMODE_HASH) || \
|
---|
| 408 | ((__ALGOMODE__) == HASH_ALGOMODE_HMAC))
|
---|
| 409 |
|
---|
| 410 |
|
---|
| 411 | #define IS_HASH_DATATYPE(__DATATYPE__) (((__DATATYPE__) == HASH_DATATYPE_32B)|| \
|
---|
| 412 | ((__DATATYPE__) == HASH_DATATYPE_16B)|| \
|
---|
| 413 | ((__DATATYPE__) == HASH_DATATYPE_8B) || \
|
---|
| 414 | ((__DATATYPE__) == HASH_DATATYPE_1B))
|
---|
| 415 |
|
---|
| 416 |
|
---|
| 417 | #define IS_HASH_HMAC_KEYTYPE(__KEYTYPE__) (((__KEYTYPE__) == HASH_HMAC_KEYTYPE_SHORTKEY) || \
|
---|
| 418 | ((__KEYTYPE__) == HASH_HMAC_KEYTYPE_LONGKEY))
|
---|
| 419 |
|
---|
| 420 | #define IS_HASH_SHA1_BUFFER_SIZE(__SIZE__) ((((__SIZE__)%4) != 0)? 0U: 1U)
|
---|
| 421 |
|
---|
| 422 | /**
|
---|
| 423 | * @}
|
---|
| 424 | */
|
---|
| 425 |
|
---|
| 426 | /* Private functions ---------------------------------------------------------*/
|
---|
| 427 | /** @defgroup HASH_Private_Functions HASH Private Functions
|
---|
| 428 | * @{
|
---|
| 429 | */
|
---|
| 430 |
|
---|
| 431 | /**
|
---|
| 432 | * @}
|
---|
| 433 | */
|
---|
| 434 |
|
---|
| 435 | #endif /* STM32F415xx || STM32F417xx || STM32F437xx || STM32F439xx || STM32F479xx */
|
---|
| 436 | /**
|
---|
| 437 | * @}
|
---|
| 438 | */
|
---|
| 439 |
|
---|
| 440 | /**
|
---|
| 441 | * @}
|
---|
| 442 | */
|
---|
| 443 |
|
---|
| 444 | #ifdef __cplusplus
|
---|
| 445 | }
|
---|
| 446 | #endif
|
---|
| 447 |
|
---|
| 448 |
|
---|
| 449 | #endif /* __STM32F4xx_HAL_HASH_H */
|
---|
| 450 |
|
---|
| 451 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|