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