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