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