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@86:04dd9b1680ae, 2014-07-02 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jul 02 13:22:23 2014 +0100
- Revision:
- 86:04dd9b1680ae
- Child:
- 99:dbbf35b96557
Release 86 of the mbed library
Main changes:
- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets
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 |
bogdanm | 86:04dd9b1680ae | 5 | * @version V1.1.0 |
bogdanm | 86:04dd9b1680ae | 6 | * @date 19-June-2014 |
bogdanm | 86:04dd9b1680ae | 7 | * @brief Header file of HASH HAL module. |
bogdanm | 86:04dd9b1680ae | 8 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 9 | * @attention |
bogdanm | 86:04dd9b1680ae | 10 | * |
bogdanm | 86:04dd9b1680ae | 11 | * <h2><center>© COPYRIGHT(c) 2014 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 | |
bogdanm | 86:04dd9b1680ae | 55 | /** @addtogroup HASH |
bogdanm | 86:04dd9b1680ae | 56 | * @{ |
bogdanm | 86:04dd9b1680ae | 57 | */ |
bogdanm | 86:04dd9b1680ae | 58 | |
bogdanm | 86:04dd9b1680ae | 59 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 60 | |
bogdanm | 86:04dd9b1680ae | 61 | /** |
bogdanm | 86:04dd9b1680ae | 62 | * @brief HASH Configuration Structure definition |
bogdanm | 86:04dd9b1680ae | 63 | */ |
bogdanm | 86:04dd9b1680ae | 64 | typedef struct |
bogdanm | 86:04dd9b1680ae | 65 | { |
bogdanm | 86:04dd9b1680ae | 66 | uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string. |
bogdanm | 86:04dd9b1680ae | 67 | This parameter can be a value of @ref HASH_Data_Type */ |
bogdanm | 86:04dd9b1680ae | 68 | |
bogdanm | 86:04dd9b1680ae | 69 | uint32_t KeySize; /*!< The key size is used only in HMAC operation */ |
bogdanm | 86:04dd9b1680ae | 70 | |
bogdanm | 86:04dd9b1680ae | 71 | uint8_t* pKey; /*!< The key is used only in HMAC operation */ |
bogdanm | 86:04dd9b1680ae | 72 | }HASH_InitTypeDef; |
bogdanm | 86:04dd9b1680ae | 73 | |
bogdanm | 86:04dd9b1680ae | 74 | /** |
bogdanm | 86:04dd9b1680ae | 75 | * @brief HAL State structures definition |
bogdanm | 86:04dd9b1680ae | 76 | */ |
bogdanm | 86:04dd9b1680ae | 77 | typedef enum |
bogdanm | 86:04dd9b1680ae | 78 | { |
bogdanm | 86:04dd9b1680ae | 79 | HAL_HASH_STATE_RESET = 0x00, /*!< HASH not yet initialized or disabled */ |
bogdanm | 86:04dd9b1680ae | 80 | HAL_HASH_STATE_READY = 0x01, /*!< HASH initialized and ready for use */ |
bogdanm | 86:04dd9b1680ae | 81 | HAL_HASH_STATE_BUSY = 0x02, /*!< HASH internal process is ongoing */ |
bogdanm | 86:04dd9b1680ae | 82 | HAL_HASH_STATE_TIMEOUT = 0x03, /*!< HASH timeout state */ |
bogdanm | 86:04dd9b1680ae | 83 | HAL_HASH_STATE_ERROR = 0x04 /*!< HASH error state */ |
bogdanm | 86:04dd9b1680ae | 84 | }HAL_HASH_STATETypeDef; |
bogdanm | 86:04dd9b1680ae | 85 | |
bogdanm | 86:04dd9b1680ae | 86 | /** |
bogdanm | 86:04dd9b1680ae | 87 | * @brief HAL phase structures definition |
bogdanm | 86:04dd9b1680ae | 88 | */ |
bogdanm | 86:04dd9b1680ae | 89 | typedef enum |
bogdanm | 86:04dd9b1680ae | 90 | { |
bogdanm | 86:04dd9b1680ae | 91 | HAL_HASH_PHASE_READY = 0x01, /*!< HASH peripheral is ready for initialization */ |
bogdanm | 86:04dd9b1680ae | 92 | HAL_HASH_PHASE_PROCESS = 0x02, /*!< HASH peripheral is in processing phase */ |
bogdanm | 86:04dd9b1680ae | 93 | }HAL_HASHPhaseTypeDef; |
bogdanm | 86:04dd9b1680ae | 94 | |
bogdanm | 86:04dd9b1680ae | 95 | /** |
bogdanm | 86:04dd9b1680ae | 96 | * @brief HASH Handle Structure definition |
bogdanm | 86:04dd9b1680ae | 97 | */ |
bogdanm | 86:04dd9b1680ae | 98 | typedef struct |
bogdanm | 86:04dd9b1680ae | 99 | { |
bogdanm | 86:04dd9b1680ae | 100 | HASH_InitTypeDef Init; /*!< HASH required parameters */ |
bogdanm | 86:04dd9b1680ae | 101 | |
bogdanm | 86:04dd9b1680ae | 102 | uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */ |
bogdanm | 86:04dd9b1680ae | 103 | |
bogdanm | 86:04dd9b1680ae | 104 | uint8_t *pHashOutBuffPtr; /*!< Pointer to input buffer */ |
bogdanm | 86:04dd9b1680ae | 105 | |
bogdanm | 86:04dd9b1680ae | 106 | __IO uint32_t HashBuffSize; /*!< Size of buffer to be processed */ |
bogdanm | 86:04dd9b1680ae | 107 | |
bogdanm | 86:04dd9b1680ae | 108 | __IO uint32_t HashInCount; /*!< Counter of inputed data */ |
bogdanm | 86:04dd9b1680ae | 109 | |
bogdanm | 86:04dd9b1680ae | 110 | __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */ |
bogdanm | 86:04dd9b1680ae | 111 | |
bogdanm | 86:04dd9b1680ae | 112 | HAL_StatusTypeDef Status; /*!< HASH peripheral status */ |
bogdanm | 86:04dd9b1680ae | 113 | |
bogdanm | 86:04dd9b1680ae | 114 | HAL_HASHPhaseTypeDef Phase; /*!< HASH peripheral phase */ |
bogdanm | 86:04dd9b1680ae | 115 | |
bogdanm | 86:04dd9b1680ae | 116 | DMA_HandleTypeDef *hdmain; /*!< HASH In DMA handle parameters */ |
bogdanm | 86:04dd9b1680ae | 117 | |
bogdanm | 86:04dd9b1680ae | 118 | HAL_LockTypeDef Lock; /*!< HASH locking object */ |
bogdanm | 86:04dd9b1680ae | 119 | |
bogdanm | 86:04dd9b1680ae | 120 | __IO HAL_HASH_STATETypeDef State; /*!< HASH peripheral state */ |
bogdanm | 86:04dd9b1680ae | 121 | } HASH_HandleTypeDef; |
bogdanm | 86:04dd9b1680ae | 122 | |
bogdanm | 86:04dd9b1680ae | 123 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 124 | |
bogdanm | 86:04dd9b1680ae | 125 | /** @defgroup HASH_Exported_Constants |
bogdanm | 86:04dd9b1680ae | 126 | * @{ |
bogdanm | 86:04dd9b1680ae | 127 | */ |
bogdanm | 86:04dd9b1680ae | 128 | |
bogdanm | 86:04dd9b1680ae | 129 | /** @defgroup HASH_Algo_Selection |
bogdanm | 86:04dd9b1680ae | 130 | * @{ |
bogdanm | 86:04dd9b1680ae | 131 | */ |
bogdanm | 86:04dd9b1680ae | 132 | #define HASH_AlgoSelection_SHA1 ((uint32_t)0x0000) /*!< HASH function is SHA1 */ |
bogdanm | 86:04dd9b1680ae | 133 | #define HASH_AlgoSelection_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */ |
bogdanm | 86:04dd9b1680ae | 134 | #define HASH_AlgoSelection_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */ |
bogdanm | 86:04dd9b1680ae | 135 | #define HASH_AlgoSelection_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */ |
bogdanm | 86:04dd9b1680ae | 136 | |
bogdanm | 86:04dd9b1680ae | 137 | #define IS_HASH_ALGOSELECTION(ALGOSELECTION) (((ALGOSELECTION) == HASH_AlgoSelection_SHA1) || \ |
bogdanm | 86:04dd9b1680ae | 138 | ((ALGOSELECTION) == HASH_AlgoSelection_SHA224) || \ |
bogdanm | 86:04dd9b1680ae | 139 | ((ALGOSELECTION) == HASH_AlgoSelection_SHA256) || \ |
bogdanm | 86:04dd9b1680ae | 140 | ((ALGOSELECTION) == HASH_AlgoSelection_MD5)) |
bogdanm | 86:04dd9b1680ae | 141 | /** |
bogdanm | 86:04dd9b1680ae | 142 | * @} |
bogdanm | 86:04dd9b1680ae | 143 | */ |
bogdanm | 86:04dd9b1680ae | 144 | |
bogdanm | 86:04dd9b1680ae | 145 | /** @defgroup HASH_Algorithm_Mode |
bogdanm | 86:04dd9b1680ae | 146 | * @{ |
bogdanm | 86:04dd9b1680ae | 147 | */ |
bogdanm | 86:04dd9b1680ae | 148 | #define HASH_AlgoMode_HASH ((uint32_t)0x00000000) /*!< Algorithm is HASH */ |
bogdanm | 86:04dd9b1680ae | 149 | #define HASH_AlgoMode_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */ |
bogdanm | 86:04dd9b1680ae | 150 | |
bogdanm | 86:04dd9b1680ae | 151 | #define IS_HASH_ALGOMODE(ALGOMODE) (((ALGOMODE) == HASH_AlgoMode_HASH) || \ |
bogdanm | 86:04dd9b1680ae | 152 | ((ALGOMODE) == HASH_AlgoMode_HMAC)) |
bogdanm | 86:04dd9b1680ae | 153 | /** |
bogdanm | 86:04dd9b1680ae | 154 | * @} |
bogdanm | 86:04dd9b1680ae | 155 | */ |
bogdanm | 86:04dd9b1680ae | 156 | |
bogdanm | 86:04dd9b1680ae | 157 | /** @defgroup HASH_Data_Type |
bogdanm | 86:04dd9b1680ae | 158 | * @{ |
bogdanm | 86:04dd9b1680ae | 159 | */ |
bogdanm | 86:04dd9b1680ae | 160 | #define HASH_DATATYPE_32B ((uint32_t)0x0000) /*!< 32-bit data. No swapping */ |
bogdanm | 86:04dd9b1680ae | 161 | #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */ |
bogdanm | 86:04dd9b1680ae | 162 | #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */ |
bogdanm | 86:04dd9b1680ae | 163 | #define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */ |
bogdanm | 86:04dd9b1680ae | 164 | |
bogdanm | 86:04dd9b1680ae | 165 | #define IS_HASH_DATATYPE(DATATYPE) (((DATATYPE) == HASH_DATATYPE_32B)|| \ |
bogdanm | 86:04dd9b1680ae | 166 | ((DATATYPE) == HASH_DATATYPE_16B)|| \ |
bogdanm | 86:04dd9b1680ae | 167 | ((DATATYPE) == HASH_DATATYPE_8B) || \ |
bogdanm | 86:04dd9b1680ae | 168 | ((DATATYPE) == HASH_DATATYPE_1B)) |
bogdanm | 86:04dd9b1680ae | 169 | /** |
bogdanm | 86:04dd9b1680ae | 170 | * @} |
bogdanm | 86:04dd9b1680ae | 171 | */ |
bogdanm | 86:04dd9b1680ae | 172 | |
bogdanm | 86:04dd9b1680ae | 173 | /** @defgroup HASH_HMAC_Long_key_only_for_HMAC_mode |
bogdanm | 86:04dd9b1680ae | 174 | * @{ |
bogdanm | 86:04dd9b1680ae | 175 | */ |
bogdanm | 86:04dd9b1680ae | 176 | #define HASH_HMACKeyType_ShortKey ((uint32_t)0x00000000) /*!< HMAC Key is <= 64 bytes */ |
bogdanm | 86:04dd9b1680ae | 177 | #define HASH_HMACKeyType_LongKey HASH_CR_LKEY /*!< HMAC Key is > 64 bytes */ |
bogdanm | 86:04dd9b1680ae | 178 | |
bogdanm | 86:04dd9b1680ae | 179 | #define IS_HASH_HMAC_KEYTYPE(KEYTYPE) (((KEYTYPE) == HASH_HMACKeyType_ShortKey) || \ |
bogdanm | 86:04dd9b1680ae | 180 | ((KEYTYPE) == HASH_HMACKeyType_LongKey)) |
bogdanm | 86:04dd9b1680ae | 181 | /** |
bogdanm | 86:04dd9b1680ae | 182 | * @} |
bogdanm | 86:04dd9b1680ae | 183 | */ |
bogdanm | 86:04dd9b1680ae | 184 | |
bogdanm | 86:04dd9b1680ae | 185 | /** @defgroup HASH_flags_definition |
bogdanm | 86:04dd9b1680ae | 186 | * @{ |
bogdanm | 86:04dd9b1680ae | 187 | */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 189 | #define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */ |
bogdanm | 86:04dd9b1680ae | 190 | #define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */ |
bogdanm | 86:04dd9b1680ae | 191 | #define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy : processing a block of data */ |
bogdanm | 86:04dd9b1680ae | 192 | #define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : The input buffer contains at least one word of data */ |
bogdanm | 86:04dd9b1680ae | 193 | /** |
bogdanm | 86:04dd9b1680ae | 194 | * @} |
bogdanm | 86:04dd9b1680ae | 195 | */ |
bogdanm | 86:04dd9b1680ae | 196 | |
bogdanm | 86:04dd9b1680ae | 197 | /** @defgroup HASH_interrupts_definition |
bogdanm | 86:04dd9b1680ae | 198 | * @{ |
bogdanm | 86:04dd9b1680ae | 199 | */ |
bogdanm | 86:04dd9b1680ae | 200 | #define HASH_IT_DINI HASH_IMR_DINIM /*!< A new block can be entered into the input buffer (DIN) */ |
bogdanm | 86:04dd9b1680ae | 201 | #define HASH_IT_DCI HASH_IMR_DCIM /*!< Digest calculation complete */ |
bogdanm | 86:04dd9b1680ae | 202 | /** |
bogdanm | 86:04dd9b1680ae | 203 | * @} |
bogdanm | 86:04dd9b1680ae | 204 | */ |
bogdanm | 86:04dd9b1680ae | 205 | |
bogdanm | 86:04dd9b1680ae | 206 | /** |
bogdanm | 86:04dd9b1680ae | 207 | * @} |
bogdanm | 86:04dd9b1680ae | 208 | */ |
bogdanm | 86:04dd9b1680ae | 209 | |
bogdanm | 86:04dd9b1680ae | 210 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 211 | |
bogdanm | 86:04dd9b1680ae | 212 | /** @brief Reset HASH handle state |
bogdanm | 86:04dd9b1680ae | 213 | * @param __HANDLE__: specifies the HASH handle. |
bogdanm | 86:04dd9b1680ae | 214 | * @retval None |
bogdanm | 86:04dd9b1680ae | 215 | */ |
bogdanm | 86:04dd9b1680ae | 216 | #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET) |
bogdanm | 86:04dd9b1680ae | 217 | |
bogdanm | 86:04dd9b1680ae | 218 | /** @brief Check whether the specified HASH flag is set or not. |
bogdanm | 86:04dd9b1680ae | 219 | * @param __FLAG__: specifies the flag to check. |
bogdanm | 86:04dd9b1680ae | 220 | * This parameter can be one of the following values: |
bogdanm | 86:04dd9b1680ae | 221 | * @arg HASH_FLAG_DINIS: A new block can be entered into the input buffer. |
bogdanm | 86:04dd9b1680ae | 222 | * @arg HASH_FLAG_DCIS: Digest calculation complete |
bogdanm | 86:04dd9b1680ae | 223 | * @arg HASH_FLAG_DMAS: DMA interface is enabled (DMAE=1) or a transfer is ongoing |
bogdanm | 86:04dd9b1680ae | 224 | * @arg HASH_FLAG_BUSY: The hash core is Busy : processing a block of data |
bogdanm | 86:04dd9b1680ae | 225 | * @arg HASH_FLAG_DINNE: DIN not empty : The input buffer contains at least one word of data |
bogdanm | 86:04dd9b1680ae | 226 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
bogdanm | 86:04dd9b1680ae | 227 | */ |
bogdanm | 86:04dd9b1680ae | 228 | #define __HAL_HASH_GET_FLAG(__FLAG__) ((HASH->SR & (__FLAG__)) == (__FLAG__)) |
bogdanm | 86:04dd9b1680ae | 229 | |
bogdanm | 86:04dd9b1680ae | 230 | /** |
bogdanm | 86:04dd9b1680ae | 231 | * @brief Macros for HMAC finish. |
bogdanm | 86:04dd9b1680ae | 232 | * @param None |
bogdanm | 86:04dd9b1680ae | 233 | * @retval None |
bogdanm | 86:04dd9b1680ae | 234 | */ |
bogdanm | 86:04dd9b1680ae | 235 | #define HAL_HMAC_MD5_Finish HAL_HASH_MD5_Finish |
bogdanm | 86:04dd9b1680ae | 236 | #define HAL_HMAC_SHA1_Finish HAL_HASH_SHA1_Finish |
bogdanm | 86:04dd9b1680ae | 237 | #define HAL_HMAC_SHA224_Finish HAL_HASH_SHA224_Finish |
bogdanm | 86:04dd9b1680ae | 238 | #define HAL_HMAC_SHA256_Finish HAL_HASH_SHA256_Finish |
bogdanm | 86:04dd9b1680ae | 239 | |
bogdanm | 86:04dd9b1680ae | 240 | /** |
bogdanm | 86:04dd9b1680ae | 241 | * @brief Enable the multiple DMA mode. |
bogdanm | 86:04dd9b1680ae | 242 | * This feature is available only in STM32F429x and STM32F439x devices. |
bogdanm | 86:04dd9b1680ae | 243 | * @param None |
bogdanm | 86:04dd9b1680ae | 244 | * @retval None |
bogdanm | 86:04dd9b1680ae | 245 | */ |
bogdanm | 86:04dd9b1680ae | 246 | #define __HAL_HASH_SET_MDMAT() HASH->CR |= HASH_CR_MDMAT |
bogdanm | 86:04dd9b1680ae | 247 | |
bogdanm | 86:04dd9b1680ae | 248 | /** |
bogdanm | 86:04dd9b1680ae | 249 | * @brief Disable the multiple DMA mode. |
bogdanm | 86:04dd9b1680ae | 250 | * @param None |
bogdanm | 86:04dd9b1680ae | 251 | * @retval None |
bogdanm | 86:04dd9b1680ae | 252 | */ |
bogdanm | 86:04dd9b1680ae | 253 | #define __HAL_HASH_RESET_MDMAT() HASH->CR &= (uint32_t)(~HASH_CR_MDMAT) |
bogdanm | 86:04dd9b1680ae | 254 | |
bogdanm | 86:04dd9b1680ae | 255 | /** |
bogdanm | 86:04dd9b1680ae | 256 | * @brief Start the digest computation |
bogdanm | 86:04dd9b1680ae | 257 | * @param None |
bogdanm | 86:04dd9b1680ae | 258 | * @retval None |
bogdanm | 86:04dd9b1680ae | 259 | */ |
bogdanm | 86:04dd9b1680ae | 260 | #define __HAL_HASH_START_DIGEST() HASH->STR |= HASH_STR_DCAL |
bogdanm | 86:04dd9b1680ae | 261 | |
bogdanm | 86:04dd9b1680ae | 262 | /** |
bogdanm | 86:04dd9b1680ae | 263 | * @brief Set the number of valid bits in last word written in Data register |
bogdanm | 86:04dd9b1680ae | 264 | * @param SIZE: size in byte of last data written in Data register. |
bogdanm | 86:04dd9b1680ae | 265 | * @retval None |
bogdanm | 86:04dd9b1680ae | 266 | */ |
bogdanm | 86:04dd9b1680ae | 267 | #define __HAL_HASH_SET_NBVALIDBITS(SIZE) do{HASH->STR &= ~(HASH_STR_NBW);\ |
bogdanm | 86:04dd9b1680ae | 268 | HASH->STR |= 8 * ((SIZE) % 4);\ |
bogdanm | 86:04dd9b1680ae | 269 | }while(0) |
bogdanm | 86:04dd9b1680ae | 270 | |
bogdanm | 86:04dd9b1680ae | 271 | /* Include HASH HAL Extension module */ |
bogdanm | 86:04dd9b1680ae | 272 | #include "stm32f4xx_hal_hash_ex.h" |
bogdanm | 86:04dd9b1680ae | 273 | |
bogdanm | 86:04dd9b1680ae | 274 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 275 | |
bogdanm | 86:04dd9b1680ae | 276 | /* Initialization and de-initialization functions **********************************/ |
bogdanm | 86:04dd9b1680ae | 277 | HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 278 | HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 279 | |
bogdanm | 86:04dd9b1680ae | 280 | /* HASH processing using polling *********************************************/ |
bogdanm | 86:04dd9b1680ae | 281 | HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 282 | HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 283 | HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 284 | HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 285 | |
bogdanm | 86:04dd9b1680ae | 286 | /* HASH-MAC processing using polling *****************************************/ |
bogdanm | 86:04dd9b1680ae | 287 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 288 | HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 289 | |
bogdanm | 86:04dd9b1680ae | 290 | /* HASH processing using interrupt *******************************************/ |
bogdanm | 86:04dd9b1680ae | 291 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); |
bogdanm | 86:04dd9b1680ae | 292 | HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); |
bogdanm | 86:04dd9b1680ae | 293 | |
bogdanm | 86:04dd9b1680ae | 294 | /* HASH processing using DMA *************************************************/ |
bogdanm | 86:04dd9b1680ae | 295 | HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 296 | HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 297 | HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 298 | HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); |
bogdanm | 86:04dd9b1680ae | 299 | |
bogdanm | 86:04dd9b1680ae | 300 | /* HASH-HMAC processing using DMA ********************************************/ |
bogdanm | 86:04dd9b1680ae | 301 | HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 302 | HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); |
bogdanm | 86:04dd9b1680ae | 303 | |
bogdanm | 86:04dd9b1680ae | 304 | /* Processing functions ******************************************************/ |
bogdanm | 86:04dd9b1680ae | 305 | void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 306 | |
bogdanm | 86:04dd9b1680ae | 307 | /* Peripheral State functions ************************************************/ |
bogdanm | 86:04dd9b1680ae | 308 | HAL_HASH_STATETypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 309 | void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 310 | void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 311 | void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 312 | void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 313 | void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash); |
bogdanm | 86:04dd9b1680ae | 314 | |
bogdanm | 86:04dd9b1680ae | 315 | #endif /* STM32F415xx || STM32F417xx || STM32F437xx || STM32F439xx */ |
bogdanm | 86:04dd9b1680ae | 316 | /** |
bogdanm | 86:04dd9b1680ae | 317 | * @} |
bogdanm | 86:04dd9b1680ae | 318 | */ |
bogdanm | 86:04dd9b1680ae | 319 | |
bogdanm | 86:04dd9b1680ae | 320 | /** |
bogdanm | 86:04dd9b1680ae | 321 | * @} |
bogdanm | 86:04dd9b1680ae | 322 | */ |
bogdanm | 86:04dd9b1680ae | 323 | |
bogdanm | 86:04dd9b1680ae | 324 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 325 | } |
bogdanm | 86:04dd9b1680ae | 326 | #endif |
bogdanm | 86:04dd9b1680ae | 327 | |
bogdanm | 86:04dd9b1680ae | 328 | |
bogdanm | 86:04dd9b1680ae | 329 | #endif /* __STM32F4xx_HAL_HASH_H */ |
bogdanm | 86:04dd9b1680ae | 330 | |
bogdanm | 86:04dd9b1680ae | 331 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |