mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L053R8/stm32l0xx_hal_cryp.h@181:a4cbdfbbd2f4, 2014-05-07 (annotated)
- Committer:
- mbed_official
- Date:
- Wed May 07 13:15:08 2014 +0100
- Revision:
- 181:a4cbdfbbd2f4
Synchronized with git revision 7751e759576c6fd68deccb81ea82bac19ed41745
Full URL: https://github.com/mbedmicro/mbed/commit/7751e759576c6fd68deccb81ea82bac19ed41745/
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 181:a4cbdfbbd2f4 | 1 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 2 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 3 | * @file stm32l0xx_hal_cryp.h |
mbed_official | 181:a4cbdfbbd2f4 | 4 | * @author MCD Application Team |
mbed_official | 181:a4cbdfbbd2f4 | 5 | * @version V1.0.0 |
mbed_official | 181:a4cbdfbbd2f4 | 6 | * @date 22-April-2014 |
mbed_official | 181:a4cbdfbbd2f4 | 7 | * @brief Header file of CRYP HAL module. |
mbed_official | 181:a4cbdfbbd2f4 | 8 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 9 | * @attention |
mbed_official | 181:a4cbdfbbd2f4 | 10 | * |
mbed_official | 181:a4cbdfbbd2f4 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 181:a4cbdfbbd2f4 | 12 | * |
mbed_official | 181:a4cbdfbbd2f4 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 181:a4cbdfbbd2f4 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 181:a4cbdfbbd2f4 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 181:a4cbdfbbd2f4 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 181:a4cbdfbbd2f4 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 181:a4cbdfbbd2f4 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 181:a4cbdfbbd2f4 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 181:a4cbdfbbd2f4 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 181:a4cbdfbbd2f4 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 181:a4cbdfbbd2f4 | 22 | * without specific prior written permission. |
mbed_official | 181:a4cbdfbbd2f4 | 23 | * |
mbed_official | 181:a4cbdfbbd2f4 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 181:a4cbdfbbd2f4 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 181:a4cbdfbbd2f4 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 181:a4cbdfbbd2f4 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 181:a4cbdfbbd2f4 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 181:a4cbdfbbd2f4 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 181:a4cbdfbbd2f4 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 181:a4cbdfbbd2f4 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 181:a4cbdfbbd2f4 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 181:a4cbdfbbd2f4 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 181:a4cbdfbbd2f4 | 34 | * |
mbed_official | 181:a4cbdfbbd2f4 | 35 | ****************************************************************************** |
mbed_official | 181:a4cbdfbbd2f4 | 36 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 37 | |
mbed_official | 181:a4cbdfbbd2f4 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 39 | #ifndef __STM32L0xx_HAL_CRYP_H |
mbed_official | 181:a4cbdfbbd2f4 | 40 | #define __STM32L0xx_HAL_CRYP_H |
mbed_official | 181:a4cbdfbbd2f4 | 41 | |
mbed_official | 181:a4cbdfbbd2f4 | 42 | #ifdef __cplusplus |
mbed_official | 181:a4cbdfbbd2f4 | 43 | extern "C" { |
mbed_official | 181:a4cbdfbbd2f4 | 44 | #endif |
mbed_official | 181:a4cbdfbbd2f4 | 45 | |
mbed_official | 181:a4cbdfbbd2f4 | 46 | #if !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) |
mbed_official | 181:a4cbdfbbd2f4 | 47 | |
mbed_official | 181:a4cbdfbbd2f4 | 48 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 49 | #include "stm32l0xx_hal_def.h" |
mbed_official | 181:a4cbdfbbd2f4 | 50 | |
mbed_official | 181:a4cbdfbbd2f4 | 51 | /** @addtogroup STM32L0xx_HAL_Driver |
mbed_official | 181:a4cbdfbbd2f4 | 52 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 53 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 54 | |
mbed_official | 181:a4cbdfbbd2f4 | 55 | /** @addtogroup CRYP |
mbed_official | 181:a4cbdfbbd2f4 | 56 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 57 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 58 | |
mbed_official | 181:a4cbdfbbd2f4 | 59 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 60 | |
mbed_official | 181:a4cbdfbbd2f4 | 61 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 62 | * @brief CRYP Configuration Structure definition |
mbed_official | 181:a4cbdfbbd2f4 | 63 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 64 | typedef struct |
mbed_official | 181:a4cbdfbbd2f4 | 65 | { |
mbed_official | 181:a4cbdfbbd2f4 | 66 | uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string. |
mbed_official | 181:a4cbdfbbd2f4 | 67 | This parameter can be a value of @ref CRYP_Data_Type */ |
mbed_official | 181:a4cbdfbbd2f4 | 68 | |
mbed_official | 181:a4cbdfbbd2f4 | 69 | uint8_t* pKey; /*!< The key used for encryption/decryption */ |
mbed_official | 181:a4cbdfbbd2f4 | 70 | |
mbed_official | 181:a4cbdfbbd2f4 | 71 | uint8_t* pInitVect; /*!< The initialization vector used also as initialization |
mbed_official | 181:a4cbdfbbd2f4 | 72 | counter in CTR mode */ |
mbed_official | 181:a4cbdfbbd2f4 | 73 | |
mbed_official | 181:a4cbdfbbd2f4 | 74 | }CRYP_InitTypeDef; |
mbed_official | 181:a4cbdfbbd2f4 | 75 | |
mbed_official | 181:a4cbdfbbd2f4 | 76 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 77 | * @brief HAL CRYP State structures definition |
mbed_official | 181:a4cbdfbbd2f4 | 78 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 79 | typedef enum |
mbed_official | 181:a4cbdfbbd2f4 | 80 | { |
mbed_official | 181:a4cbdfbbd2f4 | 81 | HAL_CRYP_STATE_RESET = 0x00, /*!< CRYP not yet initialized or disabled */ |
mbed_official | 181:a4cbdfbbd2f4 | 82 | HAL_CRYP_STATE_READY = 0x01, /*!< CRYP initialized and ready for use */ |
mbed_official | 181:a4cbdfbbd2f4 | 83 | HAL_CRYP_STATE_BUSY = 0x02, /*!< CRYP internal processing is ongoing */ |
mbed_official | 181:a4cbdfbbd2f4 | 84 | HAL_CRYP_STATE_TIMEOUT = 0x03, /*!< CRYP timeout state */ |
mbed_official | 181:a4cbdfbbd2f4 | 85 | HAL_CRYP_STATE_ERROR = 0x04 /*!< CRYP error state */ |
mbed_official | 181:a4cbdfbbd2f4 | 86 | |
mbed_official | 181:a4cbdfbbd2f4 | 87 | }HAL_CRYP_STATETypeDef; |
mbed_official | 181:a4cbdfbbd2f4 | 88 | |
mbed_official | 181:a4cbdfbbd2f4 | 89 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 90 | * @brief HAL CRYP phase structures definition |
mbed_official | 181:a4cbdfbbd2f4 | 91 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 92 | typedef enum |
mbed_official | 181:a4cbdfbbd2f4 | 93 | { |
mbed_official | 181:a4cbdfbbd2f4 | 94 | HAL_CRYP_PHASE_READY = 0x01, /*!< CRYP peripheral is ready for initialization. */ |
mbed_official | 181:a4cbdfbbd2f4 | 95 | HAL_CRYP_PHASE_PROCESS = 0x02, /*!< CRYP peripheral is in processing phase */ |
mbed_official | 181:a4cbdfbbd2f4 | 96 | }HAL_PhaseTypeDef; |
mbed_official | 181:a4cbdfbbd2f4 | 97 | |
mbed_official | 181:a4cbdfbbd2f4 | 98 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 99 | * @brief CRYP handle Structure definition |
mbed_official | 181:a4cbdfbbd2f4 | 100 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 101 | typedef struct |
mbed_official | 181:a4cbdfbbd2f4 | 102 | { |
mbed_official | 181:a4cbdfbbd2f4 | 103 | CRYP_InitTypeDef Init; /*!< CRYP required parameters */ |
mbed_official | 181:a4cbdfbbd2f4 | 104 | |
mbed_official | 181:a4cbdfbbd2f4 | 105 | uint8_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ |
mbed_official | 181:a4cbdfbbd2f4 | 106 | |
mbed_official | 181:a4cbdfbbd2f4 | 107 | uint8_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ |
mbed_official | 181:a4cbdfbbd2f4 | 108 | |
mbed_official | 181:a4cbdfbbd2f4 | 109 | __IO uint16_t CrypInCount; /*!< Counter of inputed data */ |
mbed_official | 181:a4cbdfbbd2f4 | 110 | |
mbed_official | 181:a4cbdfbbd2f4 | 111 | __IO uint16_t CrypOutCount; /*!< Counter of outputed data */ |
mbed_official | 181:a4cbdfbbd2f4 | 112 | |
mbed_official | 181:a4cbdfbbd2f4 | 113 | HAL_StatusTypeDef Status; /*!< CRYP peripheral status */ |
mbed_official | 181:a4cbdfbbd2f4 | 114 | |
mbed_official | 181:a4cbdfbbd2f4 | 115 | HAL_PhaseTypeDef Phase; /*!< CRYP peripheral phase */ |
mbed_official | 181:a4cbdfbbd2f4 | 116 | |
mbed_official | 181:a4cbdfbbd2f4 | 117 | DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */ |
mbed_official | 181:a4cbdfbbd2f4 | 118 | |
mbed_official | 181:a4cbdfbbd2f4 | 119 | DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */ |
mbed_official | 181:a4cbdfbbd2f4 | 120 | |
mbed_official | 181:a4cbdfbbd2f4 | 121 | HAL_LockTypeDef Lock; /*!< CRYP locking object */ |
mbed_official | 181:a4cbdfbbd2f4 | 122 | |
mbed_official | 181:a4cbdfbbd2f4 | 123 | __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */ |
mbed_official | 181:a4cbdfbbd2f4 | 124 | |
mbed_official | 181:a4cbdfbbd2f4 | 125 | }CRYP_HandleTypeDef; |
mbed_official | 181:a4cbdfbbd2f4 | 126 | |
mbed_official | 181:a4cbdfbbd2f4 | 127 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 128 | |
mbed_official | 181:a4cbdfbbd2f4 | 129 | /** @defgroup CRYP_Exported_Constants |
mbed_official | 181:a4cbdfbbd2f4 | 130 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 131 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 132 | |
mbed_official | 181:a4cbdfbbd2f4 | 133 | /** @defgroup CRYP_Data_Type |
mbed_official | 181:a4cbdfbbd2f4 | 134 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 135 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 136 | #define CRYP_DATATYPE_32B ((uint32_t)0x00000000) |
mbed_official | 181:a4cbdfbbd2f4 | 137 | #define CRYP_DATATYPE_16B AES_CR_DATATYPE_0 |
mbed_official | 181:a4cbdfbbd2f4 | 138 | #define CRYP_DATATYPE_8B AES_CR_DATATYPE_1 |
mbed_official | 181:a4cbdfbbd2f4 | 139 | #define CRYP_DATATYPE_1B AES_CR_DATATYPE |
mbed_official | 181:a4cbdfbbd2f4 | 140 | |
mbed_official | 181:a4cbdfbbd2f4 | 141 | #define IS_CRYP_DATATYPE(DATATYPE) (((DATATYPE) == CRYP_DATATYPE_32B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 142 | ((DATATYPE) == CRYP_DATATYPE_16B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 143 | ((DATATYPE) == CRYP_DATATYPE_8B) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 144 | ((DATATYPE) == CRYP_DATATYPE_1B)) |
mbed_official | 181:a4cbdfbbd2f4 | 145 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 146 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 147 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 148 | |
mbed_official | 181:a4cbdfbbd2f4 | 149 | /** @defgroup CRYP_AlgoModeDirection |
mbed_official | 181:a4cbdfbbd2f4 | 150 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 151 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 152 | #define CRYP_CR_ALGOMODE_DIRECTION (uint32_t)(AES_CR_MODE|AES_CR_CHMOD) |
mbed_official | 181:a4cbdfbbd2f4 | 153 | |
mbed_official | 181:a4cbdfbbd2f4 | 154 | #define CRYP_CR_ALGOMODE_AES_ECB_ENCRYPT ((uint32_t)0x00000000) |
mbed_official | 181:a4cbdfbbd2f4 | 155 | #define CRYP_CR_ALGOMODE_AES_ECB_KEYDERDECRYPT (AES_CR_MODE) |
mbed_official | 181:a4cbdfbbd2f4 | 156 | #define CRYP_CR_ALGOMODE_AES_CBC_ENCRYPT (AES_CR_CHMOD_0) |
mbed_official | 181:a4cbdfbbd2f4 | 157 | #define CRYP_CR_ALGOMODE_AES_CBC_KEYDERDECRYPT ((uint32_t)(AES_CR_CHMOD_0|AES_CR_MODE)) |
mbed_official | 181:a4cbdfbbd2f4 | 158 | #define CRYP_CR_ALGOMODE_AES_CTR_ENCRYPT (AES_CR_CHMOD_1) |
mbed_official | 181:a4cbdfbbd2f4 | 159 | #define CRYP_CR_ALGOMODE_AES_CTR_DECRYPT ((uint32_t)(AES_CR_CHMOD_1 | AES_CR_MODE_1)) |
mbed_official | 181:a4cbdfbbd2f4 | 160 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 161 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 162 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 163 | |
mbed_official | 181:a4cbdfbbd2f4 | 164 | /** @defgroup AES_Interrupts |
mbed_official | 181:a4cbdfbbd2f4 | 165 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 166 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 167 | #define AES_IT_CC AES_CR_CCIE /*!< Computation Complete interrupt */ |
mbed_official | 181:a4cbdfbbd2f4 | 168 | #define AES_IT_ERR AES_CR_ERRIE /*!< Error interrupt */ |
mbed_official | 181:a4cbdfbbd2f4 | 169 | |
mbed_official | 181:a4cbdfbbd2f4 | 170 | #define IS_AES_IT(IT) ((((IT) & (uint32_t)0xFFFFF9FF) == 0x00000000) && ((IT) != 0x00000000)) |
mbed_official | 181:a4cbdfbbd2f4 | 171 | #define IS_AES_GET_IT(IT) (((IT) == AES_IT_CC) || ((IT) == AES_IT_ERR)) |
mbed_official | 181:a4cbdfbbd2f4 | 172 | |
mbed_official | 181:a4cbdfbbd2f4 | 173 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 174 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 175 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 176 | |
mbed_official | 181:a4cbdfbbd2f4 | 177 | |
mbed_official | 181:a4cbdfbbd2f4 | 178 | /** @defgroup AES_Flags |
mbed_official | 181:a4cbdfbbd2f4 | 179 | * @{ |
mbed_official | 181:a4cbdfbbd2f4 | 180 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 181 | #define AES_FLAG_CCF AES_SR_CCF /*!< Computation Complete Flag */ |
mbed_official | 181:a4cbdfbbd2f4 | 182 | #define AES_FLAG_RDERR AES_SR_RDERR /*!< Read Error Flag */ |
mbed_official | 181:a4cbdfbbd2f4 | 183 | #define AES_FLAG_WRERR AES_SR_WRERR /*!< Write Error Flag */ |
mbed_official | 181:a4cbdfbbd2f4 | 184 | |
mbed_official | 181:a4cbdfbbd2f4 | 185 | #define IS_AES_FLAG(FLAG) (((FLAG) == AES_FLAG_CCF) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 186 | ((FLAG) == AES_FLAG_RDERR) || \ |
mbed_official | 181:a4cbdfbbd2f4 | 187 | ((FLAG) == AES_FLAG_WRERR)) |
mbed_official | 181:a4cbdfbbd2f4 | 188 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 189 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 190 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 191 | |
mbed_official | 181:a4cbdfbbd2f4 | 192 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 193 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 194 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 195 | |
mbed_official | 181:a4cbdfbbd2f4 | 196 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 197 | |
mbed_official | 181:a4cbdfbbd2f4 | 198 | /** @brief Reset CRYP handle state |
mbed_official | 181:a4cbdfbbd2f4 | 199 | * @param __HANDLE__: specifies the CRYP Handle. |
mbed_official | 181:a4cbdfbbd2f4 | 200 | * @retval None |
mbed_official | 181:a4cbdfbbd2f4 | 201 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 202 | #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRYP_STATE_RESET) |
mbed_official | 181:a4cbdfbbd2f4 | 203 | |
mbed_official | 181:a4cbdfbbd2f4 | 204 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 205 | * @brief Enable/Disable the CRYP peripheral. |
mbed_official | 181:a4cbdfbbd2f4 | 206 | * @param None |
mbed_official | 181:a4cbdfbbd2f4 | 207 | * @retval None |
mbed_official | 181:a4cbdfbbd2f4 | 208 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 209 | #define __HAL_CRYP_ENABLE() (AES->CR |= AES_CR_EN) |
mbed_official | 181:a4cbdfbbd2f4 | 210 | #define __HAL_CRYP_DISABLE() (AES->CR &= ~AES_CR_EN) |
mbed_official | 181:a4cbdfbbd2f4 | 211 | |
mbed_official | 181:a4cbdfbbd2f4 | 212 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 213 | * @brief Set the algorithm mode: AES-ECB, AES-CBC, AES-CTR, DES-ECB, DES-CBC,... |
mbed_official | 181:a4cbdfbbd2f4 | 214 | * @param MODE: The algorithm mode. |
mbed_official | 181:a4cbdfbbd2f4 | 215 | * @retval None |
mbed_official | 181:a4cbdfbbd2f4 | 216 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 217 | #define __HAL_CRYP_SET_MODE(MODE) (AES->CR |= (uint32_t)(MODE)) |
mbed_official | 181:a4cbdfbbd2f4 | 218 | |
mbed_official | 181:a4cbdfbbd2f4 | 219 | |
mbed_official | 181:a4cbdfbbd2f4 | 220 | /** @brief Check whether the specified CRYP flag is set or not. |
mbed_official | 181:a4cbdfbbd2f4 | 221 | * @param __FLAG__: specifies the flag to check. |
mbed_official | 181:a4cbdfbbd2f4 | 222 | * This parameter can be one of the following values: |
mbed_official | 181:a4cbdfbbd2f4 | 223 | * @arg AES_FLAG_CCF : Computation Complete Flag |
mbed_official | 181:a4cbdfbbd2f4 | 224 | * @arg AES_FLAG_RDERR : Read Error Flag |
mbed_official | 181:a4cbdfbbd2f4 | 225 | * @arg AES_FLAG_WRERR : Write Error Flag |
mbed_official | 181:a4cbdfbbd2f4 | 226 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
mbed_official | 181:a4cbdfbbd2f4 | 227 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 228 | #define __HAL_CRYP_GET_FLAG(__FLAG__) ((AES->SR & (__FLAG__)) == (__FLAG__)) |
mbed_official | 181:a4cbdfbbd2f4 | 229 | |
mbed_official | 181:a4cbdfbbd2f4 | 230 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 231 | * @brief Enable the CRYP interrupt. |
mbed_official | 181:a4cbdfbbd2f4 | 232 | * @param __INTERRUPT__: CRYP Interrupt. |
mbed_official | 181:a4cbdfbbd2f4 | 233 | * @retval None |
mbed_official | 181:a4cbdfbbd2f4 | 234 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 235 | #define __HAL_CRYP_ENABLE_IT(__INTERRUPT__) ((AES->CR) |= (__INTERRUPT__)) |
mbed_official | 181:a4cbdfbbd2f4 | 236 | |
mbed_official | 181:a4cbdfbbd2f4 | 237 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 238 | * @brief Disable the CRYP interrupt. |
mbed_official | 181:a4cbdfbbd2f4 | 239 | * @param __INTERRUPT__: CRYP interrupt. |
mbed_official | 181:a4cbdfbbd2f4 | 240 | * @retval None |
mbed_official | 181:a4cbdfbbd2f4 | 241 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 242 | #define __HAL_CRYP_DISABLE_IT(__INTERRUPT__) ((AES->CR) &= ~(__INTERRUPT__)) |
mbed_official | 181:a4cbdfbbd2f4 | 243 | |
mbed_official | 181:a4cbdfbbd2f4 | 244 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 181:a4cbdfbbd2f4 | 245 | |
mbed_official | 181:a4cbdfbbd2f4 | 246 | /* Initialization/de-initialization functions *********************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 247 | HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 248 | HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 249 | |
mbed_official | 181:a4cbdfbbd2f4 | 250 | /* AES encryption/decryption using polling ***********************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 251 | HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 252 | HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 253 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 254 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 255 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 256 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); |
mbed_official | 181:a4cbdfbbd2f4 | 257 | |
mbed_official | 181:a4cbdfbbd2f4 | 258 | /* AES encryption/decryption using interrupt *********************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 259 | HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 260 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 261 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 262 | HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 263 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 264 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 265 | |
mbed_official | 181:a4cbdfbbd2f4 | 266 | /* AES encryption/decryption using DMA ***************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 267 | HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 268 | HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 269 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 270 | HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 271 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); |
mbed_official | 181:a4cbdfbbd2f4 | 272 | HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); |
mbed_official | 181:a4cbdfbbd2f4 | 273 | |
mbed_official | 181:a4cbdfbbd2f4 | 274 | /* Processing functions ********************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 275 | void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 276 | |
mbed_official | 181:a4cbdfbbd2f4 | 277 | /* Peripheral State functions **************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 278 | HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 279 | |
mbed_official | 181:a4cbdfbbd2f4 | 280 | /* MSP functions *************************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 281 | void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 282 | void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 283 | |
mbed_official | 181:a4cbdfbbd2f4 | 284 | /* CallBack functions ********************************************************/ |
mbed_official | 181:a4cbdfbbd2f4 | 285 | void HAL_CRYP_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 286 | void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 287 | void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 288 | void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp); |
mbed_official | 181:a4cbdfbbd2f4 | 289 | |
mbed_official | 181:a4cbdfbbd2f4 | 290 | #endif /* STM32L051xx && STM32L052xx && STM32L053xx*/ |
mbed_official | 181:a4cbdfbbd2f4 | 291 | |
mbed_official | 181:a4cbdfbbd2f4 | 292 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 293 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 294 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 295 | |
mbed_official | 181:a4cbdfbbd2f4 | 296 | /** |
mbed_official | 181:a4cbdfbbd2f4 | 297 | * @} |
mbed_official | 181:a4cbdfbbd2f4 | 298 | */ |
mbed_official | 181:a4cbdfbbd2f4 | 299 | |
mbed_official | 181:a4cbdfbbd2f4 | 300 | #ifdef __cplusplus |
mbed_official | 181:a4cbdfbbd2f4 | 301 | } |
mbed_official | 181:a4cbdfbbd2f4 | 302 | #endif |
mbed_official | 181:a4cbdfbbd2f4 | 303 | |
mbed_official | 181:a4cbdfbbd2f4 | 304 | #endif /* __STM32L0xx_HAL_CRYP_H */ |
mbed_official | 181:a4cbdfbbd2f4 | 305 | |
mbed_official | 181:a4cbdfbbd2f4 | 306 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |