mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F411RE/stm32f4xx_hal_hash.h@310:6188e0254baa, 2014-09-16 (annotated)
- Committer:
- janekm
- Date:
- Tue Sep 16 22:42:01 2014 +0000
- Revision:
- 310:6188e0254baa
- Parent:
- 235:685d5f11838f
N/A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 235:685d5f11838f | 1 | /** |
mbed_official | 235:685d5f11838f | 2 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 3 | * @file stm32f4xx_hal_hash.h |
mbed_official | 235:685d5f11838f | 4 | * @author MCD Application Team |
mbed_official | 235:685d5f11838f | 5 | * @version V1.1.0 |
mbed_official | 235:685d5f11838f | 6 | * @date 19-June-2014 |
mbed_official | 235:685d5f11838f | 7 | * @brief Header file of HASH HAL module. |
mbed_official | 235:685d5f11838f | 8 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 9 | * @attention |
mbed_official | 235:685d5f11838f | 10 | * |
mbed_official | 235:685d5f11838f | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 235:685d5f11838f | 12 | * |
mbed_official | 235:685d5f11838f | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 235:685d5f11838f | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 235:685d5f11838f | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 235:685d5f11838f | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 235:685d5f11838f | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 235:685d5f11838f | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 235:685d5f11838f | 19 | * and/or other materials provided with the distribution. |
mbed_official | 235:685d5f11838f | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 235:685d5f11838f | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 235:685d5f11838f | 22 | * without specific prior written permission. |
mbed_official | 235:685d5f11838f | 23 | * |
mbed_official | 235:685d5f11838f | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 235:685d5f11838f | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 235:685d5f11838f | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 235:685d5f11838f | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 235:685d5f11838f | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 235:685d5f11838f | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 235:685d5f11838f | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 235:685d5f11838f | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 235:685d5f11838f | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 235:685d5f11838f | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 235:685d5f11838f | 34 | * |
mbed_official | 235:685d5f11838f | 35 | ****************************************************************************** |
mbed_official | 235:685d5f11838f | 36 | */ |
mbed_official | 235:685d5f11838f | 37 | |
mbed_official | 235:685d5f11838f | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 235:685d5f11838f | 39 | #ifndef __STM32F4xx_HAL_HASH_H |
mbed_official | 235:685d5f11838f | 40 | #define __STM32F4xx_HAL_HASH_H |
mbed_official | 235:685d5f11838f | 41 | |
mbed_official | 235:685d5f11838f | 42 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 43 | extern "C" { |
mbed_official | 235:685d5f11838f | 44 | #endif |
mbed_official | 235:685d5f11838f | 45 | |
mbed_official | 235:685d5f11838f | 46 | #if defined(STM32F415xx) || defined(STM32F417xx) || defined(STM32F437xx) || defined(STM32F439xx) |
mbed_official | 235:685d5f11838f | 47 | |
mbed_official | 235:685d5f11838f | 48 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 49 | #include "stm32f4xx_hal_def.h" |
mbed_official | 235:685d5f11838f | 50 | |
mbed_official | 235:685d5f11838f | 51 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 235:685d5f11838f | 52 | * @{ |
mbed_official | 235:685d5f11838f | 53 | */ |
mbed_official | 235:685d5f11838f | 54 | |
mbed_official | 235:685d5f11838f | 55 | /** @addtogroup HASH |
mbed_official | 235:685d5f11838f | 56 | * @{ |
mbed_official | 235:685d5f11838f | 57 | */ |
mbed_official | 235:685d5f11838f | 58 | |
mbed_official | 235:685d5f11838f | 59 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 60 | |
mbed_official | 235:685d5f11838f | 61 | /** |
mbed_official | 235:685d5f11838f | 62 | * @brief HASH Configuration Structure definition |
mbed_official | 235:685d5f11838f | 63 | */ |
mbed_official | 235:685d5f11838f | 64 | typedef struct |
mbed_official | 235:685d5f11838f | 65 | { |
mbed_official | 235:685d5f11838f | 66 | uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string. |
mbed_official | 235:685d5f11838f | 67 | This parameter can be a value of @ref HASH_Data_Type */ |
mbed_official | 235:685d5f11838f | 68 | |
mbed_official | 235:685d5f11838f | 69 | uint32_t KeySize; /*!< The key size is used only in HMAC operation */ |
mbed_official | 235:685d5f11838f | 70 | |
mbed_official | 235:685d5f11838f | 71 | uint8_t* pKey; /*!< The key is used only in HMAC operation */ |
mbed_official | 235:685d5f11838f | 72 | }HASH_InitTypeDef; |
mbed_official | 235:685d5f11838f | 73 | |
mbed_official | 235:685d5f11838f | 74 | /** |
mbed_official | 235:685d5f11838f | 75 | * @brief HAL State structures definition |
mbed_official | 235:685d5f11838f | 76 | */ |
mbed_official | 235:685d5f11838f | 77 | typedef enum |
mbed_official | 235:685d5f11838f | 78 | { |
mbed_official | 235:685d5f11838f | 79 | HAL_HASH_STATE_RESET = 0x00, /*!< HASH not yet initialized or disabled */ |
mbed_official | 235:685d5f11838f | 80 | HAL_HASH_STATE_READY = 0x01, /*!< HASH initialized and ready for use */ |
mbed_official | 235:685d5f11838f | 81 | HAL_HASH_STATE_BUSY = 0x02, /*!< HASH internal process is ongoing */ |
mbed_official | 235:685d5f11838f | 82 | HAL_HASH_STATE_TIMEOUT = 0x03, /*!< HASH timeout state */ |
mbed_official | 235:685d5f11838f | 83 | HAL_HASH_STATE_ERROR = 0x04 /*!< HASH error state */ |
mbed_official | 235:685d5f11838f | 84 | }HAL_HASH_STATETypeDef; |
mbed_official | 235:685d5f11838f | 85 | |
mbed_official | 235:685d5f11838f | 86 | /** |
mbed_official | 235:685d5f11838f | 87 | * @brief HAL phase structures definition |
mbed_official | 235:685d5f11838f | 88 | */ |
mbed_official | 235:685d5f11838f | 89 | typedef enum |
mbed_official | 235:685d5f11838f | 90 | { |
mbed_official | 235:685d5f11838f | 91 | HAL_HASH_PHASE_READY = 0x01, /*!< HASH peripheral is ready for initialization */ |
mbed_official | 235:685d5f11838f | 92 | HAL_HASH_PHASE_PROCESS = 0x02, /*!< HASH peripheral is in processing phase */ |
mbed_official | 235:685d5f11838f | 93 | }HAL_HASHPhaseTypeDef; |
mbed_official | 235:685d5f11838f | 94 | |
mbed_official | 235:685d5f11838f | 95 | /** |
mbed_official | 235:685d5f11838f | 96 | * @brief HASH Handle Structure definition |
mbed_official | 235:685d5f11838f | 97 | */ |
mbed_official | 235:685d5f11838f | 98 | typedef struct |
mbed_official | 235:685d5f11838f | 99 | { |
mbed_official | 235:685d5f11838f | 100 | HASH_InitTypeDef Init; /*!< HASH required parameters */ |
mbed_official | 235:685d5f11838f | 101 | |
mbed_official | 235:685d5f11838f | 102 | uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */ |
mbed_official | 235:685d5f11838f | 103 | |
mbed_official | 235:685d5f11838f | 104 | uint8_t *pHashOutBuffPtr; /*!< Pointer to input buffer */ |
mbed_official | 235:685d5f11838f | 105 | |
mbed_official | 235:685d5f11838f | 106 | __IO uint32_t HashBuffSize; /*!< Size of buffer to be processed */ |
mbed_official | 235:685d5f11838f | 107 | |
mbed_official | 235:685d5f11838f | 108 | __IO uint32_t HashInCount; /*!< Counter of inputed data */ |
mbed_official | 235:685d5f11838f | 109 | |
mbed_official | 235:685d5f11838f | 110 | __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */ |
mbed_official | 235:685d5f11838f | 111 | |
mbed_official | 235:685d5f11838f | 112 | HAL_StatusTypeDef Status; /*!< HASH peripheral status */ |
mbed_official | 235:685d5f11838f | 113 | |
mbed_official | 235:685d5f11838f | 114 | HAL_HASHPhaseTypeDef Phase; /*!< HASH peripheral phase */ |
mbed_official | 235:685d5f11838f | 115 | |
mbed_official | 235:685d5f11838f | 116 | DMA_HandleTypeDef *hdmain; /*!< HASH In DMA handle parameters */ |
mbed_official | 235:685d5f11838f | 117 | |
mbed_official | 235:685d5f11838f | 118 | HAL_LockTypeDef Lock; /*!< HASH locking object */ |
mbed_official | 235:685d5f11838f | 119 | |
mbed_official | 235:685d5f11838f | 120 | __IO HAL_HASH_STATETypeDef State; /*!< HASH peripheral state */ |
mbed_official | 235:685d5f11838f | 121 | } HASH_HandleTypeDef; |
mbed_official | 235:685d5f11838f | 122 | |
mbed_official | 235:685d5f11838f | 123 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 124 | |
mbed_official | 235:685d5f11838f | 125 | /** @defgroup HASH_Exported_Constants |
mbed_official | 235:685d5f11838f | 126 | * @{ |
mbed_official | 235:685d5f11838f | 127 | */ |
mbed_official | 235:685d5f11838f | 128 | |
mbed_official | 235:685d5f11838f | 129 | /** @defgroup HASH_Algo_Selection |
mbed_official | 235:685d5f11838f | 130 | * @{ |
mbed_official | 235:685d5f11838f | 131 | */ |
mbed_official | 235:685d5f11838f | 132 | #define HASH_AlgoSelection_SHA1 ((uint32_t)0x0000) /*!< HASH function is SHA1 */ |
mbed_official | 235:685d5f11838f | 133 | #define HASH_AlgoSelection_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */ |
mbed_official | 235:685d5f11838f | 134 | #define HASH_AlgoSelection_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */ |
mbed_official | 235:685d5f11838f | 135 | #define HASH_AlgoSelection_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */ |
mbed_official | 235:685d5f11838f | 136 | |
mbed_official | 235:685d5f11838f | 137 | #define IS_HASH_ALGOSELECTION(ALGOSELECTION) (((ALGOSELECTION) == HASH_AlgoSelection_SHA1) || \ |
mbed_official | 235:685d5f11838f | 138 | ((ALGOSELECTION) == HASH_AlgoSelection_SHA224) || \ |
mbed_official | 235:685d5f11838f | 139 | ((ALGOSELECTION) == HASH_AlgoSelection_SHA256) || \ |
mbed_official | 235:685d5f11838f | 140 | ((ALGOSELECTION) == HASH_AlgoSelection_MD5)) |
mbed_official | 235:685d5f11838f | 141 | /** |
mbed_official | 235:685d5f11838f | 142 | * @} |
mbed_official | 235:685d5f11838f | 143 | */ |
mbed_official | 235:685d5f11838f | 144 | |
mbed_official | 235:685d5f11838f | 145 | /** @defgroup HASH_Algorithm_Mode |
mbed_official | 235:685d5f11838f | 146 | * @{ |
mbed_official | 235:685d5f11838f | 147 | */ |
mbed_official | 235:685d5f11838f | 148 | #define HASH_AlgoMode_HASH ((uint32_t)0x00000000) /*!< Algorithm is HASH */ |
mbed_official | 235:685d5f11838f | 149 | #define HASH_AlgoMode_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */ |
mbed_official | 235:685d5f11838f | 150 | |
mbed_official | 235:685d5f11838f | 151 | #define IS_HASH_ALGOMODE(ALGOMODE) (((ALGOMODE) == HASH_AlgoMode_HASH) || \ |
mbed_official | 235:685d5f11838f | 152 | ((ALGOMODE) == HASH_AlgoMode_HMAC)) |
mbed_official | 235:685d5f11838f | 153 | /** |
mbed_official | 235:685d5f11838f | 154 | * @} |
mbed_official | 235:685d5f11838f | 155 | */ |
mbed_official | 235:685d5f11838f | 156 | |
mbed_official | 235:685d5f11838f | 157 | /** @defgroup HASH_Data_Type |
mbed_official | 235:685d5f11838f | 158 | * @{ |
mbed_official | 235:685d5f11838f | 159 | */ |
mbed_official | 235:685d5f11838f | 160 | #define HASH_DATATYPE_32B ((uint32_t)0x0000) /*!< 32-bit data. No swapping */ |
mbed_official | 235:685d5f11838f | 161 | #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */ |
mbed_official | 235:685d5f11838f | 162 | #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */ |
mbed_official | 235:685d5f11838f | 163 | #define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */ |
mbed_official | 235:685d5f11838f | 164 | |
mbed_official | 235:685d5f11838f | 165 | #define IS_HASH_DATATYPE(DATATYPE) (((DATATYPE) == HASH_DATATYPE_32B)|| \ |
mbed_official | 235:685d5f11838f | 166 | ((DATATYPE) == HASH_DATATYPE_16B)|| \ |
mbed_official | 235:685d5f11838f | 167 | ((DATATYPE) == HASH_DATATYPE_8B) || \ |
mbed_official | 235:685d5f11838f | 168 | ((DATATYPE) == HASH_DATATYPE_1B)) |
mbed_official | 235:685d5f11838f | 169 | /** |
mbed_official | 235:685d5f11838f | 170 | * @} |
mbed_official | 235:685d5f11838f | 171 | */ |
mbed_official | 235:685d5f11838f | 172 | |
mbed_official | 235:685d5f11838f | 173 | /** @defgroup HASH_HMAC_Long_key_only_for_HMAC_mode |
mbed_official | 235:685d5f11838f | 174 | * @{ |
mbed_official | 235:685d5f11838f | 175 | */ |
mbed_official | 235:685d5f11838f | 176 | #define HASH_HMACKeyType_ShortKey ((uint32_t)0x00000000) /*!< HMAC Key is <= 64 bytes */ |
mbed_official | 235:685d5f11838f | 177 | #define HASH_HMACKeyType_LongKey HASH_CR_LKEY /*!< HMAC Key is > 64 bytes */ |
mbed_official | 235:685d5f11838f | 178 | |
mbed_official | 235:685d5f11838f | 179 | #define IS_HASH_HMAC_KEYTYPE(KEYTYPE) (((KEYTYPE) == HASH_HMACKeyType_ShortKey) || \ |
mbed_official | 235:685d5f11838f | 180 | ((KEYTYPE) == HASH_HMACKeyType_LongKey)) |
mbed_official | 235:685d5f11838f | 181 | /** |
mbed_official | 235:685d5f11838f | 182 | * @} |
mbed_official | 235:685d5f11838f | 183 | */ |
mbed_official | 235:685d5f11838f | 184 | |
mbed_official | 235:685d5f11838f | 185 | /** @defgroup HASH_flags_definition |
mbed_official | 235:685d5f11838f | 186 | * @{ |
mbed_official | 235:685d5f11838f | 187 | */ |
mbed_official | 235:685d5f11838f | 188 | #define HASH_FLAG_DINIS HASH_SR_DINIS /*!< 16 locations are free in the DIN : A new block can be entered into the input buffer */ |
mbed_official | 235:685d5f11838f | 189 | #define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */ |
mbed_official | 235:685d5f11838f | 190 | #define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */ |
mbed_official | 235:685d5f11838f | 191 | #define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy : processing a block of data */ |
mbed_official | 235:685d5f11838f | 192 | #define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : The input buffer contains at least one word of data */ |
mbed_official | 235:685d5f11838f | 193 | /** |
mbed_official | 235:685d5f11838f | 194 | * @} |
mbed_official | 235:685d5f11838f | 195 | */ |
mbed_official | 235:685d5f11838f | 196 | |
mbed_official | 235:685d5f11838f | 197 | /** @defgroup HASH_interrupts_definition |
mbed_official | 235:685d5f11838f | 198 | * @{ |
mbed_official | 235:685d5f11838f | 199 | */ |
mbed_official | 235:685d5f11838f | 200 | #define HASH_IT_DINI HASH_IMR_DINIM /*!< A new block can be entered into the input buffer (DIN) */ |
mbed_official | 235:685d5f11838f | 201 | #define HASH_IT_DCI HASH_IMR_DCIM /*!< Digest calculation complete */ |
mbed_official | 235:685d5f11838f | 202 | /** |
mbed_official | 235:685d5f11838f | 203 | * @} |
mbed_official | 235:685d5f11838f | 204 | */ |
mbed_official | 235:685d5f11838f | 205 | |
mbed_official | 235:685d5f11838f | 206 | /** |
mbed_official | 235:685d5f11838f | 207 | * @} |
mbed_official | 235:685d5f11838f | 208 | */ |
mbed_official | 235:685d5f11838f | 209 | |
mbed_official | 235:685d5f11838f | 210 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 211 | |
mbed_official | 235:685d5f11838f | 212 | /** @brief Reset HASH handle state |
mbed_official | 235:685d5f11838f | 213 | * @param __HANDLE__: specifies the HASH handle. |
mbed_official | 235:685d5f11838f | 214 | * @retval None |
mbed_official | 235:685d5f11838f | 215 | */ |
mbed_official | 235:685d5f11838f | 216 | #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET) |
mbed_official | 235:685d5f11838f | 217 | |
mbed_official | 235:685d5f11838f | 218 | /** @brief Check whether the specified HASH flag is set or not. |
mbed_official | 235:685d5f11838f | 219 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 235:685d5f11838f | 220 | * This parameter can be one of the following values: |
mbed_official | 235:685d5f11838f | 221 | * @arg HASH_FLAG_DINIS: A new block can be entered into the input buffer. |
mbed_official | 235:685d5f11838f | 222 | * @arg HASH_FLAG_DCIS: Digest calculation complete |
mbed_official | 235:685d5f11838f | 223 | * @arg HASH_FLAG_DMAS: DMA interface is enabled (DMAE=1) or a transfer is ongoing |
mbed_official | 235:685d5f11838f | 224 | * @arg HASH_FLAG_BUSY: The hash core is Busy : processing a block of data |
mbed_official | 235:685d5f11838f | 225 | * @arg HASH_FLAG_DINNE: DIN not empty : The input buffer contains at least one word of data |
mbed_official | 235:685d5f11838f | 226 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 235:685d5f11838f | 227 | */ |
mbed_official | 235:685d5f11838f | 228 | #define __HAL_HASH_GET_FLAG(__FLAG__) ((HASH->SR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 235:685d5f11838f | 229 | |
mbed_official | 235:685d5f11838f | 230 | /** |
mbed_official | 235:685d5f11838f | 231 | * @brief Macros for HMAC finish. |
mbed_official | 235:685d5f11838f | 232 | * @param None |
mbed_official | 235:685d5f11838f | 233 | * @retval None |
mbed_official | 235:685d5f11838f | 234 | */ |
mbed_official | 235:685d5f11838f | 235 | #define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish |
mbed_official | 235:685d5f11838f | 236 | #define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish |
mbed_official | 235:685d5f11838f | 237 | #define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish |
mbed_official | 235:685d5f11838f | 238 | #define HAL_HMAC_SHA256_Finish HAL_HASH_SHA256_Finish |
mbed_official | 235:685d5f11838f | 239 | |
mbed_official | 235:685d5f11838f | 240 | /** |
mbed_official | 235:685d5f11838f | 241 | * @brief Enable the multiple DMA mode. |
mbed_official | 235:685d5f11838f | 242 | * This feature is available only in STM32F429x and STM32F439x devices. |
mbed_official | 235:685d5f11838f | 243 | * @param None |
mbed_official | 235:685d5f11838f | 244 | * @retval None |
mbed_official | 235:685d5f11838f | 245 | */ |
mbed_official | 235:685d5f11838f | 246 | #define __HAL_HASH_SET_MDMAT() HASH->CR |= HASH_CR_MDMAT |
mbed_official | 235:685d5f11838f | 247 | |
mbed_official | 235:685d5f11838f | 248 | /** |
mbed_official | 235:685d5f11838f | 249 | * @brief Disable the multiple DMA mode. |
mbed_official | 235:685d5f11838f | 250 | * @param None |
mbed_official | 235:685d5f11838f | 251 | * @retval None |
mbed_official | 235:685d5f11838f | 252 | */ |
mbed_official | 235:685d5f11838f | 253 | #define __HAL_HASH_RESET_MDMAT() HASH->CR &= (uint32_t)(~HASH_CR_MDMAT) |
mbed_official | 235:685d5f11838f | 254 | |
mbed_official | 235:685d5f11838f | 255 | /** |
mbed_official | 235:685d5f11838f | 256 | * @brief Start the digest computation |
mbed_official | 235:685d5f11838f | 257 | * @param None |
mbed_official | 235:685d5f11838f | 258 | * @retval None |
mbed_official | 235:685d5f11838f | 259 | */ |
mbed_official | 235:685d5f11838f | 260 | #define __HAL_HASH_START_DIGEST() HASH->STR |= HASH_STR_DCAL |
mbed_official | 235:685d5f11838f | 261 | |
mbed_official | 235:685d5f11838f | 262 | /** |
mbed_official | 235:685d5f11838f | 263 | * @brief Set the number of valid bits in last word written in Data register |
mbed_official | 235:685d5f11838f | 264 | * @param SIZE: size in byte of last data written in Data register. |
mbed_official | 235:685d5f11838f | 265 | * @retval None |
mbed_official | 235:685d5f11838f | 266 | */ |
mbed_official | 235:685d5f11838f | 267 | #define __HAL_HASH_SET_NBVALIDBITS(SIZE) do{HASH->STR &= ~(HASH_STR_NBW);\ |
mbed_official | 235:685d5f11838f | 268 | HASH->STR |= 8 * ((SIZE) % 4);\ |
mbed_official | 235:685d5f11838f | 269 | }while(0) |
mbed_official | 235:685d5f11838f | 270 | |
mbed_official | 235:685d5f11838f | 271 | /* Include HASH HAL Extension module */ |
mbed_official | 235:685d5f11838f | 272 | #include "stm32f4xx_hal_hash_ex.h" |
mbed_official | 235:685d5f11838f | 273 | |
mbed_official | 235:685d5f11838f | 274 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 235:685d5f11838f | 275 | |
mbed_official | 235:685d5f11838f | 276 | /* Initialization and de-initialization functions **********************************/ |
mbed_official | 235:685d5f11838f | 277 | HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 278 | HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 279 | |
mbed_official | 235:685d5f11838f | 280 | /* HASH processing using polling *********************************************/ |
mbed_official | 235:685d5f11838f | 281 | HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 282 | HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 283 | HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 284 | HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 285 | |
mbed_official | 235:685d5f11838f | 286 | /* HASH-MAC processing using polling *****************************************/ |
mbed_official | 235:685d5f11838f | 287 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 288 | HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 289 | |
mbed_official | 235:685d5f11838f | 290 | /* HASH processing using interrupt *******************************************/ |
mbed_official | 235:685d5f11838f | 291 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); |
mbed_official | 235:685d5f11838f | 292 | HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); |
mbed_official | 235:685d5f11838f | 293 | |
mbed_official | 235:685d5f11838f | 294 | /* HASH processing using DMA *************************************************/ |
mbed_official | 235:685d5f11838f | 295 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 296 | HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 297 | HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 298 | HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); |
mbed_official | 235:685d5f11838f | 299 | |
mbed_official | 235:685d5f11838f | 300 | /* HASH-HMAC processing using DMA ********************************************/ |
mbed_official | 235:685d5f11838f | 301 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 302 | HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
mbed_official | 235:685d5f11838f | 303 | |
mbed_official | 235:685d5f11838f | 304 | /* Processing functions ******************************************************/ |
mbed_official | 235:685d5f11838f | 305 | void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 306 | |
mbed_official | 235:685d5f11838f | 307 | /* Peripheral State functions ************************************************/ |
mbed_official | 235:685d5f11838f | 308 | HAL_HASH_STATETypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 309 | void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 310 | void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 311 | void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 312 | void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 313 | void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash); |
mbed_official | 235:685d5f11838f | 314 | |
mbed_official | 235:685d5f11838f | 315 | #endif /* STM32F415xx || STM32F417xx || STM32F437xx || STM32F439xx */ |
mbed_official | 235:685d5f11838f | 316 | /** |
mbed_official | 235:685d5f11838f | 317 | * @} |
mbed_official | 235:685d5f11838f | 318 | */ |
mbed_official | 235:685d5f11838f | 319 | |
mbed_official | 235:685d5f11838f | 320 | /** |
mbed_official | 235:685d5f11838f | 321 | * @} |
mbed_official | 235:685d5f11838f | 322 | */ |
mbed_official | 235:685d5f11838f | 323 | |
mbed_official | 235:685d5f11838f | 324 | #ifdef __cplusplus |
mbed_official | 235:685d5f11838f | 325 | } |
mbed_official | 235:685d5f11838f | 326 | #endif |
mbed_official | 235:685d5f11838f | 327 | |
mbed_official | 235:685d5f11838f | 328 | |
mbed_official | 235:685d5f11838f | 329 | #endif /* __STM32F4xx_HAL_HASH_H */ |
mbed_official | 235:685d5f11838f | 330 | |
mbed_official | 235:685d5f11838f | 331 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |