mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Mar 24 17:45:07 2014 +0000
Revision:
133:d4dda5c437f0
Child:
242:7074e42da0b2
Synchronized with git revision 47b961246bed973fe4cb8932781ffc8025b78a61

Full URL: https://github.com/mbedmicro/mbed/commit/47b961246bed973fe4cb8932781ffc8025b78a61/

[STM32F4-Discovery (STM32F407VG)] initial port

Who changed what in which revision?

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