mbed official / mbed-dev

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Thu Jul 06 15:42:05 2017 +0100
Revision:
168:9672193075cf
Parent:
161:2cc1468da177
Child:
182:a56a73fd2a6f
This updates the lib to the mbed lib v 146

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32f7xx_hal_cryp.h
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
AnnaBridge 168:9672193075cf 5 * @version V1.2.2
AnnaBridge 168:9672193075cf 6 * @date 14-April-2017
<> 144:ef7eb2e8f9f7 7 * @brief Header file of CRYP HAL module.
<> 144:ef7eb2e8f9f7 8 ******************************************************************************
<> 144:ef7eb2e8f9f7 9 * @attention
<> 144:ef7eb2e8f9f7 10 *
AnnaBridge 168:9672193075cf 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 12 *
<> 144:ef7eb2e8f9f7 13 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 14 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 15 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 16 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 18 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 19 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 21 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 22 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 23 *
<> 144:ef7eb2e8f9f7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 34 *
<> 144:ef7eb2e8f9f7 35 ******************************************************************************
<> 144:ef7eb2e8f9f7 36 */
<> 144:ef7eb2e8f9f7 37
<> 144:ef7eb2e8f9f7 38 /* Define to prevent recursive inclusion -------------------------------------*/
<> 144:ef7eb2e8f9f7 39 #ifndef __STM32F7xx_HAL_CRYP_H
<> 144:ef7eb2e8f9f7 40 #define __STM32F7xx_HAL_CRYP_H
<> 144:ef7eb2e8f9f7 41
<> 144:ef7eb2e8f9f7 42 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 43 extern "C" {
<> 144:ef7eb2e8f9f7 44 #endif
<> 144:ef7eb2e8f9f7 45
<> 144:ef7eb2e8f9f7 46 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 47 #include "stm32f7xx_hal_def.h"
<> 144:ef7eb2e8f9f7 48
<> 157:ff67d9f36b67 49 #if defined (CRYP)
<> 144:ef7eb2e8f9f7 50 /** @addtogroup STM32F7xx_HAL_Driver
<> 144:ef7eb2e8f9f7 51 * @{
<> 144:ef7eb2e8f9f7 52 */
<> 144:ef7eb2e8f9f7 53
<> 144:ef7eb2e8f9f7 54 /** @addtogroup CRYP
<> 144:ef7eb2e8f9f7 55 * @{
<> 144:ef7eb2e8f9f7 56 */
<> 144:ef7eb2e8f9f7 57
<> 144:ef7eb2e8f9f7 58 /* Exported types ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 59
<> 144:ef7eb2e8f9f7 60 /** @defgroup CRYP_Exported_Types CRYP Exported Types
<> 144:ef7eb2e8f9f7 61 * @{
<> 144:ef7eb2e8f9f7 62 */
<> 144:ef7eb2e8f9f7 63
<> 144:ef7eb2e8f9f7 64 /** @defgroup CRYP_Exported_Types_Group1 CRYP Configuration Structure definition
<> 144:ef7eb2e8f9f7 65 * @{
<> 144:ef7eb2e8f9f7 66 */
<> 144:ef7eb2e8f9f7 67
<> 144:ef7eb2e8f9f7 68 typedef struct
<> 144:ef7eb2e8f9f7 69 {
<> 144:ef7eb2e8f9f7 70 uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
<> 144:ef7eb2e8f9f7 71 This parameter can be a value of @ref CRYP_Data_Type */
<> 144:ef7eb2e8f9f7 72
<> 144:ef7eb2e8f9f7 73 uint32_t KeySize; /*!< Used only in AES mode only : 128, 192 or 256 bit key length.
<> 144:ef7eb2e8f9f7 74 This parameter can be a value of @ref CRYP_Key_Size */
<> 144:ef7eb2e8f9f7 75
<> 144:ef7eb2e8f9f7 76 uint8_t* pKey; /*!< The key used for encryption/decryption */
<> 144:ef7eb2e8f9f7 77
<> 144:ef7eb2e8f9f7 78 uint8_t* pInitVect; /*!< The initialization vector used also as initialization
<> 144:ef7eb2e8f9f7 79 counter in CTR mode */
<> 144:ef7eb2e8f9f7 80
<> 144:ef7eb2e8f9f7 81 uint8_t IVSize; /*!< The size of initialization vector.
<> 144:ef7eb2e8f9f7 82 This parameter (called nonce size in CCM) is used only
<> 144:ef7eb2e8f9f7 83 in AES-128/192/256 encryption/decryption CCM mode */
<> 144:ef7eb2e8f9f7 84
<> 144:ef7eb2e8f9f7 85 uint8_t TagSize; /*!< The size of returned authentication TAG.
<> 144:ef7eb2e8f9f7 86 This parameter is used only in AES-128/192/256
<> 144:ef7eb2e8f9f7 87 encryption/decryption CCM mode */
<> 144:ef7eb2e8f9f7 88
<> 144:ef7eb2e8f9f7 89 uint8_t* Header; /*!< The header used in GCM and CCM modes */
<> 144:ef7eb2e8f9f7 90
<> 144:ef7eb2e8f9f7 91 uint32_t HeaderSize; /*!< The size of header buffer in bytes */
<> 144:ef7eb2e8f9f7 92
<> 144:ef7eb2e8f9f7 93 uint8_t* pScratch; /*!< Scratch buffer used to append the header. It's size must be equal to header size + 21 bytes.
<> 144:ef7eb2e8f9f7 94 This parameter is used only in AES-128/192/256 encryption/decryption CCM mode */
<> 144:ef7eb2e8f9f7 95 }CRYP_InitTypeDef;
<> 144:ef7eb2e8f9f7 96
<> 144:ef7eb2e8f9f7 97 /**
<> 144:ef7eb2e8f9f7 98 * @}
<> 144:ef7eb2e8f9f7 99 */
<> 144:ef7eb2e8f9f7 100
<> 144:ef7eb2e8f9f7 101 /** @defgroup CRYP_Exported_Types_Group2 CRYP State structures definition
<> 144:ef7eb2e8f9f7 102 * @{
<> 144:ef7eb2e8f9f7 103 */
<> 144:ef7eb2e8f9f7 104
<> 144:ef7eb2e8f9f7 105
<> 144:ef7eb2e8f9f7 106 typedef enum
<> 144:ef7eb2e8f9f7 107 {
<> 144:ef7eb2e8f9f7 108 HAL_CRYP_STATE_RESET = 0x00U, /*!< CRYP not yet initialized or disabled */
<> 144:ef7eb2e8f9f7 109 HAL_CRYP_STATE_READY = 0x01U, /*!< CRYP initialized and ready for use */
<> 144:ef7eb2e8f9f7 110 HAL_CRYP_STATE_BUSY = 0x02U, /*!< CRYP internal processing is ongoing */
<> 144:ef7eb2e8f9f7 111 HAL_CRYP_STATE_TIMEOUT = 0x03U, /*!< CRYP timeout state */
<> 144:ef7eb2e8f9f7 112 HAL_CRYP_STATE_ERROR = 0x04U /*!< CRYP error state */
<> 144:ef7eb2e8f9f7 113 }HAL_CRYP_STATETypeDef;
<> 144:ef7eb2e8f9f7 114
<> 144:ef7eb2e8f9f7 115 /**
<> 144:ef7eb2e8f9f7 116 * @}
<> 144:ef7eb2e8f9f7 117 */
<> 144:ef7eb2e8f9f7 118
<> 144:ef7eb2e8f9f7 119 /** @defgroup CRYP_Exported_Types_Group3 CRYP phase structures definition
<> 144:ef7eb2e8f9f7 120 * @{
<> 144:ef7eb2e8f9f7 121 */
<> 144:ef7eb2e8f9f7 122
<> 144:ef7eb2e8f9f7 123
<> 144:ef7eb2e8f9f7 124 typedef enum
<> 144:ef7eb2e8f9f7 125 {
<> 144:ef7eb2e8f9f7 126 HAL_CRYP_PHASE_READY = 0x01U, /*!< CRYP peripheral is ready for initialization. */
<> 144:ef7eb2e8f9f7 127 HAL_CRYP_PHASE_PROCESS = 0x02U, /*!< CRYP peripheral is in processing phase */
<> 144:ef7eb2e8f9f7 128 HAL_CRYP_PHASE_FINAL = 0x03U /*!< CRYP peripheral is in final phase
<> 144:ef7eb2e8f9f7 129 This is relevant only with CCM and GCM modes */
<> 144:ef7eb2e8f9f7 130 }HAL_PhaseTypeDef;
<> 144:ef7eb2e8f9f7 131
<> 144:ef7eb2e8f9f7 132 /**
<> 144:ef7eb2e8f9f7 133 * @}
<> 144:ef7eb2e8f9f7 134 */
<> 144:ef7eb2e8f9f7 135
<> 144:ef7eb2e8f9f7 136 /** @defgroup CRYP_Exported_Types_Group4 CRYP handle Structure definition
<> 144:ef7eb2e8f9f7 137 * @{
<> 144:ef7eb2e8f9f7 138 */
<> 144:ef7eb2e8f9f7 139
<> 144:ef7eb2e8f9f7 140 typedef struct
<> 144:ef7eb2e8f9f7 141 {
<> 144:ef7eb2e8f9f7 142 CRYP_TypeDef *Instance; /*!< CRYP registers base address */
<> 144:ef7eb2e8f9f7 143
<> 144:ef7eb2e8f9f7 144 CRYP_InitTypeDef Init; /*!< CRYP required parameters */
<> 144:ef7eb2e8f9f7 145
<> 144:ef7eb2e8f9f7 146 uint8_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
<> 144:ef7eb2e8f9f7 147
<> 144:ef7eb2e8f9f7 148 uint8_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
<> 144:ef7eb2e8f9f7 149
<> 144:ef7eb2e8f9f7 150 __IO uint16_t CrypInCount; /*!< Counter of input data */
<> 144:ef7eb2e8f9f7 151
<> 144:ef7eb2e8f9f7 152 __IO uint16_t CrypOutCount; /*!< Counter of output data */
<> 144:ef7eb2e8f9f7 153
<> 144:ef7eb2e8f9f7 154 HAL_StatusTypeDef Status; /*!< CRYP peripheral status */
<> 144:ef7eb2e8f9f7 155
<> 144:ef7eb2e8f9f7 156 HAL_PhaseTypeDef Phase; /*!< CRYP peripheral phase */
<> 144:ef7eb2e8f9f7 157
<> 144:ef7eb2e8f9f7 158 DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */
<> 144:ef7eb2e8f9f7 159
<> 144:ef7eb2e8f9f7 160 DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */
<> 144:ef7eb2e8f9f7 161
<> 144:ef7eb2e8f9f7 162 HAL_LockTypeDef Lock; /*!< CRYP locking object */
<> 144:ef7eb2e8f9f7 163
<> 144:ef7eb2e8f9f7 164 __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */
<> 144:ef7eb2e8f9f7 165 }CRYP_HandleTypeDef;
<> 144:ef7eb2e8f9f7 166
<> 144:ef7eb2e8f9f7 167 /**
<> 144:ef7eb2e8f9f7 168 * @}
<> 144:ef7eb2e8f9f7 169 */
<> 144:ef7eb2e8f9f7 170
<> 144:ef7eb2e8f9f7 171 /**
<> 144:ef7eb2e8f9f7 172 * @}
<> 144:ef7eb2e8f9f7 173 */
<> 144:ef7eb2e8f9f7 174
<> 144:ef7eb2e8f9f7 175 /* Exported constants --------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 176 /** @defgroup CRYP_Exported_Constants CRYP Exported Constants
<> 144:ef7eb2e8f9f7 177 * @{
<> 144:ef7eb2e8f9f7 178 */
<> 144:ef7eb2e8f9f7 179
<> 144:ef7eb2e8f9f7 180 /** @defgroup CRYP_Key_Size CRYP Key Size
<> 144:ef7eb2e8f9f7 181 * @{
<> 144:ef7eb2e8f9f7 182 */
<> 144:ef7eb2e8f9f7 183 #define CRYP_KEYSIZE_128B ((uint32_t)0x00000000U)
<> 144:ef7eb2e8f9f7 184 #define CRYP_KEYSIZE_192B CRYP_CR_KEYSIZE_0
<> 144:ef7eb2e8f9f7 185 #define CRYP_KEYSIZE_256B CRYP_CR_KEYSIZE_1
<> 144:ef7eb2e8f9f7 186 /**
<> 144:ef7eb2e8f9f7 187 * @}
<> 144:ef7eb2e8f9f7 188 */
<> 144:ef7eb2e8f9f7 189
<> 144:ef7eb2e8f9f7 190 /** @defgroup CRYP_Data_Type CRYP Data Type
<> 144:ef7eb2e8f9f7 191 * @{
<> 144:ef7eb2e8f9f7 192 */
<> 144:ef7eb2e8f9f7 193 #define CRYP_DATATYPE_32B ((uint32_t)0x00000000U)
<> 144:ef7eb2e8f9f7 194 #define CRYP_DATATYPE_16B CRYP_CR_DATATYPE_0
<> 144:ef7eb2e8f9f7 195 #define CRYP_DATATYPE_8B CRYP_CR_DATATYPE_1
<> 144:ef7eb2e8f9f7 196 #define CRYP_DATATYPE_1B CRYP_CR_DATATYPE
<> 144:ef7eb2e8f9f7 197 /**
<> 144:ef7eb2e8f9f7 198 * @}
<> 144:ef7eb2e8f9f7 199 */
<> 144:ef7eb2e8f9f7 200
<> 144:ef7eb2e8f9f7 201 /** @defgroup CRYP_Exported_Constants_Group3 CRYP CRYP_AlgoModeDirection
<> 144:ef7eb2e8f9f7 202 * @{
<> 144:ef7eb2e8f9f7 203 */
<> 144:ef7eb2e8f9f7 204 #define CRYP_CR_ALGOMODE_DIRECTION ((uint32_t)0x0008003CU)
<> 144:ef7eb2e8f9f7 205 #define CRYP_CR_ALGOMODE_TDES_ECB_ENCRYPT ((uint32_t)0x00000000U)
<> 144:ef7eb2e8f9f7 206 #define CRYP_CR_ALGOMODE_TDES_ECB_DECRYPT ((uint32_t)0x00000004U)
<> 144:ef7eb2e8f9f7 207 #define CRYP_CR_ALGOMODE_TDES_CBC_ENCRYPT ((uint32_t)0x00000008U)
<> 144:ef7eb2e8f9f7 208 #define CRYP_CR_ALGOMODE_TDES_CBC_DECRYPT ((uint32_t)0x0000000CU)
<> 144:ef7eb2e8f9f7 209 #define CRYP_CR_ALGOMODE_DES_ECB_ENCRYPT ((uint32_t)0x00000010U)
<> 144:ef7eb2e8f9f7 210 #define CRYP_CR_ALGOMODE_DES_ECB_DECRYPT ((uint32_t)0x00000014U)
<> 144:ef7eb2e8f9f7 211 #define CRYP_CR_ALGOMODE_DES_CBC_ENCRYPT ((uint32_t)0x00000018U)
<> 144:ef7eb2e8f9f7 212 #define CRYP_CR_ALGOMODE_DES_CBC_DECRYPT ((uint32_t)0x0000001CU)
<> 144:ef7eb2e8f9f7 213 #define CRYP_CR_ALGOMODE_AES_ECB_ENCRYPT ((uint32_t)0x00000020U)
<> 144:ef7eb2e8f9f7 214 #define CRYP_CR_ALGOMODE_AES_ECB_DECRYPT ((uint32_t)0x00000024U)
<> 144:ef7eb2e8f9f7 215 #define CRYP_CR_ALGOMODE_AES_CBC_ENCRYPT ((uint32_t)0x00000028U)
<> 144:ef7eb2e8f9f7 216 #define CRYP_CR_ALGOMODE_AES_CBC_DECRYPT ((uint32_t)0x0000002CU)
<> 144:ef7eb2e8f9f7 217 #define CRYP_CR_ALGOMODE_AES_CTR_ENCRYPT ((uint32_t)0x00000030U)
<> 144:ef7eb2e8f9f7 218 #define CRYP_CR_ALGOMODE_AES_CTR_DECRYPT ((uint32_t)0x00000034U)
<> 144:ef7eb2e8f9f7 219 /**
<> 144:ef7eb2e8f9f7 220 * @}
<> 144:ef7eb2e8f9f7 221 */
<> 144:ef7eb2e8f9f7 222
<> 144:ef7eb2e8f9f7 223 /** @defgroup CRYP_Exported_Constants_Group4 CRYP CRYP_Interrupt
<> 144:ef7eb2e8f9f7 224 * @{
<> 144:ef7eb2e8f9f7 225 */
<> 144:ef7eb2e8f9f7 226 #define CRYP_IT_INI ((uint32_t)CRYP_IMSCR_INIM) /*!< Input FIFO Interrupt */
<> 144:ef7eb2e8f9f7 227 #define CRYP_IT_OUTI ((uint32_t)CRYP_IMSCR_OUTIM) /*!< Output FIFO Interrupt */
<> 144:ef7eb2e8f9f7 228 /**
<> 144:ef7eb2e8f9f7 229 * @}
<> 144:ef7eb2e8f9f7 230 */
<> 144:ef7eb2e8f9f7 231
<> 144:ef7eb2e8f9f7 232 /** @defgroup CRYP_Exported_Constants_Group5 CRYP CRYP_Flags
<> 144:ef7eb2e8f9f7 233 * @{
<> 144:ef7eb2e8f9f7 234 */
<> 144:ef7eb2e8f9f7 235 #define CRYP_FLAG_BUSY ((uint32_t)0x00000010U) /*!< The CRYP core is currently
<> 144:ef7eb2e8f9f7 236 processing a block of data
<> 144:ef7eb2e8f9f7 237 or a key preparation (for
<> 144:ef7eb2e8f9f7 238 AES decryption). */
<> 144:ef7eb2e8f9f7 239 #define CRYP_FLAG_IFEM ((uint32_t)0x00000001U) /*!< Input FIFO is empty */
<> 144:ef7eb2e8f9f7 240 #define CRYP_FLAG_IFNF ((uint32_t)0x00000002U) /*!< Input FIFO is not Full */
<> 144:ef7eb2e8f9f7 241 #define CRYP_FLAG_OFNE ((uint32_t)0x00000004U) /*!< Output FIFO is not empty */
<> 144:ef7eb2e8f9f7 242 #define CRYP_FLAG_OFFU ((uint32_t)0x00000008U) /*!< Output FIFO is Full */
<> 144:ef7eb2e8f9f7 243 #define CRYP_FLAG_OUTRIS ((uint32_t)0x01000002U) /*!< Output FIFO service raw
<> 144:ef7eb2e8f9f7 244 interrupt status */
<> 144:ef7eb2e8f9f7 245 #define CRYP_FLAG_INRIS ((uint32_t)0x01000001U) /*!< Input FIFO service raw
<> 144:ef7eb2e8f9f7 246 interrupt status */
<> 144:ef7eb2e8f9f7 247 /**
<> 144:ef7eb2e8f9f7 248 * @}
<> 144:ef7eb2e8f9f7 249 */
<> 144:ef7eb2e8f9f7 250
<> 144:ef7eb2e8f9f7 251 /**
<> 144:ef7eb2e8f9f7 252 * @}
<> 144:ef7eb2e8f9f7 253 */
<> 144:ef7eb2e8f9f7 254
<> 144:ef7eb2e8f9f7 255 /* Exported macro ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 256 /** @defgroup CRYP_Exported_Macros CRYP Exported Macros
<> 144:ef7eb2e8f9f7 257 * @{
<> 144:ef7eb2e8f9f7 258 */
<> 144:ef7eb2e8f9f7 259
<> 144:ef7eb2e8f9f7 260 /** @brief Reset CRYP handle state
<> 144:ef7eb2e8f9f7 261 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 262 * @retval None
<> 144:ef7eb2e8f9f7 263 */
<> 144:ef7eb2e8f9f7 264 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRYP_STATE_RESET)
<> 144:ef7eb2e8f9f7 265
<> 144:ef7eb2e8f9f7 266 /**
<> 144:ef7eb2e8f9f7 267 * @brief Enable/Disable the CRYP peripheral.
<> 144:ef7eb2e8f9f7 268 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 269 * @retval None
<> 144:ef7eb2e8f9f7 270 */
<> 144:ef7eb2e8f9f7 271 #define __HAL_CRYP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRYP_CR_CRYPEN)
<> 144:ef7eb2e8f9f7 272 #define __HAL_CRYP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CRYP_CR_CRYPEN)
<> 144:ef7eb2e8f9f7 273
<> 144:ef7eb2e8f9f7 274 /**
<> 144:ef7eb2e8f9f7 275 * @brief Flush the data FIFO.
<> 144:ef7eb2e8f9f7 276 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 277 * @retval None
<> 144:ef7eb2e8f9f7 278 */
<> 144:ef7eb2e8f9f7 279 #define __HAL_CRYP_FIFO_FLUSH(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRYP_CR_FFLUSH)
<> 144:ef7eb2e8f9f7 280
<> 144:ef7eb2e8f9f7 281 /**
<> 144:ef7eb2e8f9f7 282 * @brief Set the algorithm mode: AES-ECB, AES-CBC, AES-CTR, DES-ECB, DES-CBC.
<> 144:ef7eb2e8f9f7 283 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 284 * @param MODE: The algorithm mode.
<> 144:ef7eb2e8f9f7 285 * @retval None
<> 144:ef7eb2e8f9f7 286 */
<> 144:ef7eb2e8f9f7 287 #define __HAL_CRYP_SET_MODE(__HANDLE__, MODE) ((__HANDLE__)->Instance->CR |= (uint32_t)(MODE))
<> 144:ef7eb2e8f9f7 288
<> 144:ef7eb2e8f9f7 289 /** @brief Check whether the specified CRYP flag is set or not.
<> 144:ef7eb2e8f9f7 290 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 291 * @param __FLAG__: specifies the flag to check.
<> 144:ef7eb2e8f9f7 292 * This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 293 * @arg CRYP_FLAG_BUSY: The CRYP core is currently processing a block of data
<> 144:ef7eb2e8f9f7 294 * or a key preparation (for AES decryption).
<> 144:ef7eb2e8f9f7 295 * @arg CRYP_FLAG_IFEM: Input FIFO is empty
<> 144:ef7eb2e8f9f7 296 * @arg CRYP_FLAG_IFNF: Input FIFO is not full
<> 144:ef7eb2e8f9f7 297 * @arg CRYP_FLAG_INRIS: Input FIFO service raw interrupt is pending
<> 144:ef7eb2e8f9f7 298 * @arg CRYP_FLAG_OFNE: Output FIFO is not empty
<> 144:ef7eb2e8f9f7 299 * @arg CRYP_FLAG_OFFU: Output FIFO is full
<> 144:ef7eb2e8f9f7 300 * @arg CRYP_FLAG_OUTRIS: Input FIFO service raw interrupt is pending
<> 144:ef7eb2e8f9f7 301 * @retval The new state of __FLAG__ (TRUE or FALSE).
<> 144:ef7eb2e8f9f7 302 */
<> 144:ef7eb2e8f9f7 303
<> 144:ef7eb2e8f9f7 304 #define __HAL_CRYP_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 24)) == 0x01U)?((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)): \
<> 144:ef7eb2e8f9f7 305 ((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)))
<> 144:ef7eb2e8f9f7 306
<> 144:ef7eb2e8f9f7 307 /** @brief Check whether the specified CRYP interrupt is set or not.
<> 144:ef7eb2e8f9f7 308 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 309 * @param __INTERRUPT__: specifies the interrupt to check.
<> 144:ef7eb2e8f9f7 310 * This parameter can be one of the following values:
<> 144:ef7eb2e8f9f7 311 * @arg CRYP_IT_INRIS: Input FIFO service raw interrupt is pending
<> 144:ef7eb2e8f9f7 312 * @arg CRYP_IT_OUTRIS: Output FIFO service raw interrupt is pending
<> 144:ef7eb2e8f9f7 313 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
<> 144:ef7eb2e8f9f7 314 */
<> 144:ef7eb2e8f9f7 315 #define __HAL_CRYP_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) == (__INTERRUPT__))
<> 144:ef7eb2e8f9f7 316
<> 144:ef7eb2e8f9f7 317 /**
<> 144:ef7eb2e8f9f7 318 * @brief Enable the CRYP interrupt.
<> 144:ef7eb2e8f9f7 319 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 320 * @param __INTERRUPT__: CRYP Interrupt.
<> 144:ef7eb2e8f9f7 321 * @retval None
<> 144:ef7eb2e8f9f7 322 */
<> 144:ef7eb2e8f9f7 323 #define __HAL_CRYP_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) |= (__INTERRUPT__))
<> 144:ef7eb2e8f9f7 324
<> 144:ef7eb2e8f9f7 325 /**
<> 144:ef7eb2e8f9f7 326 * @brief Disable the CRYP interrupt.
<> 144:ef7eb2e8f9f7 327 * @param __HANDLE__: specifies the CRYP handle.
<> 144:ef7eb2e8f9f7 328 * @param __INTERRUPT__: CRYP interrupt.
<> 144:ef7eb2e8f9f7 329 * @retval None
<> 144:ef7eb2e8f9f7 330 */
<> 144:ef7eb2e8f9f7 331 #define __HAL_CRYP_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) &= ~(__INTERRUPT__))
<> 144:ef7eb2e8f9f7 332
<> 144:ef7eb2e8f9f7 333 /**
<> 144:ef7eb2e8f9f7 334 * @}
<> 144:ef7eb2e8f9f7 335 */
<> 144:ef7eb2e8f9f7 336
<> 144:ef7eb2e8f9f7 337 /* Include CRYP HAL Extension module */
<> 144:ef7eb2e8f9f7 338 #include "stm32f7xx_hal_cryp_ex.h"
<> 144:ef7eb2e8f9f7 339
<> 144:ef7eb2e8f9f7 340 /* Exported functions --------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 341 /** @defgroup CRYP_Exported_Functions CRYP Exported Functions
<> 144:ef7eb2e8f9f7 342 * @{
<> 144:ef7eb2e8f9f7 343 */
<> 144:ef7eb2e8f9f7 344
<> 144:ef7eb2e8f9f7 345 /** @addtogroup CRYP_Exported_Functions_Group1
<> 144:ef7eb2e8f9f7 346 * @{
<> 144:ef7eb2e8f9f7 347 */
<> 144:ef7eb2e8f9f7 348 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 349 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 350 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 351 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 352 /**
<> 144:ef7eb2e8f9f7 353 * @}
<> 144:ef7eb2e8f9f7 354 */
<> 144:ef7eb2e8f9f7 355
<> 144:ef7eb2e8f9f7 356 /** @addtogroup CRYP_Exported_Functions_Group2
<> 144:ef7eb2e8f9f7 357 * @{
<> 144:ef7eb2e8f9f7 358 */
<> 144:ef7eb2e8f9f7 359 /* AES encryption/decryption using polling ***********************************/
<> 144:ef7eb2e8f9f7 360 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 361 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 362 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 363 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 364 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 365 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 366
<> 144:ef7eb2e8f9f7 367 /* AES encryption/decryption using interrupt *********************************/
<> 144:ef7eb2e8f9f7 368 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 369 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 370 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 371 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 372 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 373 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 374
<> 144:ef7eb2e8f9f7 375 /* AES encryption/decryption using DMA ***************************************/
<> 144:ef7eb2e8f9f7 376 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 377 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 378 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 379 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 380 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 381 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 382 /**
<> 144:ef7eb2e8f9f7 383 * @}
<> 144:ef7eb2e8f9f7 384 */
<> 144:ef7eb2e8f9f7 385
<> 144:ef7eb2e8f9f7 386 /** @addtogroup CRYP_Exported_Functions_Group3
<> 144:ef7eb2e8f9f7 387 * @{
<> 144:ef7eb2e8f9f7 388 */
<> 144:ef7eb2e8f9f7 389 /* DES encryption/decryption using polling ***********************************/
<> 144:ef7eb2e8f9f7 390 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 391 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 392 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 393 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 394
<> 144:ef7eb2e8f9f7 395 /* DES encryption/decryption using interrupt *********************************/
<> 144:ef7eb2e8f9f7 396 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 397 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 398 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 399 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 400
<> 144:ef7eb2e8f9f7 401 /* DES encryption/decryption using DMA ***************************************/
<> 144:ef7eb2e8f9f7 402 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 403 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 404 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 405 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 406 /**
<> 144:ef7eb2e8f9f7 407 * @}
<> 144:ef7eb2e8f9f7 408 */
<> 144:ef7eb2e8f9f7 409
<> 144:ef7eb2e8f9f7 410 /** @addtogroup CRYP_Exported_Functions_Group4
<> 144:ef7eb2e8f9f7 411 * @{
<> 144:ef7eb2e8f9f7 412 */
<> 144:ef7eb2e8f9f7 413 /* TDES encryption/decryption using polling **********************************/
<> 144:ef7eb2e8f9f7 414 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 415 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 416 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 417 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 144:ef7eb2e8f9f7 418
<> 144:ef7eb2e8f9f7 419 /* TDES encryption/decryption using interrupt ********************************/
<> 144:ef7eb2e8f9f7 420 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 421 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 422 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 423 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 424
<> 144:ef7eb2e8f9f7 425 /* TDES encryption/decryption using DMA **************************************/
<> 144:ef7eb2e8f9f7 426 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 427 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 428 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 144:ef7eb2e8f9f7 429 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 144:ef7eb2e8f9f7 430 /**
<> 144:ef7eb2e8f9f7 431 * @}
<> 144:ef7eb2e8f9f7 432 */
<> 144:ef7eb2e8f9f7 433
<> 144:ef7eb2e8f9f7 434 /** @addtogroup CRYP_Exported_Functions_Group5
<> 144:ef7eb2e8f9f7 435 * @{
<> 144:ef7eb2e8f9f7 436 */
<> 144:ef7eb2e8f9f7 437 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 438 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 439 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 440 /**
<> 144:ef7eb2e8f9f7 441 * @}
<> 144:ef7eb2e8f9f7 442 */
<> 144:ef7eb2e8f9f7 443
<> 144:ef7eb2e8f9f7 444 /** @addtogroup CRYP_Exported_Functions_Group6
<> 144:ef7eb2e8f9f7 445 * @{
<> 144:ef7eb2e8f9f7 446 */
<> 144:ef7eb2e8f9f7 447 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 448 /**
<> 144:ef7eb2e8f9f7 449 * @}
<> 144:ef7eb2e8f9f7 450 */
<> 144:ef7eb2e8f9f7 451
<> 144:ef7eb2e8f9f7 452 /** @addtogroup CRYP_Exported_Functions_Group7
<> 144:ef7eb2e8f9f7 453 * @{
<> 144:ef7eb2e8f9f7 454 */
<> 144:ef7eb2e8f9f7 455 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
<> 144:ef7eb2e8f9f7 456 /**
<> 144:ef7eb2e8f9f7 457 * @}
<> 144:ef7eb2e8f9f7 458 */
<> 144:ef7eb2e8f9f7 459
<> 144:ef7eb2e8f9f7 460 /**
<> 144:ef7eb2e8f9f7 461 * @}
<> 144:ef7eb2e8f9f7 462 */
<> 144:ef7eb2e8f9f7 463
<> 144:ef7eb2e8f9f7 464 /* Private types -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 465 /** @defgroup CRYP_Private_Types CRYP Private Types
<> 144:ef7eb2e8f9f7 466 * @{
<> 144:ef7eb2e8f9f7 467 */
<> 144:ef7eb2e8f9f7 468
<> 144:ef7eb2e8f9f7 469 /**
<> 144:ef7eb2e8f9f7 470 * @}
<> 144:ef7eb2e8f9f7 471 */
<> 144:ef7eb2e8f9f7 472
<> 144:ef7eb2e8f9f7 473 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 474 /** @defgroup CRYP_Private_Variables CRYP Private Variables
<> 144:ef7eb2e8f9f7 475 * @{
<> 144:ef7eb2e8f9f7 476 */
<> 144:ef7eb2e8f9f7 477
<> 144:ef7eb2e8f9f7 478 /**
<> 144:ef7eb2e8f9f7 479 * @}
<> 144:ef7eb2e8f9f7 480 */
<> 144:ef7eb2e8f9f7 481
<> 144:ef7eb2e8f9f7 482 /* Private constants ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 483 /** @defgroup CRYP_Private_Constants CRYP Private Constants
<> 144:ef7eb2e8f9f7 484 * @{
<> 144:ef7eb2e8f9f7 485 */
<> 144:ef7eb2e8f9f7 486 #define CRYP_FLAG_MASK ((uint32_t)0x0000001F)
<> 144:ef7eb2e8f9f7 487 /**
<> 144:ef7eb2e8f9f7 488 * @}
<> 144:ef7eb2e8f9f7 489 */
<> 144:ef7eb2e8f9f7 490
<> 144:ef7eb2e8f9f7 491 /* Private macros ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 492 /** @defgroup CRYP_Private_Macros CRYP Private Macros
<> 144:ef7eb2e8f9f7 493 * @{
<> 144:ef7eb2e8f9f7 494 */
<> 144:ef7eb2e8f9f7 495
<> 144:ef7eb2e8f9f7 496 #define IS_CRYP_KEYSIZE(__KEYSIZE__) (((__KEYSIZE__) == CRYP_KEYSIZE_128B) || \
<> 144:ef7eb2e8f9f7 497 ((__KEYSIZE__) == CRYP_KEYSIZE_192B) || \
<> 144:ef7eb2e8f9f7 498 ((__KEYSIZE__) == CRYP_KEYSIZE_256B))
<> 144:ef7eb2e8f9f7 499
<> 144:ef7eb2e8f9f7 500
<> 144:ef7eb2e8f9f7 501 #define IS_CRYP_DATATYPE(__DATATYPE__) (((__DATATYPE__) == CRYP_DATATYPE_32B) || \
<> 144:ef7eb2e8f9f7 502 ((__DATATYPE__) == CRYP_DATATYPE_16B) || \
<> 144:ef7eb2e8f9f7 503 ((__DATATYPE__) == CRYP_DATATYPE_8B) || \
<> 144:ef7eb2e8f9f7 504 ((__DATATYPE__) == CRYP_DATATYPE_1B))
<> 144:ef7eb2e8f9f7 505
<> 144:ef7eb2e8f9f7 506
<> 144:ef7eb2e8f9f7 507 /**
<> 144:ef7eb2e8f9f7 508 * @}
<> 144:ef7eb2e8f9f7 509 */
<> 144:ef7eb2e8f9f7 510
<> 144:ef7eb2e8f9f7 511 /* Private functions ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 512 /** @defgroup CRYP_Private_Functions CRYP Private Functions
<> 144:ef7eb2e8f9f7 513 * @{
<> 144:ef7eb2e8f9f7 514 */
<> 144:ef7eb2e8f9f7 515
<> 144:ef7eb2e8f9f7 516 /**
<> 144:ef7eb2e8f9f7 517 * @}
<> 144:ef7eb2e8f9f7 518 */
<> 144:ef7eb2e8f9f7 519
<> 144:ef7eb2e8f9f7 520 /**
<> 144:ef7eb2e8f9f7 521 * @}
<> 144:ef7eb2e8f9f7 522 */
<> 144:ef7eb2e8f9f7 523
<> 157:ff67d9f36b67 524 #endif /* CRYP */
<> 144:ef7eb2e8f9f7 525
<> 144:ef7eb2e8f9f7 526 /**
<> 144:ef7eb2e8f9f7 527 * @}
<> 144:ef7eb2e8f9f7 528 */
<> 144:ef7eb2e8f9f7 529
<> 161:2cc1468da177 530 #if defined (AES)
<> 161:2cc1468da177 531
<> 161:2cc1468da177 532 /** @addtogroup STM32F7xx_HAL_Driver
<> 161:2cc1468da177 533 * @{
<> 161:2cc1468da177 534 */
<> 161:2cc1468da177 535
<> 161:2cc1468da177 536 /** @addtogroup CRYP
<> 161:2cc1468da177 537 * @{
<> 161:2cc1468da177 538 */
<> 161:2cc1468da177 539
<> 161:2cc1468da177 540 /* Exported types ------------------------------------------------------------*/
<> 161:2cc1468da177 541 /** @defgroup CRYP_Exported_Types CRYP Exported Types
<> 161:2cc1468da177 542 * @{
<> 161:2cc1468da177 543 */
<> 161:2cc1468da177 544
<> 161:2cc1468da177 545 /**
<> 161:2cc1468da177 546 * @brief CRYP Configuration Structure definition
<> 161:2cc1468da177 547 */
<> 161:2cc1468da177 548 typedef struct
<> 161:2cc1468da177 549 {
<> 161:2cc1468da177 550 uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
<> 161:2cc1468da177 551 This parameter can be a value of @ref CRYP_Data_Type */
<> 161:2cc1468da177 552
<> 161:2cc1468da177 553 uint32_t KeySize; /*!< 128 or 256-bit key length.
<> 161:2cc1468da177 554 This parameter can be a value of @ref CRYP_Key_Size */
<> 161:2cc1468da177 555
<> 161:2cc1468da177 556 uint32_t OperatingMode; /*!< AES operating mode.
<> 161:2cc1468da177 557 This parameter can be a value of @ref CRYP_AES_OperatingMode */
<> 161:2cc1468da177 558
<> 161:2cc1468da177 559 uint32_t ChainingMode; /*!< AES chaining mode.
<> 161:2cc1468da177 560 This parameter can be a value of @ref CRYP_AES_ChainingMode */
<> 161:2cc1468da177 561
<> 161:2cc1468da177 562 uint32_t KeyWriteFlag; /*!< Allows to bypass or not key write-up before decryption.
<> 161:2cc1468da177 563 This parameter can be a value of @ref CRYP_Key_Write */
<> 161:2cc1468da177 564
<> 161:2cc1468da177 565 uint32_t GCMCMACPhase; /*!< Indicates the processing phase of the Galois Counter Mode (GCM),
<> 161:2cc1468da177 566 Galois Message Authentication Code (GMAC) or Cipher Message
<> 161:2cc1468da177 567 Authentication Code (CMAC) or Counter with Cipher Mode (CCM) when
<> 161:2cc1468da177 568 the latter is applicable.
<> 161:2cc1468da177 569 This parameter can be a value of @ref CRYP_GCM_CMAC_Phase */
<> 161:2cc1468da177 570
<> 161:2cc1468da177 571 uint8_t* pKey; /*!< Encryption/Decryption Key */
<> 161:2cc1468da177 572
<> 161:2cc1468da177 573 uint8_t* pInitVect; /*!< Initialization Vector used for CTR, CBC, GCM/GMAC, CMAC,
<> 161:2cc1468da177 574 (and CCM when applicable) modes */
<> 161:2cc1468da177 575
<> 161:2cc1468da177 576 uint8_t* Header; /*!< Header used in GCM/GMAC, CMAC (and CCM when applicable) modes */
<> 161:2cc1468da177 577
<> 161:2cc1468da177 578 uint64_t HeaderSize; /*!< Header size in bytes */
<> 161:2cc1468da177 579
<> 161:2cc1468da177 580 }CRYP_InitTypeDef;
<> 161:2cc1468da177 581
<> 161:2cc1468da177 582 /**
<> 161:2cc1468da177 583 * @brief HAL CRYP State structures definition
<> 161:2cc1468da177 584 */
<> 161:2cc1468da177 585 typedef enum
<> 161:2cc1468da177 586 {
<> 161:2cc1468da177 587 HAL_CRYP_STATE_RESET = 0x00, /*!< CRYP not yet initialized or disabled */
<> 161:2cc1468da177 588 HAL_CRYP_STATE_READY = 0x01, /*!< CRYP initialized and ready for use */
<> 161:2cc1468da177 589 HAL_CRYP_STATE_BUSY = 0x02, /*!< CRYP internal processing is ongoing */
<> 161:2cc1468da177 590 HAL_CRYP_STATE_TIMEOUT = 0x03, /*!< CRYP timeout state */
<> 161:2cc1468da177 591 HAL_CRYP_STATE_ERROR = 0x04, /*!< CRYP error state */
<> 161:2cc1468da177 592 HAL_CRYP_STATE_SUSPENDED = 0x05 /*!< CRYP suspended */
<> 161:2cc1468da177 593 }HAL_CRYP_STATETypeDef;
<> 161:2cc1468da177 594
<> 161:2cc1468da177 595 /**
<> 161:2cc1468da177 596 * @brief HAL CRYP phase structures definition
<> 161:2cc1468da177 597 */
<> 161:2cc1468da177 598 typedef enum
<> 161:2cc1468da177 599 {
<> 161:2cc1468da177 600 HAL_CRYP_PHASE_READY = 0x01, /*!< CRYP peripheral is ready for initialization. */
<> 161:2cc1468da177 601 HAL_CRYP_PHASE_PROCESS = 0x02, /*!< CRYP peripheral is in processing phase */
<> 161:2cc1468da177 602 HAL_CRYP_PHASE_START = 0x03, /*!< CRYP peripheral has been initialized but
<> 161:2cc1468da177 603 GCM/GMAC/CMAC(/CCM) initialization phase has not started */
<> 161:2cc1468da177 604 HAL_CRYP_PHASE_INIT_OVER = 0x04, /*!< GCM/GMAC/CMAC(/CCM) init phase has been carried out */
<> 161:2cc1468da177 605 HAL_CRYP_PHASE_HEADER_OVER = 0x05, /*!< GCM/GMAC/CMAC(/CCM) header phase has been carried out */
<> 161:2cc1468da177 606 HAL_CRYP_PHASE_PAYLOAD_OVER = 0x06, /*!< GCM(/CCM) payload phase has been carried out */
<> 161:2cc1468da177 607 HAL_CRYP_PHASE_FINAL_OVER = 0x07, /*!< GCM/GMAC/CMAC(/CCM) final phase has been carried out */
<> 161:2cc1468da177 608 HAL_CRYP_PHASE_HEADER_SUSPENDED = 0x08, /*!< GCM/GMAC/CMAC(/CCM) header phase has been suspended */
<> 161:2cc1468da177 609 HAL_CRYP_PHASE_PAYLOAD_SUSPENDED = 0x09, /*!< GCM(/CCM) payload phase has been suspended */
<> 161:2cc1468da177 610 HAL_CRYP_PHASE_NOT_USED = 0x0a /*!< Phase is irrelevant to the current chaining mode */
<> 161:2cc1468da177 611 }HAL_PhaseTypeDef;
<> 161:2cc1468da177 612
<> 161:2cc1468da177 613 /**
<> 161:2cc1468da177 614 * @brief HAL CRYP mode suspend definitions
<> 161:2cc1468da177 615 */
<> 161:2cc1468da177 616 typedef enum
<> 161:2cc1468da177 617 {
<> 161:2cc1468da177 618 HAL_CRYP_SUSPEND_NONE = 0x00, /*!< CRYP peripheral suspension not requested */
<> 161:2cc1468da177 619 HAL_CRYP_SUSPEND = 0x01 /*!< CRYP peripheral suspension requested */
<> 161:2cc1468da177 620 }HAL_SuspendTypeDef;
<> 161:2cc1468da177 621
<> 161:2cc1468da177 622
<> 161:2cc1468da177 623 /**
<> 161:2cc1468da177 624 * @brief HAL CRYP Error Codes definition
<> 161:2cc1468da177 625 */
<> 161:2cc1468da177 626 #define HAL_CRYP_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
<> 161:2cc1468da177 627 #define HAL_CRYP_WRITE_ERROR ((uint32_t)0x00000001) /*!< Write error */
<> 161:2cc1468da177 628 #define HAL_CRYP_READ_ERROR ((uint32_t)0x00000002) /*!< Read error */
<> 161:2cc1468da177 629 #define HAL_CRYP_DMA_ERROR ((uint32_t)0x00000004) /*!< DMA error */
<> 161:2cc1468da177 630 #define HAL_CRYP_BUSY_ERROR ((uint32_t)0x00000008) /*!< Busy flag error */
<> 161:2cc1468da177 631
<> 161:2cc1468da177 632 /**
<> 161:2cc1468da177 633 * @brief CRYP handle Structure definition
<> 161:2cc1468da177 634 */
<> 161:2cc1468da177 635 typedef struct
<> 161:2cc1468da177 636 {
<> 161:2cc1468da177 637 AES_TypeDef *Instance; /*!< Register base address */
<> 161:2cc1468da177 638
<> 161:2cc1468da177 639 CRYP_InitTypeDef Init; /*!< CRYP initialization parameters */
<> 161:2cc1468da177 640
<> 161:2cc1468da177 641 uint8_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) input buffer */
<> 161:2cc1468da177 642
<> 161:2cc1468da177 643 uint8_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) output buffer */
<> 161:2cc1468da177 644
<> 161:2cc1468da177 645 uint32_t CrypInCount; /*!< Input data size in bytes or, after suspension, the remaining
<> 161:2cc1468da177 646 number of bytes to process */
<> 161:2cc1468da177 647
<> 161:2cc1468da177 648 uint32_t CrypOutCount; /*!< Output data size in bytes */
<> 161:2cc1468da177 649
<> 161:2cc1468da177 650 HAL_PhaseTypeDef Phase; /*!< CRYP peripheral processing phase for GCM, GMAC, CMAC
<> 161:2cc1468da177 651 (or CCM when applicable) modes.
<> 161:2cc1468da177 652 Indicates the last phase carried out to ease
<> 161:2cc1468da177 653 phase transitions */
<> 161:2cc1468da177 654
<> 161:2cc1468da177 655 DMA_HandleTypeDef *hdmain; /*!< CRYP peripheral Input DMA handle parameters */
<> 161:2cc1468da177 656
<> 161:2cc1468da177 657 DMA_HandleTypeDef *hdmaout; /*!< CRYP peripheral Output DMA handle parameters */
<> 161:2cc1468da177 658
<> 161:2cc1468da177 659 HAL_LockTypeDef Lock; /*!< CRYP locking object */
<> 161:2cc1468da177 660
<> 161:2cc1468da177 661 __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */
<> 161:2cc1468da177 662
<> 161:2cc1468da177 663 __IO uint32_t ErrorCode; /*!< CRYP peripheral error code */
<> 161:2cc1468da177 664
<> 161:2cc1468da177 665 HAL_SuspendTypeDef SuspendRequest; /*!< CRYP peripheral suspension request flag */
<> 161:2cc1468da177 666 }CRYP_HandleTypeDef;
<> 161:2cc1468da177 667
<> 161:2cc1468da177 668 /**
<> 161:2cc1468da177 669 * @}
<> 161:2cc1468da177 670 */
<> 161:2cc1468da177 671
<> 161:2cc1468da177 672
<> 161:2cc1468da177 673 /* Exported constants --------------------------------------------------------*/
<> 161:2cc1468da177 674 /** @defgroup CRYP_Exported_Constants CRYP Exported Constants
<> 161:2cc1468da177 675 * @{
<> 161:2cc1468da177 676 */
<> 161:2cc1468da177 677
<> 161:2cc1468da177 678 /** @defgroup CRYP_Key_Size Key size selection
<> 161:2cc1468da177 679 * @{
<> 161:2cc1468da177 680 */
<> 161:2cc1468da177 681 #define CRYP_KEYSIZE_128B ((uint32_t)0x00000000) /*!< 128-bit long key */
<> 161:2cc1468da177 682 #define CRYP_KEYSIZE_256B AES_CR_KEYSIZE /*!< 256-bit long key */
<> 161:2cc1468da177 683 /**
<> 161:2cc1468da177 684 * @}
<> 161:2cc1468da177 685 */
<> 161:2cc1468da177 686
<> 161:2cc1468da177 687 /** @defgroup CRYP_Data_Type AES Data Type selection
<> 161:2cc1468da177 688 * @{
<> 161:2cc1468da177 689 */
<> 161:2cc1468da177 690 #define CRYP_DATATYPE_32B ((uint32_t)0x00000000) /*!< 32-bit data type (no swapping) */
<> 161:2cc1468da177 691 #define CRYP_DATATYPE_16B AES_CR_DATATYPE_0 /*!< 16-bit data type (half-word swapping) */
<> 161:2cc1468da177 692 #define CRYP_DATATYPE_8B AES_CR_DATATYPE_1 /*!< 8-bit data type (byte swapping) */
<> 161:2cc1468da177 693 #define CRYP_DATATYPE_1B AES_CR_DATATYPE /*!< 1-bit data type (bit swapping) */
<> 161:2cc1468da177 694 /**
<> 161:2cc1468da177 695 * @}
<> 161:2cc1468da177 696 */
<> 161:2cc1468da177 697
<> 161:2cc1468da177 698 /** @defgroup CRYP_AES_State AES Enable state
<> 161:2cc1468da177 699 * @{
<> 161:2cc1468da177 700 */
<> 161:2cc1468da177 701 #define CRYP_AES_DISABLE ((uint32_t)0x00000000) /*!< Disable AES */
<> 161:2cc1468da177 702 #define CRYP_AES_ENABLE AES_CR_EN /*!< Enable AES */
<> 161:2cc1468da177 703 /**
<> 161:2cc1468da177 704 * @}
<> 161:2cc1468da177 705 */
<> 161:2cc1468da177 706
<> 161:2cc1468da177 707 /** @defgroup CRYP_AES_OperatingMode AES operating mode
<> 161:2cc1468da177 708 * @{
<> 161:2cc1468da177 709 */
<> 161:2cc1468da177 710 #define CRYP_ALGOMODE_ENCRYPT ((uint32_t)0x00000000) /*!< Encryption mode */
<> 161:2cc1468da177 711 #define CRYP_ALGOMODE_KEYDERIVATION AES_CR_MODE_0 /*!< Key derivation mode */
<> 161:2cc1468da177 712 #define CRYP_ALGOMODE_DECRYPT AES_CR_MODE_1 /*!< Decryption */
<> 161:2cc1468da177 713 #define CRYP_ALGOMODE_KEYDERIVATION_DECRYPT AES_CR_MODE /*!< Key derivation and decryption */
<> 161:2cc1468da177 714 #define CRYP_ALGOMODE_TAG_GENERATION ((uint32_t)0x00000000) /*!< GMAC or CMAC authentication tag generation */
<> 161:2cc1468da177 715 /**
<> 161:2cc1468da177 716 * @}
<> 161:2cc1468da177 717 */
<> 161:2cc1468da177 718
<> 161:2cc1468da177 719 /** @defgroup CRYP_AES_ChainingMode AES chaining mode
<> 161:2cc1468da177 720 * @{
<> 161:2cc1468da177 721 */
<> 161:2cc1468da177 722 #define CRYP_CHAINMODE_AES_ECB ((uint32_t)0x00000000) /*!< Electronic codebook chaining algorithm */
<> 161:2cc1468da177 723 #define CRYP_CHAINMODE_AES_CBC AES_CR_CHMOD_0 /*!< Cipher block chaining algorithm */
<> 161:2cc1468da177 724 #define CRYP_CHAINMODE_AES_CTR AES_CR_CHMOD_1 /*!< Counter mode chaining algorithm */
<> 161:2cc1468da177 725 #define CRYP_CHAINMODE_AES_GCM_GMAC (AES_CR_CHMOD_0 | AES_CR_CHMOD_1) /*!< Galois counter mode - Galois message authentication code */
<> 161:2cc1468da177 726 #define CRYP_CHAINMODE_AES_CMAC AES_CR_CHMOD_2 /*!< Cipher message authentication code */
<> 161:2cc1468da177 727 #if defined(AES_CR_NPBLB)
<> 161:2cc1468da177 728 #define CRYP_CHAINMODE_AES_CCM_CMAC AES_CR_CHMOD_2 /*!< Counter with Cipher Mode - Cipher message authentication code */
<> 161:2cc1468da177 729 #endif
<> 161:2cc1468da177 730 /**
<> 161:2cc1468da177 731 * @}
<> 161:2cc1468da177 732 */
<> 161:2cc1468da177 733
<> 161:2cc1468da177 734 /** @defgroup CRYP_Key_Write AES decryption key write-up flag
<> 161:2cc1468da177 735 * @{
<> 161:2cc1468da177 736 */
<> 161:2cc1468da177 737 #define CRYP_KEY_WRITE_ENABLE ((uint32_t)0x00000000) /*!< Enable decryption key writing */
<> 161:2cc1468da177 738 #define CRYP_KEY_WRITE_DISABLE ((uint32_t)0x00000001) /*!< Disable decryption key writing */
<> 161:2cc1468da177 739 /**
<> 161:2cc1468da177 740 * @}
<> 161:2cc1468da177 741 */
<> 161:2cc1468da177 742
<> 161:2cc1468da177 743 /** @defgroup CRYP_DMAIN DMA Input phase management enable state
<> 161:2cc1468da177 744 * @{
<> 161:2cc1468da177 745 */
<> 161:2cc1468da177 746 #define CRYP_DMAIN_DISABLE ((uint32_t)0x00000000) /*!< Disable DMA Input phase management */
<> 161:2cc1468da177 747 #define CRYP_DMAIN_ENABLE AES_CR_DMAINEN /*!< Enable DMA Input phase management */
<> 161:2cc1468da177 748 /**
<> 161:2cc1468da177 749 * @}
<> 161:2cc1468da177 750 */
<> 161:2cc1468da177 751
<> 161:2cc1468da177 752 /** @defgroup CRYP_DMAOUT DMA Output phase management enable state
<> 161:2cc1468da177 753 * @{
<> 161:2cc1468da177 754 */
<> 161:2cc1468da177 755 #define CRYP_DMAOUT_DISABLE ((uint32_t)0x00000000) /*!< Disable DMA Output phase management */
<> 161:2cc1468da177 756 #define CRYP_DMAOUT_ENABLE AES_CR_DMAOUTEN /*!< Enable DMA Output phase management */
<> 161:2cc1468da177 757 /**
<> 161:2cc1468da177 758 * @}
<> 161:2cc1468da177 759 */
<> 161:2cc1468da177 760
<> 161:2cc1468da177 761
<> 161:2cc1468da177 762 /** @defgroup CRYP_GCM_CMAC_Phase GCM/GMAC and CMAC processing phase selection
<> 161:2cc1468da177 763 * @{
<> 161:2cc1468da177 764 */
<> 161:2cc1468da177 765 #define CRYP_GCM_INIT_PHASE ((uint32_t)0x00000000) /*!< GCM/GMAC (or CCM) init phase */
<> 161:2cc1468da177 766 #define CRYP_GCMCMAC_HEADER_PHASE AES_CR_GCMPH_0 /*!< GCM/GMAC or (CCM/)CMAC header phase */
<> 161:2cc1468da177 767 #define CRYP_GCM_PAYLOAD_PHASE AES_CR_GCMPH_1 /*!< GCM(/CCM) payload phase */
<> 161:2cc1468da177 768 #define CRYP_GCMCMAC_FINAL_PHASE AES_CR_GCMPH /*!< GCM/GMAC or (CCM/)CMAC final phase */
<> 161:2cc1468da177 769 /* Definitions duplication for code readibility's sake:
<> 161:2cc1468da177 770 supported or not supported chain modes are not specified for each phase */
<> 161:2cc1468da177 771 #define CRYP_INIT_PHASE ((uint32_t)0x00000000) /*!< Init phase */
<> 161:2cc1468da177 772 #define CRYP_HEADER_PHASE AES_CR_GCMPH_0 /*!< Header phase */
<> 161:2cc1468da177 773 #define CRYP_PAYLOAD_PHASE AES_CR_GCMPH_1 /*!< Payload phase */
<> 161:2cc1468da177 774 #define CRYP_FINAL_PHASE AES_CR_GCMPH /*!< Final phase */
<> 161:2cc1468da177 775 /**
<> 161:2cc1468da177 776 * @}
<> 161:2cc1468da177 777 */
<> 161:2cc1468da177 778
<> 161:2cc1468da177 779 /** @defgroup CRYP_Flags AES status flags
<> 161:2cc1468da177 780 * @{
<> 161:2cc1468da177 781 */
<> 161:2cc1468da177 782
<> 161:2cc1468da177 783 #define CRYP_FLAG_BUSY AES_SR_BUSY /*!< GCM process suspension forbidden */
<> 161:2cc1468da177 784 #define CRYP_FLAG_WRERR AES_SR_WRERR /*!< Write Error */
<> 161:2cc1468da177 785 #define CRYP_FLAG_RDERR AES_SR_RDERR /*!< Read error */
<> 161:2cc1468da177 786 #define CRYP_FLAG_CCF AES_SR_CCF /*!< Computation completed */
<> 161:2cc1468da177 787 /**
<> 161:2cc1468da177 788 * @}
<> 161:2cc1468da177 789 */
<> 161:2cc1468da177 790
<> 161:2cc1468da177 791 /** @defgroup CRYP_Clear_Flags AES clearing flags
<> 161:2cc1468da177 792 * @{
<> 161:2cc1468da177 793 */
<> 161:2cc1468da177 794
<> 161:2cc1468da177 795 #define CRYP_CCF_CLEAR AES_CR_CCFC /*!< Computation Complete Flag Clear */
<> 161:2cc1468da177 796 #define CRYP_ERR_CLEAR AES_CR_ERRC /*!< Error Flag Clear */
<> 161:2cc1468da177 797 /**
<> 161:2cc1468da177 798 * @}
<> 161:2cc1468da177 799 */
<> 161:2cc1468da177 800
<> 161:2cc1468da177 801 /** @defgroup AES_Interrupts_Enable AES Interrupts Enable bits
<> 161:2cc1468da177 802 * @{
<> 161:2cc1468da177 803 */
<> 161:2cc1468da177 804 #define CRYP_IT_CCFIE AES_CR_CCFIE /*!< Computation Complete interrupt enable */
<> 161:2cc1468da177 805 #define CRYP_IT_ERRIE AES_CR_ERRIE /*!< Error interrupt enable */
<> 161:2cc1468da177 806 /**
<> 161:2cc1468da177 807 * @}
<> 161:2cc1468da177 808 */
<> 161:2cc1468da177 809
<> 161:2cc1468da177 810 /** @defgroup CRYP_Interrupts_Flags AES Interrupts flags
<> 161:2cc1468da177 811 * @{
<> 161:2cc1468da177 812 */
<> 161:2cc1468da177 813 #define CRYP_IT_WRERR AES_SR_WRERR /*!< Write Error */
<> 161:2cc1468da177 814 #define CRYP_IT_RDERR AES_SR_RDERR /*!< Read Error */
<> 161:2cc1468da177 815 #define CRYP_IT_CCF AES_SR_CCF /*!< Computation completed */
<> 161:2cc1468da177 816 /**
<> 161:2cc1468da177 817 * @}
<> 161:2cc1468da177 818 */
<> 161:2cc1468da177 819
<> 161:2cc1468da177 820 /**
<> 161:2cc1468da177 821 * @}
<> 161:2cc1468da177 822 */
<> 161:2cc1468da177 823
<> 161:2cc1468da177 824 /* Exported macros -----------------------------------------------------------*/
<> 161:2cc1468da177 825 /** @defgroup CRYP_Exported_Macros CRYP Exported Macros
<> 161:2cc1468da177 826 * @{
<> 161:2cc1468da177 827 */
<> 161:2cc1468da177 828
<> 161:2cc1468da177 829 /** @brief Reset CRYP handle state.
<> 161:2cc1468da177 830 * @param __HANDLE__: specifies the CRYP handle.
<> 161:2cc1468da177 831 * @retval None
<> 161:2cc1468da177 832 */
<> 161:2cc1468da177 833 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRYP_STATE_RESET)
<> 161:2cc1468da177 834
<> 161:2cc1468da177 835 /**
<> 161:2cc1468da177 836 * @brief Enable the CRYP AES peripheral.
<> 161:2cc1468da177 837 * @retval None
<> 161:2cc1468da177 838 */
<> 161:2cc1468da177 839 #define __HAL_CRYP_ENABLE() (AES->CR |= AES_CR_EN)
<> 161:2cc1468da177 840
<> 161:2cc1468da177 841 /**
<> 161:2cc1468da177 842 * @brief Disable the CRYP AES peripheral.
<> 161:2cc1468da177 843 * @retval None
<> 161:2cc1468da177 844 */
<> 161:2cc1468da177 845 #define __HAL_CRYP_DISABLE() (AES->CR &= ~AES_CR_EN)
<> 161:2cc1468da177 846
<> 161:2cc1468da177 847 /**
<> 161:2cc1468da177 848 * @brief Set the algorithm operating mode.
<> 161:2cc1468da177 849 * @param __OPERATING_MODE__: specifies the operating mode
<> 161:2cc1468da177 850 * This parameter can be one of the following values:
<> 161:2cc1468da177 851 * @arg @ref CRYP_ALGOMODE_ENCRYPT encryption
<> 161:2cc1468da177 852 * @arg @ref CRYP_ALGOMODE_KEYDERIVATION key derivation
<> 161:2cc1468da177 853 * @arg @ref CRYP_ALGOMODE_DECRYPT decryption
<> 161:2cc1468da177 854 * @arg @ref CRYP_ALGOMODE_KEYDERIVATION_DECRYPT key derivation and decryption
<> 161:2cc1468da177 855 * @retval None
<> 161:2cc1468da177 856 */
<> 161:2cc1468da177 857 #define __HAL_CRYP_SET_OPERATINGMODE(__OPERATING_MODE__) MODIFY_REG(AES->CR, AES_CR_MODE, (__OPERATING_MODE__))
<> 161:2cc1468da177 858
<> 161:2cc1468da177 859
<> 161:2cc1468da177 860 /**
<> 161:2cc1468da177 861 * @brief Set the algorithm chaining mode.
<> 161:2cc1468da177 862 * @param __CHAINING_MODE__: specifies the chaining mode
<> 161:2cc1468da177 863 * This parameter can be one of the following values:
<> 161:2cc1468da177 864 * @arg @ref CRYP_CHAINMODE_AES_ECB Electronic CodeBook
<> 161:2cc1468da177 865 * @arg @ref CRYP_CHAINMODE_AES_CBC Cipher Block Chaining
<> 161:2cc1468da177 866 * @arg @ref CRYP_CHAINMODE_AES_CTR CounTeR mode
<> 161:2cc1468da177 867 * @arg @ref CRYP_CHAINMODE_AES_GCM_GMAC Galois Counter Mode or Galois Message Authentication Code
<> 161:2cc1468da177 868 * @arg @ref CRYP_CHAINMODE_AES_CMAC Cipher Message Authentication Code (or Counter with Cipher Mode when applicable)
<> 161:2cc1468da177 869 * @retval None
<> 161:2cc1468da177 870 */
<> 161:2cc1468da177 871 #define __HAL_CRYP_SET_CHAININGMODE(__CHAINING_MODE__) MODIFY_REG(AES->CR, AES_CR_CHMOD, (__CHAINING_MODE__))
<> 161:2cc1468da177 872
<> 161:2cc1468da177 873
<> 161:2cc1468da177 874
<> 161:2cc1468da177 875 /** @brief Check whether the specified CRYP status flag is set or not.
<> 161:2cc1468da177 876 * @param __FLAG__: specifies the flag to check.
<> 161:2cc1468da177 877 * This parameter can be one of the following values:
<> 161:2cc1468da177 878 * @arg @ref CRYP_FLAG_BUSY GCM process suspension forbidden
<> 161:2cc1468da177 879 * @arg @ref CRYP_IT_WRERR Write Error
<> 161:2cc1468da177 880 * @arg @ref CRYP_IT_RDERR Read Error
<> 161:2cc1468da177 881 * @arg @ref CRYP_IT_CCF Computation Complete
<> 161:2cc1468da177 882 * @retval The state of __FLAG__ (TRUE or FALSE).
<> 161:2cc1468da177 883 */
<> 161:2cc1468da177 884 #define __HAL_CRYP_GET_FLAG(__FLAG__) ((AES->SR & (__FLAG__)) == (__FLAG__))
<> 161:2cc1468da177 885
<> 161:2cc1468da177 886
<> 161:2cc1468da177 887 /** @brief Clear the CRYP pending status flag.
<> 161:2cc1468da177 888 * @param __FLAG__: specifies the flag to clear.
<> 161:2cc1468da177 889 * This parameter can be one of the following values:
<> 161:2cc1468da177 890 * @arg @ref CRYP_ERR_CLEAR Read (RDERR) or Write Error (WRERR) Flag Clear
<> 161:2cc1468da177 891 * @arg @ref CRYP_CCF_CLEAR Computation Complete Flag (CCF) Clear
<> 161:2cc1468da177 892 * @retval None
<> 161:2cc1468da177 893 */
<> 161:2cc1468da177 894 #define __HAL_CRYP_CLEAR_FLAG(__FLAG__) SET_BIT(AES->CR, (__FLAG__))
<> 161:2cc1468da177 895
<> 161:2cc1468da177 896
<> 161:2cc1468da177 897
<> 161:2cc1468da177 898 /** @brief Check whether the specified CRYP interrupt source is enabled or not.
<> 161:2cc1468da177 899 * @param __INTERRUPT__: CRYP interrupt source to check
<> 161:2cc1468da177 900 * This parameter can be one of the following values:
<> 161:2cc1468da177 901 * @arg @ref CRYP_IT_ERRIE Error interrupt (used for RDERR and WRERR)
<> 161:2cc1468da177 902 * @arg @ref CRYP_IT_CCFIE Computation Complete interrupt
<> 161:2cc1468da177 903 * @retval State of interruption (TRUE or FALSE).
<> 161:2cc1468da177 904 */
<> 161:2cc1468da177 905 #define __HAL_CRYP_GET_IT_SOURCE(__INTERRUPT__) ((AES->CR & (__INTERRUPT__)) == (__INTERRUPT__))
<> 161:2cc1468da177 906
<> 161:2cc1468da177 907
<> 161:2cc1468da177 908 /** @brief Check whether the specified CRYP interrupt is set or not.
<> 161:2cc1468da177 909 * @param __INTERRUPT__: specifies the interrupt to check.
<> 161:2cc1468da177 910 * This parameter can be one of the following values:
<> 161:2cc1468da177 911 * @arg @ref CRYP_IT_WRERR Write Error
<> 161:2cc1468da177 912 * @arg @ref CRYP_IT_RDERR Read Error
<> 161:2cc1468da177 913 * @arg @ref CRYP_IT_CCF Computation Complete
<> 161:2cc1468da177 914 * @retval The state of __INTERRUPT__ (TRUE or FALSE).
<> 161:2cc1468da177 915 */
<> 161:2cc1468da177 916 #define __HAL_CRYP_GET_IT(__INTERRUPT__) ((AES->SR & (__INTERRUPT__)) == (__INTERRUPT__))
<> 161:2cc1468da177 917
<> 161:2cc1468da177 918
<> 161:2cc1468da177 919
<> 161:2cc1468da177 920 /** @brief Clear the CRYP pending interrupt.
<> 161:2cc1468da177 921 * @param __INTERRUPT__: specifies the IT to clear.
<> 161:2cc1468da177 922 * This parameter can be one of the following values:
<> 161:2cc1468da177 923 * @arg @ref CRYP_ERR_CLEAR Read (RDERR) or Write Error (WRERR) Flag Clear
<> 161:2cc1468da177 924 * @arg @ref CRYP_CCF_CLEAR Computation Complete Flag (CCF) Clear
<> 161:2cc1468da177 925 * @retval None
<> 161:2cc1468da177 926 */
<> 161:2cc1468da177 927 #define __HAL_CRYP_CLEAR_IT(__INTERRUPT__) SET_BIT(AES->CR, (__INTERRUPT__))
<> 161:2cc1468da177 928
<> 161:2cc1468da177 929
<> 161:2cc1468da177 930 /**
<> 161:2cc1468da177 931 * @brief Enable the CRYP interrupt.
<> 161:2cc1468da177 932 * @param __INTERRUPT__: CRYP Interrupt.
<> 161:2cc1468da177 933 * This parameter can be one of the following values:
<> 161:2cc1468da177 934 * @arg @ref CRYP_IT_ERRIE Error interrupt (used for RDERR and WRERR)
<> 161:2cc1468da177 935 * @arg @ref CRYP_IT_CCFIE Computation Complete interrupt
<> 161:2cc1468da177 936 * @retval None
<> 161:2cc1468da177 937 */
<> 161:2cc1468da177 938 #define __HAL_CRYP_ENABLE_IT(__INTERRUPT__) ((AES->CR) |= (__INTERRUPT__))
<> 161:2cc1468da177 939
<> 161:2cc1468da177 940
<> 161:2cc1468da177 941 /**
<> 161:2cc1468da177 942 * @brief Disable the CRYP interrupt.
<> 161:2cc1468da177 943 * @param __INTERRUPT__: CRYP Interrupt.
<> 161:2cc1468da177 944 * This parameter can be one of the following values:
<> 161:2cc1468da177 945 * @arg @ref CRYP_IT_ERRIE Error interrupt (used for RDERR and WRERR)
<> 161:2cc1468da177 946 * @arg @ref CRYP_IT_CCFIE Computation Complete interrupt
<> 161:2cc1468da177 947 * @retval None
<> 161:2cc1468da177 948 */
<> 161:2cc1468da177 949 #define __HAL_CRYP_DISABLE_IT(__INTERRUPT__) ((AES->CR) &= ~(__INTERRUPT__))
<> 161:2cc1468da177 950
<> 161:2cc1468da177 951 /**
<> 161:2cc1468da177 952 * @}
<> 161:2cc1468da177 953 */
<> 161:2cc1468da177 954
<> 161:2cc1468da177 955 /* Private macros --------------------------------------------------------*/
<> 161:2cc1468da177 956 /** @addtogroup CRYP_Private_Macros CRYP Private Macros
<> 161:2cc1468da177 957 * @{
<> 161:2cc1468da177 958 */
<> 161:2cc1468da177 959
<> 161:2cc1468da177 960 /**
<> 161:2cc1468da177 961 * @brief Verify the key size length.
<> 161:2cc1468da177 962 * @param __KEYSIZE__: Ciphering/deciphering algorithm key size.
<> 161:2cc1468da177 963 * @retval SET (__KEYSIZE__ is a valid value) or RESET (__KEYSIZE__ is invalid)
<> 161:2cc1468da177 964 */
<> 161:2cc1468da177 965 #define IS_CRYP_KEYSIZE(__KEYSIZE__) (((__KEYSIZE__) == CRYP_KEYSIZE_128B) || \
<> 161:2cc1468da177 966 ((__KEYSIZE__) == CRYP_KEYSIZE_256B))
<> 161:2cc1468da177 967
<> 161:2cc1468da177 968 /**
<> 161:2cc1468da177 969 * @brief Verify the input data type.
<> 161:2cc1468da177 970 * @param __DATATYPE__: Ciphering/deciphering algorithm input data type.
<> 161:2cc1468da177 971 * @retval SET (__DATATYPE__ is valid) or RESET (__DATATYPE__ is invalid)
<> 161:2cc1468da177 972 */
<> 161:2cc1468da177 973 #define IS_CRYP_DATATYPE(__DATATYPE__) (((__DATATYPE__) == CRYP_DATATYPE_32B) || \
<> 161:2cc1468da177 974 ((__DATATYPE__) == CRYP_DATATYPE_16B) || \
<> 161:2cc1468da177 975 ((__DATATYPE__) == CRYP_DATATYPE_8B) || \
<> 161:2cc1468da177 976 ((__DATATYPE__) == CRYP_DATATYPE_1B))
<> 161:2cc1468da177 977
<> 161:2cc1468da177 978 /**
<> 161:2cc1468da177 979 * @brief Verify the CRYP AES IP running mode.
<> 161:2cc1468da177 980 * @param __MODE__: CRYP AES IP running mode.
<> 161:2cc1468da177 981 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
<> 161:2cc1468da177 982 */
<> 161:2cc1468da177 983 #define IS_CRYP_AES(__MODE__) (((__MODE__) == CRYP_AES_DISABLE) || \
<> 161:2cc1468da177 984 ((__MODE__) == CRYP_AES_ENABLE))
<> 161:2cc1468da177 985
<> 161:2cc1468da177 986 /**
<> 161:2cc1468da177 987 * @brief Verify the selected CRYP algorithm.
<> 161:2cc1468da177 988 * @param __ALGOMODE__: Selected CRYP algorithm (ciphering, deciphering, key derivation or a combination of the latter).
<> 161:2cc1468da177 989 * @retval SET (__ALGOMODE__ is valid) or RESET (__ALGOMODE__ is invalid)
<> 161:2cc1468da177 990 */
<> 161:2cc1468da177 991 #define IS_CRYP_ALGOMODE(__ALGOMODE__) (((__ALGOMODE__) == CRYP_ALGOMODE_ENCRYPT) || \
<> 161:2cc1468da177 992 ((__ALGOMODE__) == CRYP_ALGOMODE_KEYDERIVATION) || \
<> 161:2cc1468da177 993 ((__ALGOMODE__) == CRYP_ALGOMODE_DECRYPT) || \
<> 161:2cc1468da177 994 ((__ALGOMODE__) == CRYP_ALGOMODE_TAG_GENERATION) || \
<> 161:2cc1468da177 995 ((__ALGOMODE__) == CRYP_ALGOMODE_KEYDERIVATION_DECRYPT))
<> 161:2cc1468da177 996
<> 161:2cc1468da177 997 /**
<> 161:2cc1468da177 998 * @brief Verify the selected CRYP chaining algorithm.
<> 161:2cc1468da177 999 * @param __CHAINMODE__: Selected CRYP chaining algorithm.
<> 161:2cc1468da177 1000 * @retval SET (__CHAINMODE__ is valid) or RESET (__CHAINMODE__ is invalid)
<> 161:2cc1468da177 1001 */
<> 161:2cc1468da177 1002 #if defined(AES_CR_NPBLB)
<> 161:2cc1468da177 1003 #define IS_CRYP_CHAINMODE(__CHAINMODE__) (((__CHAINMODE__) == CRYP_CHAINMODE_AES_ECB) || \
<> 161:2cc1468da177 1004 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CBC) || \
<> 161:2cc1468da177 1005 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CTR) || \
<> 161:2cc1468da177 1006 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_GCM_GMAC) || \
<> 161:2cc1468da177 1007 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CCM_CMAC))
<> 161:2cc1468da177 1008 #else
<> 161:2cc1468da177 1009 #define IS_CRYP_CHAINMODE(__CHAINMODE__) (((__CHAINMODE__) == CRYP_CHAINMODE_AES_ECB) || \
<> 161:2cc1468da177 1010 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CBC) || \
<> 161:2cc1468da177 1011 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CTR) || \
<> 161:2cc1468da177 1012 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_GCM_GMAC) || \
<> 161:2cc1468da177 1013 ((__CHAINMODE__) == CRYP_CHAINMODE_AES_CMAC))
<> 161:2cc1468da177 1014 #endif
<> 161:2cc1468da177 1015
<> 161:2cc1468da177 1016 /**
<> 161:2cc1468da177 1017 * @brief Verify the deciphering key write option.
<> 161:2cc1468da177 1018 * @param __WRITE__: deciphering key write option.
<> 161:2cc1468da177 1019 * @retval SET (__WRITE__ is valid) or RESET (__WRITE__ is invalid)
<> 161:2cc1468da177 1020 */
<> 161:2cc1468da177 1021 #define IS_CRYP_WRITE(__WRITE__) (((__WRITE__) == CRYP_KEY_WRITE_ENABLE) || \
<> 161:2cc1468da177 1022 ((__WRITE__) == CRYP_KEY_WRITE_DISABLE))
<> 161:2cc1468da177 1023
<> 161:2cc1468da177 1024 /**
<> 161:2cc1468da177 1025 * @brief Verify the CRYP input data DMA mode.
<> 161:2cc1468da177 1026 * @param __MODE__: CRYP input data DMA mode.
<> 161:2cc1468da177 1027 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
<> 161:2cc1468da177 1028 */
<> 161:2cc1468da177 1029 #define IS_CRYP_DMAIN(__MODE__) (((__MODE__) == CRYP_DMAIN_DISABLE) || \
<> 161:2cc1468da177 1030 ((__MODE__) == CRYP_DMAIN_ENABLE))
<> 161:2cc1468da177 1031
<> 161:2cc1468da177 1032 /**
<> 161:2cc1468da177 1033 * @brief Verify the CRYP output data DMA mode.
<> 161:2cc1468da177 1034 * @param __MODE__: CRYP output data DMA mode.
<> 161:2cc1468da177 1035 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
<> 161:2cc1468da177 1036 */
<> 161:2cc1468da177 1037 #define IS_CRYP_DMAOUT(__MODE__) (((__MODE__) == CRYP_DMAOUT_DISABLE) || \
<> 161:2cc1468da177 1038 ((__MODE__) == CRYP_DMAOUT_ENABLE))
<> 161:2cc1468da177 1039
<> 161:2cc1468da177 1040 /**
<> 161:2cc1468da177 1041 * @brief Verify the CRYP AES ciphering/deciphering/authentication algorithm phase.
<> 161:2cc1468da177 1042 * @param __PHASE__: CRYP AES ciphering/deciphering/authentication algorithm phase.
<> 161:2cc1468da177 1043 * @retval SET (__PHASE__ is valid) or RESET (__PHASE__ is invalid)
<> 161:2cc1468da177 1044 */
<> 161:2cc1468da177 1045 #define IS_CRYP_GCMCMAC_PHASE(__PHASE__) (((__PHASE__) == CRYP_GCM_INIT_PHASE) || \
<> 161:2cc1468da177 1046 ((__PHASE__) == CRYP_GCMCMAC_HEADER_PHASE) || \
<> 161:2cc1468da177 1047 ((__PHASE__) == CRYP_GCM_PAYLOAD_PHASE) || \
<> 161:2cc1468da177 1048 ((__PHASE__) == CRYP_GCMCMAC_FINAL_PHASE))
<> 161:2cc1468da177 1049
<> 161:2cc1468da177 1050 /**
<> 161:2cc1468da177 1051 * @}
<> 161:2cc1468da177 1052 */
<> 161:2cc1468da177 1053
<> 161:2cc1468da177 1054 /* Include CRYP HAL Extended module */
<> 161:2cc1468da177 1055 #include "stm32f7xx_hal_cryp_ex.h"
<> 161:2cc1468da177 1056
<> 161:2cc1468da177 1057 /* Exported functions --------------------------------------------------------*/
<> 161:2cc1468da177 1058 /** @addtogroup CRYP_Exported_Functions CRYP Exported Functions
<> 161:2cc1468da177 1059 * @{
<> 161:2cc1468da177 1060 */
<> 161:2cc1468da177 1061
<> 161:2cc1468da177 1062 /** @addtogroup CRYP_Exported_Functions_Group1 Initialization and deinitialization functions
<> 161:2cc1468da177 1063 * @{
<> 161:2cc1468da177 1064 */
<> 161:2cc1468da177 1065
<> 161:2cc1468da177 1066 /* Initialization/de-initialization functions ********************************/
<> 161:2cc1468da177 1067 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1068 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1069
<> 161:2cc1468da177 1070 /* MSP initialization/de-initialization functions ****************************/
<> 161:2cc1468da177 1071 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1072 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1073
<> 161:2cc1468da177 1074 /**
<> 161:2cc1468da177 1075 * @}
<> 161:2cc1468da177 1076 */
<> 161:2cc1468da177 1077
<> 161:2cc1468da177 1078 /** @addtogroup CRYP_Exported_Functions_Group2 AES processing functions
<> 161:2cc1468da177 1079 * @{
<> 161:2cc1468da177 1080 */
<> 161:2cc1468da177 1081
<> 161:2cc1468da177 1082 /* AES encryption/decryption processing functions ****************************/
<> 161:2cc1468da177 1083
<> 161:2cc1468da177 1084 /* AES encryption/decryption using polling ***********************************/
<> 161:2cc1468da177 1085 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 161:2cc1468da177 1086 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 161:2cc1468da177 1087 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 161:2cc1468da177 1088 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 161:2cc1468da177 1089 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
<> 161:2cc1468da177 1090 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
<> 161:2cc1468da177 1091
<> 161:2cc1468da177 1092 /* AES encryption/decryption using interrupt *********************************/
<> 161:2cc1468da177 1093 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1094 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1095 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1096 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1097 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1098 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1099
<> 161:2cc1468da177 1100 /* AES encryption/decryption using DMA ***************************************/
<> 161:2cc1468da177 1101 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1102 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1103 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1104 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1105 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
<> 161:2cc1468da177 1106 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
<> 161:2cc1468da177 1107
<> 161:2cc1468da177 1108 /**
<> 161:2cc1468da177 1109 * @}
<> 161:2cc1468da177 1110 */
<> 161:2cc1468da177 1111
<> 161:2cc1468da177 1112 /** @addtogroup CRYP_Exported_Functions_Group3 Callback functions
<> 161:2cc1468da177 1113 * @{
<> 161:2cc1468da177 1114 */
<> 161:2cc1468da177 1115 /* CallBack functions ********************************************************/
<> 161:2cc1468da177 1116 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1117 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1118 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1119
<> 161:2cc1468da177 1120 /**
<> 161:2cc1468da177 1121 * @}
<> 161:2cc1468da177 1122 */
<> 161:2cc1468da177 1123
<> 161:2cc1468da177 1124 /** @addtogroup CRYP_Exported_Functions_Group4 CRYP IRQ handler
<> 161:2cc1468da177 1125 * @{
<> 161:2cc1468da177 1126 */
<> 161:2cc1468da177 1127
<> 161:2cc1468da177 1128 /* AES interrupt handling function *******************************************/
<> 161:2cc1468da177 1129 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1130
<> 161:2cc1468da177 1131 /**
<> 161:2cc1468da177 1132 * @}
<> 161:2cc1468da177 1133 */
<> 161:2cc1468da177 1134
<> 161:2cc1468da177 1135 /** @addtogroup CRYP_Exported_Functions_Group5 Peripheral State functions
<> 161:2cc1468da177 1136 * @{
<> 161:2cc1468da177 1137 */
<> 161:2cc1468da177 1138
<> 161:2cc1468da177 1139 /* Peripheral State functions ************************************************/
<> 161:2cc1468da177 1140 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1141 uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
<> 161:2cc1468da177 1142
<> 161:2cc1468da177 1143 /**
<> 161:2cc1468da177 1144 * @}
<> 161:2cc1468da177 1145 */
<> 161:2cc1468da177 1146
<> 161:2cc1468da177 1147 /**
<> 161:2cc1468da177 1148 * @}
<> 161:2cc1468da177 1149 */
<> 161:2cc1468da177 1150
<> 161:2cc1468da177 1151 /**
<> 161:2cc1468da177 1152 * @}
<> 161:2cc1468da177 1153 */
<> 161:2cc1468da177 1154
<> 161:2cc1468da177 1155 /**
<> 161:2cc1468da177 1156 * @}
<> 161:2cc1468da177 1157 */
<> 161:2cc1468da177 1158
<> 161:2cc1468da177 1159 #endif /* AES */
<> 161:2cc1468da177 1160
<> 161:2cc1468da177 1161
<> 144:ef7eb2e8f9f7 1162 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 1163 }
<> 144:ef7eb2e8f9f7 1164 #endif
<> 144:ef7eb2e8f9f7 1165
<> 144:ef7eb2e8f9f7 1166 #endif /* __STM32F7xx_HAL_CRYP_H */
<> 144:ef7eb2e8f9f7 1167
<> 144:ef7eb2e8f9f7 1168 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/