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