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