The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Mar 19 18:28:32 2014 +0000
Revision:
81:7d30d6019079
Parent:
77:869cf507173a
Child:
85:024bf7f99721
Release 81 of the mbed library

Main changes:

- Updates and fixes for many targets
- LPC1768: serial interface code fixes
- nRF51822 targets now output a .hex file
- More exporters
- More flexible GPIO API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32f4xx_hal_cryp.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
bogdanm 81:7d30d6019079 5 * @version V1.0.0
bogdanm 81:7d30d6019079 6 * @date 18-February-2014
emilmont 77:869cf507173a 7 * @brief Header file of CRYP HAL module.
emilmont 77:869cf507173a 8 ******************************************************************************
emilmont 77:869cf507173a 9 * @attention
emilmont 77:869cf507173a 10 *
emilmont 77:869cf507173a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 12 *
emilmont 77:869cf507173a 13 * Redistribution and use in source and binary forms, with or without modification,
emilmont 77:869cf507173a 14 * are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 15 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 16 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 18 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 19 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 21 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 22 * without specific prior written permission.
emilmont 77:869cf507173a 23 *
emilmont 77:869cf507173a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 34 *
emilmont 77:869cf507173a 35 ******************************************************************************
emilmont 77:869cf507173a 36 */
emilmont 77:869cf507173a 37
emilmont 77:869cf507173a 38 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 39 #ifndef __STM32F4xx_HAL_CRYP_H
emilmont 77:869cf507173a 40 #define __STM32F4xx_HAL_CRYP_H
emilmont 77:869cf507173a 41
emilmont 77:869cf507173a 42 #ifdef __cplusplus
emilmont 77:869cf507173a 43 extern "C" {
emilmont 77:869cf507173a 44 #endif
emilmont 77:869cf507173a 45
emilmont 77:869cf507173a 46 #if defined(STM32F415xx) || defined(STM32F417xx) || defined(STM32F437xx) || defined(STM32F439xx)
emilmont 77:869cf507173a 47 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 48 #include "stm32f4xx_hal_def.h"
emilmont 77:869cf507173a 49
emilmont 77:869cf507173a 50 /** @addtogroup STM32F4xx_HAL_Driver
emilmont 77:869cf507173a 51 * @{
emilmont 77:869cf507173a 52 */
emilmont 77:869cf507173a 53
emilmont 77:869cf507173a 54 /** @addtogroup CRYP
emilmont 77:869cf507173a 55 * @{
emilmont 77:869cf507173a 56 */
emilmont 77:869cf507173a 57
emilmont 77:869cf507173a 58 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 59
emilmont 77:869cf507173a 60 /**
emilmont 77:869cf507173a 61 * @brief CRYP Configuration Structure definition
emilmont 77:869cf507173a 62 */
emilmont 77:869cf507173a 63 typedef struct
emilmont 77:869cf507173a 64 {
emilmont 77:869cf507173a 65 uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
emilmont 77:869cf507173a 66 This parameter can be a value of @ref CRYP_Data_Type */
emilmont 77:869cf507173a 67
emilmont 77:869cf507173a 68 uint32_t KeySize; /*!< Used only in AES mode only : 128, 192 or 256 bit key length.
emilmont 77:869cf507173a 69 This parameter can be a value of @ref CRYP_Key_Size */
emilmont 77:869cf507173a 70
emilmont 77:869cf507173a 71 uint8_t* pKey; /*!< The key used for encryption/decryption */
emilmont 77:869cf507173a 72
emilmont 77:869cf507173a 73 uint8_t* pInitVect; /*!< The initialization vector used also as initialization
emilmont 77:869cf507173a 74 counter in CTR mode */
emilmont 77:869cf507173a 75
emilmont 77:869cf507173a 76 uint8_t IVSize; /*!< The size of initialization vector.
emilmont 77:869cf507173a 77 This parameter (called nonce size in CCM) is used only
emilmont 77:869cf507173a 78 in AES-128/192/256 encryption/decryption CCM mode */
emilmont 77:869cf507173a 79
emilmont 77:869cf507173a 80 uint8_t TagSize; /*!< The size of returned authentication TAG.
emilmont 77:869cf507173a 81 This parameter is used only in AES-128/192/256
emilmont 77:869cf507173a 82 encryption/decryption CCM mode */
emilmont 77:869cf507173a 83
emilmont 77:869cf507173a 84 uint8_t* Header; /*!< The header used in GCM and CCM modes */
emilmont 77:869cf507173a 85
emilmont 77:869cf507173a 86 uint16_t HeaderSize; /*!< The size of header buffer in bytes */
emilmont 77:869cf507173a 87
emilmont 77:869cf507173a 88 uint8_t* pScratch; /*!< Scratch buffer used to append the header. It's size must be equal to header size + 21 bytes.
emilmont 77:869cf507173a 89 This parameter is used only in AES-128/192/256 encryption/decryption CCM mode */
emilmont 77:869cf507173a 90
emilmont 77:869cf507173a 91 }CRYP_InitTypeDef;
emilmont 77:869cf507173a 92
emilmont 77:869cf507173a 93 /**
emilmont 77:869cf507173a 94 * @brief HAL CRYP State structures definition
emilmont 77:869cf507173a 95 */
emilmont 77:869cf507173a 96 typedef enum
emilmont 77:869cf507173a 97 {
emilmont 77:869cf507173a 98 HAL_CRYP_STATE_RESET = 0x00, /*!< CRYP not yet initialized or disabled */
emilmont 77:869cf507173a 99 HAL_CRYP_STATE_READY = 0x01, /*!< CRYP initialized and ready for use */
emilmont 77:869cf507173a 100 HAL_CRYP_STATE_BUSY = 0x02, /*!< CRYP internal processing is ongoing */
emilmont 77:869cf507173a 101 HAL_CRYP_STATE_TIMEOUT = 0x03, /*!< CRYP timeout state */
emilmont 77:869cf507173a 102 HAL_CRYP_STATE_ERROR = 0x04 /*!< CRYP error state */
emilmont 77:869cf507173a 103
emilmont 77:869cf507173a 104 }HAL_CRYP_STATETypeDef;
emilmont 77:869cf507173a 105
emilmont 77:869cf507173a 106 /**
emilmont 77:869cf507173a 107 * @brief HAL CRYP phase structures definition
emilmont 77:869cf507173a 108 */
emilmont 77:869cf507173a 109 typedef enum
emilmont 77:869cf507173a 110 {
emilmont 77:869cf507173a 111 HAL_CRYP_PHASE_READY = 0x01, /*!< CRYP peripheral is ready for initialization. */
emilmont 77:869cf507173a 112 HAL_CRYP_PHASE_PROCESS = 0x02, /*!< CRYP peripheral is in processing phase */
emilmont 77:869cf507173a 113 HAL_CRYP_PHASE_FINAL = 0x03 /*!< CRYP peripheral is in final phase
emilmont 77:869cf507173a 114 This is relevant only with CCM and GCM modes */
emilmont 77:869cf507173a 115 }HAL_PhaseTypeDef;
emilmont 77:869cf507173a 116
emilmont 77:869cf507173a 117 /**
emilmont 77:869cf507173a 118 * @brief CRYP handle Structure definition
emilmont 77:869cf507173a 119 */
emilmont 77:869cf507173a 120 typedef struct
emilmont 77:869cf507173a 121 {
emilmont 77:869cf507173a 122 CRYP_InitTypeDef Init; /*!< CRYP required parameters */
emilmont 77:869cf507173a 123
emilmont 77:869cf507173a 124 uint8_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
emilmont 77:869cf507173a 125
emilmont 77:869cf507173a 126 uint8_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
emilmont 77:869cf507173a 127
emilmont 77:869cf507173a 128 __IO uint16_t CrypInCount; /*!< Counter of inputed data */
emilmont 77:869cf507173a 129
emilmont 77:869cf507173a 130 __IO uint16_t CrypOutCount; /*!< Counter of outputed data */
emilmont 77:869cf507173a 131
emilmont 77:869cf507173a 132 HAL_StatusTypeDef Status; /*!< CRYP peripheral status */
emilmont 77:869cf507173a 133
emilmont 77:869cf507173a 134 HAL_PhaseTypeDef Phase; /*!< CRYP peripheral phase */
emilmont 77:869cf507173a 135
emilmont 77:869cf507173a 136 DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */
emilmont 77:869cf507173a 137
emilmont 77:869cf507173a 138 DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */
emilmont 77:869cf507173a 139
emilmont 77:869cf507173a 140 HAL_LockTypeDef Lock; /*!< CRYP locking object */
emilmont 77:869cf507173a 141
emilmont 77:869cf507173a 142 __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */
emilmont 77:869cf507173a 143
emilmont 77:869cf507173a 144 }CRYP_HandleTypeDef;
emilmont 77:869cf507173a 145
emilmont 77:869cf507173a 146 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 147
emilmont 77:869cf507173a 148 /** @defgroup CRYP_Exported_Constants
emilmont 77:869cf507173a 149 * @{
emilmont 77:869cf507173a 150 */
emilmont 77:869cf507173a 151
emilmont 77:869cf507173a 152 /** @defgroup CRYP_Key_Size
emilmont 77:869cf507173a 153 * @{
emilmont 77:869cf507173a 154 */
emilmont 77:869cf507173a 155 #define CRYP_KEYSIZE_128B ((uint32_t)0x00000000)
emilmont 77:869cf507173a 156 #define CRYP_KEYSIZE_192B CRYP_CR_KEYSIZE_0
emilmont 77:869cf507173a 157 #define CRYP_KEYSIZE_256B CRYP_CR_KEYSIZE_1
emilmont 77:869cf507173a 158
emilmont 77:869cf507173a 159 #define IS_CRYP_KEYSIZE(KEYSIZE) (((KEYSIZE) == CRYP_KEYSIZE_128B) || \
emilmont 77:869cf507173a 160 ((KEYSIZE) == CRYP_KEYSIZE_192B) || \
emilmont 77:869cf507173a 161 ((KEYSIZE) == CRYP_KEYSIZE_256B))
emilmont 77:869cf507173a 162 /**
emilmont 77:869cf507173a 163 * @}
emilmont 77:869cf507173a 164 */
emilmont 77:869cf507173a 165
emilmont 77:869cf507173a 166 /** @defgroup CRYP_Data_Type
emilmont 77:869cf507173a 167 * @{
emilmont 77:869cf507173a 168 */
emilmont 77:869cf507173a 169 #define CRYP_DATATYPE_32B ((uint32_t)0x00000000)
emilmont 77:869cf507173a 170 #define CRYP_DATATYPE_16B CRYP_CR_DATATYPE_0
emilmont 77:869cf507173a 171 #define CRYP_DATATYPE_8B CRYP_CR_DATATYPE_1
emilmont 77:869cf507173a 172 #define CRYP_DATATYPE_1B CRYP_CR_DATATYPE
emilmont 77:869cf507173a 173
emilmont 77:869cf507173a 174 #define IS_CRYP_DATATYPE(DATATYPE) (((DATATYPE) == CRYP_DATATYPE_32B) || \
emilmont 77:869cf507173a 175 ((DATATYPE) == CRYP_DATATYPE_16B) || \
emilmont 77:869cf507173a 176 ((DATATYPE) == CRYP_DATATYPE_8B) || \
emilmont 77:869cf507173a 177 ((DATATYPE) == CRYP_DATATYPE_1B))
emilmont 77:869cf507173a 178 /**
emilmont 77:869cf507173a 179 * @}
emilmont 77:869cf507173a 180 */
emilmont 77:869cf507173a 181
emilmont 77:869cf507173a 182 /** @defgroup CRYP_AlgoModeDirection
emilmont 77:869cf507173a 183 * @{
emilmont 77:869cf507173a 184 */
emilmont 77:869cf507173a 185 #define CRYP_CR_ALGOMODE_DIRECTION ((uint32_t)0x0008003C)
emilmont 77:869cf507173a 186 #define CRYP_CR_ALGOMODE_TDES_ECB_ENCRYPT ((uint32_t)0x00000000)
emilmont 77:869cf507173a 187 #define CRYP_CR_ALGOMODE_TDES_ECB_DECRYPT ((uint32_t)0x00000004)
emilmont 77:869cf507173a 188 #define CRYP_CR_ALGOMODE_TDES_CBC_ENCRYPT ((uint32_t)0x00000008)
emilmont 77:869cf507173a 189 #define CRYP_CR_ALGOMODE_TDES_CBC_DECRYPT ((uint32_t)0x0000000C)
emilmont 77:869cf507173a 190 #define CRYP_CR_ALGOMODE_DES_ECB_ENCRYPT ((uint32_t)0x00000010)
emilmont 77:869cf507173a 191 #define CRYP_CR_ALGOMODE_DES_ECB_DECRYPT ((uint32_t)0x00000014)
emilmont 77:869cf507173a 192 #define CRYP_CR_ALGOMODE_DES_CBC_ENCRYPT ((uint32_t)0x00000018)
emilmont 77:869cf507173a 193 #define CRYP_CR_ALGOMODE_DES_CBC_DECRYPT ((uint32_t)0x0000001C)
emilmont 77:869cf507173a 194 #define CRYP_CR_ALGOMODE_AES_ECB_ENCRYPT ((uint32_t)0x00000020)
emilmont 77:869cf507173a 195 #define CRYP_CR_ALGOMODE_AES_ECB_DECRYPT ((uint32_t)0x00000024)
emilmont 77:869cf507173a 196 #define CRYP_CR_ALGOMODE_AES_CBC_ENCRYPT ((uint32_t)0x00000028)
emilmont 77:869cf507173a 197 #define CRYP_CR_ALGOMODE_AES_CBC_DECRYPT ((uint32_t)0x0000002C)
emilmont 77:869cf507173a 198 #define CRYP_CR_ALGOMODE_AES_CTR_ENCRYPT ((uint32_t)0x00000030)
emilmont 77:869cf507173a 199 #define CRYP_CR_ALGOMODE_AES_CTR_DECRYPT ((uint32_t)0x00000034)
emilmont 77:869cf507173a 200 /**
emilmont 77:869cf507173a 201 * @}
emilmont 77:869cf507173a 202 */
emilmont 77:869cf507173a 203
emilmont 77:869cf507173a 204 /** @defgroup CRYP_Interrupt
emilmont 77:869cf507173a 205 * @{
emilmont 77:869cf507173a 206 */
emilmont 77:869cf507173a 207 #define CRYP_IT_INI ((uint32_t)CRYP_IMSCR_INIM) /*!< Input FIFO Interrupt */
emilmont 77:869cf507173a 208 #define CRYP_IT_OUTI ((uint32_t)CRYP_IMSCR_OUTIM) /*!< Output FIFO Interrupt */
emilmont 77:869cf507173a 209 /**
emilmont 77:869cf507173a 210 * @}
emilmont 77:869cf507173a 211 */
emilmont 77:869cf507173a 212
emilmont 77:869cf507173a 213
emilmont 77:869cf507173a 214 /** @defgroup CRYP_Flags
emilmont 77:869cf507173a 215 * @{
emilmont 77:869cf507173a 216 */
emilmont 77:869cf507173a 217
emilmont 77:869cf507173a 218 #define CRYP_FLAG_BUSY ((uint32_t)0x00000010) /*!< The CRYP core is currently
emilmont 77:869cf507173a 219 processing a block of data
emilmont 77:869cf507173a 220 or a key preparation (for
emilmont 77:869cf507173a 221 AES decryption). */
emilmont 77:869cf507173a 222 #define CRYP_FLAG_IFEM ((uint32_t)0x00000001) /*!< Input FIFO is empty */
emilmont 77:869cf507173a 223 #define CRYP_FLAG_IFNF ((uint32_t)0x00000002) /*!< Input FIFO is not Full */
emilmont 77:869cf507173a 224 #define CRYP_FLAG_OFNE ((uint32_t)0x00000004) /*!< Output FIFO is not empty */
emilmont 77:869cf507173a 225 #define CRYP_FLAG_OFFU ((uint32_t)0x00000008) /*!< Output FIFO is Full */
emilmont 77:869cf507173a 226 #define CRYP_FLAG_OUTRIS ((uint32_t)0x01000002) /*!< Output FIFO service raw
emilmont 77:869cf507173a 227 interrupt status */
emilmont 77:869cf507173a 228 #define CRYP_FLAG_INRIS ((uint32_t)0x01000001) /*!< Input FIFO service raw
emilmont 77:869cf507173a 229 interrupt status */
emilmont 77:869cf507173a 230 /**
emilmont 77:869cf507173a 231 * @}
emilmont 77:869cf507173a 232 */
emilmont 77:869cf507173a 233
emilmont 77:869cf507173a 234 /**
emilmont 77:869cf507173a 235 * @}
emilmont 77:869cf507173a 236 */
emilmont 77:869cf507173a 237
emilmont 77:869cf507173a 238 /* Exported macro ------------------------------------------------------------*/
emilmont 77:869cf507173a 239
emilmont 77:869cf507173a 240 /**
emilmont 77:869cf507173a 241 * @brief Enable/Disable the CRYP peripheral.
emilmont 77:869cf507173a 242 * @param None
emilmont 77:869cf507173a 243 * @retval None
emilmont 77:869cf507173a 244 */
emilmont 77:869cf507173a 245 #define __HAL_CRYP_ENABLE() (CRYP->CR |= CRYP_CR_CRYPEN)
emilmont 77:869cf507173a 246 #define __HAL_CRYP_DISABLE() (CRYP->CR &= ~CRYP_CR_CRYPEN)
emilmont 77:869cf507173a 247
emilmont 77:869cf507173a 248 /**
emilmont 77:869cf507173a 249 * @brief Flush the data FIFO.
emilmont 77:869cf507173a 250 * @param None
emilmont 77:869cf507173a 251 * @retval None
emilmont 77:869cf507173a 252 */
emilmont 77:869cf507173a 253 #define __HAL_CRYP_FIFO_FLUSH() (CRYP->CR |= CRYP_CR_FFLUSH)
emilmont 77:869cf507173a 254
emilmont 77:869cf507173a 255 /**
emilmont 77:869cf507173a 256 * @brief Set the algorithm mode: AES-ECB, AES-CBC, AES-CTR, DES-ECB, DES-CBC,...
emilmont 77:869cf507173a 257 * @param MODE: The algorithm mode.
emilmont 77:869cf507173a 258 * @retval None
emilmont 77:869cf507173a 259 */
emilmont 77:869cf507173a 260 #define __HAL_CRYP_SET_MODE(MODE) CRYP->CR |= (uint32_t)(MODE)
emilmont 77:869cf507173a 261
emilmont 77:869cf507173a 262
emilmont 77:869cf507173a 263 /** @brief Check whether the specified CRYP flag is set or not.
emilmont 77:869cf507173a 264 * @param __FLAG__: specifies the flag to check.
emilmont 77:869cf507173a 265 * This parameter can be one of the following values:
emilmont 77:869cf507173a 266 * @arg CRYP_FLAG_BUSY: The CRYP core is currently processing a block of data
emilmont 77:869cf507173a 267 * or a key preparation (for AES decryption).
emilmont 77:869cf507173a 268 * @arg CRYP_FLAG_IFEM: Input FIFO is empty
emilmont 77:869cf507173a 269 * @arg CRYP_FLAG_IFNF: Input FIFO is not full
emilmont 77:869cf507173a 270 * @arg CRYP_FLAG_INRIS: Input FIFO service raw interrupt is pending
emilmont 77:869cf507173a 271 * @arg CRYP_FLAG_OFNE: Output FIFO is not empty
emilmont 77:869cf507173a 272 * @arg CRYP_FLAG_OFFU: Output FIFO is full
emilmont 77:869cf507173a 273 * @arg CRYP_FLAG_OUTRIS: Input FIFO service raw interrupt is pending
emilmont 77:869cf507173a 274 * @retval The new state of __FLAG__ (TRUE or FALSE).
emilmont 77:869cf507173a 275 */
emilmont 77:869cf507173a 276 #define CRYP_FLAG_MASK ((uint32_t)0x0000001F)
emilmont 77:869cf507173a 277 #define __HAL_CRYP_GET_FLAG(__FLAG__) ((((uint8_t)((__FLAG__) >> 24)) == 0x01)?(((CRYP->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)): \
emilmont 77:869cf507173a 278 (((CRYP->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)))
emilmont 77:869cf507173a 279
emilmont 77:869cf507173a 280 /** @brief Check whether the specified CRYP interrupt is set or not.
emilmont 77:869cf507173a 281 * @param __INTERRUPT__: specifies the interrupt to check.
emilmont 77:869cf507173a 282 * This parameter can be one of the following values:
emilmont 77:869cf507173a 283 * @arg CRYP_IT_INRIS: Input FIFO service raw interrupt is pending
emilmont 77:869cf507173a 284 * @arg CRYP_IT_OUTRIS: Output FIFO service raw interrupt is pending
emilmont 77:869cf507173a 285 * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
emilmont 77:869cf507173a 286 */
emilmont 77:869cf507173a 287 #define __HAL_CRYP_GET_IT(__INTERRUPT__) ((CRYP->MISR & (__INTERRUPT__)) == (__INTERRUPT__))
emilmont 77:869cf507173a 288
emilmont 77:869cf507173a 289 /**
emilmont 77:869cf507173a 290 * @brief Enable the CRYP interrupt.
emilmont 77:869cf507173a 291 * @param __INTERRUPT__: CRYP Interrupt.
emilmont 77:869cf507173a 292 * @retval None
emilmont 77:869cf507173a 293 */
emilmont 77:869cf507173a 294 #define __HAL_CRYP_ENABLE_IT(__INTERRUPT__) ((CRYP->IMSCR) |= (__INTERRUPT__))
emilmont 77:869cf507173a 295
emilmont 77:869cf507173a 296 /**
emilmont 77:869cf507173a 297 * @brief Disable the CRYP interrupt.
emilmont 77:869cf507173a 298 * @param __INTERRUPT__: CRYP interrupt.
emilmont 77:869cf507173a 299 * @retval None
emilmont 77:869cf507173a 300 */
emilmont 77:869cf507173a 301 #define __HAL_CRYP_DISABLE_IT(__INTERRUPT__) ((CRYP->IMSCR) &= ~(__INTERRUPT__))
emilmont 77:869cf507173a 302
emilmont 77:869cf507173a 303 /* Include CRYP HAL Extension module */
emilmont 77:869cf507173a 304 #include "stm32f4xx_hal_cryp_ex.h"
emilmont 77:869cf507173a 305
emilmont 77:869cf507173a 306 /* Exported functions --------------------------------------------------------*/
emilmont 77:869cf507173a 307 /* Initialization/de-initialization functions **********************************/
emilmont 77:869cf507173a 308 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 309 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 310
emilmont 77:869cf507173a 311 /* AES encryption/decryption using polling ***********************************/
emilmont 77:869cf507173a 312 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 313 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
emilmont 77:869cf507173a 314 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 315 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
emilmont 77:869cf507173a 316 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 317 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
emilmont 77:869cf507173a 318
emilmont 77:869cf507173a 319 /* AES encryption/decryption using interrupt *********************************/
emilmont 77:869cf507173a 320 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 321 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 322 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 323 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 324 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 325 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 326
emilmont 77:869cf507173a 327 /* AES encryption/decryption using DMA ***************************************/
emilmont 77:869cf507173a 328 HAL_StatusTypeDef HAL_CRYP_AESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 329 HAL_StatusTypeDef HAL_CRYP_AESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 330 HAL_StatusTypeDef HAL_CRYP_AESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 331 HAL_StatusTypeDef HAL_CRYP_AESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 332 HAL_StatusTypeDef HAL_CRYP_AESCTR_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 333 HAL_StatusTypeDef HAL_CRYP_AESCTR_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 334
emilmont 77:869cf507173a 335 /* DES encryption/decryption using polling ***********************************/
emilmont 77:869cf507173a 336 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 337 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 338 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 339 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 340
emilmont 77:869cf507173a 341 /* DES encryption/decryption using interrupt *********************************/
emilmont 77:869cf507173a 342 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 343 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 344 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 345 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 346
emilmont 77:869cf507173a 347 /* DES encryption/decryption using DMA ***************************************/
emilmont 77:869cf507173a 348 HAL_StatusTypeDef HAL_CRYP_DESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 349 HAL_StatusTypeDef HAL_CRYP_DESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 350 HAL_StatusTypeDef HAL_CRYP_DESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 351 HAL_StatusTypeDef HAL_CRYP_DESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 352
emilmont 77:869cf507173a 353 /* TDES encryption/decryption using polling **********************************/
emilmont 77:869cf507173a 354 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 355 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout);
emilmont 77:869cf507173a 356 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
emilmont 77:869cf507173a 357 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout);
emilmont 77:869cf507173a 358
emilmont 77:869cf507173a 359 /* TDES encryption/decryption using interrupt ********************************/
emilmont 77:869cf507173a 360 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 361 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 362 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 363 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 364
emilmont 77:869cf507173a 365 /* TDES encryption/decryption using DMA **************************************/
emilmont 77:869cf507173a 366 HAL_StatusTypeDef HAL_CRYP_TDESECB_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 367 HAL_StatusTypeDef HAL_CRYP_TDESECB_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 368 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData);
emilmont 77:869cf507173a 369 HAL_StatusTypeDef HAL_CRYP_TDESCBC_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData);
emilmont 77:869cf507173a 370
emilmont 77:869cf507173a 371 /* Processing functions ********************************************************/
emilmont 77:869cf507173a 372 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 373
emilmont 77:869cf507173a 374 /* Peripheral State functions **************************************************/
emilmont 77:869cf507173a 375 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 376
emilmont 77:869cf507173a 377 /* MSP functions *************************************************************/
bogdanm 81:7d30d6019079 378 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
bogdanm 81:7d30d6019079 379 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 380
emilmont 77:869cf507173a 381 /* CallBack functions ********************************************************/
bogdanm 81:7d30d6019079 382 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
bogdanm 81:7d30d6019079 383 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
bogdanm 81:7d30d6019079 384 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
emilmont 77:869cf507173a 385
emilmont 77:869cf507173a 386 #endif /* STM32F415xx || STM32F417xx || STM32F437xx || STM32F439xx */
emilmont 77:869cf507173a 387
emilmont 77:869cf507173a 388 /**
emilmont 77:869cf507173a 389 * @}
emilmont 77:869cf507173a 390 */
emilmont 77:869cf507173a 391
emilmont 77:869cf507173a 392 /**
emilmont 77:869cf507173a 393 * @}
emilmont 77:869cf507173a 394 */
emilmont 77:869cf507173a 395
emilmont 77:869cf507173a 396 #ifdef __cplusplus
emilmont 77:869cf507173a 397 }
emilmont 77:869cf507173a 398 #endif
emilmont 77:869cf507173a 399
emilmont 77:869cf507173a 400 #endif /* __STM32F4xx_HAL_CRYP_H */
emilmont 77:869cf507173a 401
emilmont 77:869cf507173a 402 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/