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