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