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