STM32H735xx HAL User Manual
stm32h7xx_hal_cryp.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_cryp.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of CRYP HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_HAL_CRYP_H
00021 #define STM32H7xx_HAL_CRYP_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 
00028 /* Includes ------------------------------------------------------------------*/
00029 #include "stm32h7xx_hal_def.h"
00030 
00031 /** @addtogroup STM32H7xx_HAL_Driver
00032   * @{
00033   */
00034 #if defined (CRYP)
00035 /** @addtogroup CRYP
00036   * @{
00037   */
00038 
00039 /* Exported types ------------------------------------------------------------*/
00040 /** @defgroup CRYP_Exported_Types CRYP Exported Types
00041   * @{
00042   */
00043 
00044 /**
00045   * @brief CRYP Init Structure definition
00046   */
00047 
00048 typedef struct
00049 {
00050   uint32_t DataType;                   /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
00051                                         This parameter can be a value of @ref CRYP_Data_Type */
00052   uint32_t KeySize;                    /*!< Used only in AES mode : 128, 192 or 256 bit key length in CRYP1.
00053                                             This parameter can be a value of @ref CRYP_Key_Size */
00054   uint32_t *pKey;                      /*!< The key used for encryption/decryption */
00055   uint32_t *pInitVect;                 /*!< The initialization vector used also as initialization
00056                                          counter in CTR mode */
00057   uint32_t Algorithm;                  /*!<  DES/ TDES Algorithm ECB/CBC
00058                                         AES Algorithm ECB/CBC/CTR/GCM or CCM
00059                                         This parameter can be a value of @ref CRYP_Algorithm_Mode */
00060   uint32_t *Header;                    /*!< used only in AES GCM and CCM Algorithm for authentication,
00061                                         GCM : also known as Additional Authentication Data
00062                                         CCM : named B1 composed of the associated data length and Associated Data. */
00063   uint32_t HeaderSize;                /*!< The size of header buffer */
00064   uint32_t *B0;                       /*!< B0 is first authentication block used only  in AES CCM mode */
00065   uint32_t DataWidthUnit;             /*!< Payload data Width Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
00066   uint32_t HeaderWidthUnit;            /*!< Header Width Unit, this parameter can be value of @ref CRYP_Header_Width_Unit*/
00067   uint32_t KeyIVConfigSkip;            /*!< CRYP peripheral Key and IV configuration skip, to configure Key and Initialization
00068                                            Vector only once and to skip configuration for consecutive processing.
00069                                            This parameter can be a value of @ref CRYP_Configuration_Skip */
00070 
00071 } CRYP_ConfigTypeDef;
00072 
00073 
00074 /**
00075   * @brief  CRYP State Structure definition
00076   */
00077 
00078 typedef enum
00079 {
00080   HAL_CRYP_STATE_RESET             = 0x00U,  /*!< CRYP not yet initialized or disabled  */
00081   HAL_CRYP_STATE_READY             = 0x01U,  /*!< CRYP initialized and ready for use    */
00082   HAL_CRYP_STATE_BUSY              = 0x02U  /*!< CRYP BUSY, internal processing is ongoing  */
00083 } HAL_CRYP_STATETypeDef;
00084 
00085 
00086 /**
00087   * @brief  CRYP handle Structure definition
00088   */
00089 
00090 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00091 typedef struct __CRYP_HandleTypeDef
00092 #else
00093 typedef struct
00094 #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */
00095 {
00096 
00097   CRYP_TypeDef                      *Instance;            /*!< CRYP registers base address */
00098 
00099   CRYP_ConfigTypeDef                Init;             /*!< CRYP required parameters */
00100 
00101   uint32_t                          *pCrypInBuffPtr;  /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
00102 
00103   uint32_t                          *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
00104 
00105   __IO uint16_t                     CrypHeaderCount;   /*!< Counter of header data */
00106 
00107   __IO uint16_t                     CrypInCount;      /*!< Counter of input data */
00108 
00109   __IO uint16_t                     CrypOutCount;     /*!< Counter of output data */
00110 
00111   uint16_t                          Size;           /*!< length of input data in word or in byte, according to DataWidthUnit */
00112 
00113   uint32_t                          Phase;            /*!< CRYP peripheral phase */
00114 
00115   DMA_HandleTypeDef                 *hdmain;          /*!< CRYP In DMA handle parameters */
00116 
00117   DMA_HandleTypeDef                 *hdmaout;         /*!< CRYP Out DMA handle parameters */
00118 
00119   HAL_LockTypeDef                   Lock;             /*!< CRYP locking object */
00120 
00121   __IO  HAL_CRYP_STATETypeDef       State;            /*!< CRYP peripheral state */
00122 
00123   __IO uint32_t                     ErrorCode;        /*!< CRYP peripheral error code */
00124 
00125   uint32_t                          Version;          /*!< CRYP1 IP version*/
00126 
00127   uint32_t                          KeyIVConfig;      /*!< CRYP peripheral Key and IV configuration flag, used when
00128                                                            configuration can be skipped */
00129 
00130   uint32_t                          SizesSum;         /*!< Sum of successive payloads lengths (in bytes), stored
00131                                                            for a single signature computation after several
00132                                                            messages processing */
00133 
00134 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00135   void (*InCpltCallback)(struct __CRYP_HandleTypeDef *hcryp);      /*!< CRYP Input FIFO transfer completed callback  */
00136   void (*OutCpltCallback)(struct __CRYP_HandleTypeDef *hcryp);     /*!< CRYP Output FIFO transfer completed callback */
00137   void (*ErrorCallback)(struct __CRYP_HandleTypeDef *hcryp);       /*!< CRYP Error callback */
00138 
00139   void (* MspInitCallback)(struct __CRYP_HandleTypeDef *hcryp);    /*!< CRYP Msp Init callback  */
00140   void (* MspDeInitCallback)(struct __CRYP_HandleTypeDef *hcryp);  /*!< CRYP Msp DeInit callback  */
00141 
00142 #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */
00143 
00144 } CRYP_HandleTypeDef;
00145 
00146 
00147 /**
00148   * @}
00149   */
00150 
00151 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00152 /** @defgroup HAL_CRYP_Callback_ID_enumeration_definition HAL CRYP Callback ID enumeration definition
00153   * @brief  HAL CRYP Callback ID enumeration definition
00154   * @{
00155   */
00156 typedef enum
00157 {
00158   HAL_CRYP_INPUT_COMPLETE_CB_ID    = 0x01U,    /*!< CRYP Input FIFO transfer completed callback ID */
00159   HAL_CRYP_OUTPUT_COMPLETE_CB_ID   = 0x02U,    /*!< CRYP Output FIFO transfer completed callback ID */
00160   HAL_CRYP_ERROR_CB_ID             = 0x03U,    /*!< CRYP Error callback ID           */
00161 
00162   HAL_CRYP_MSPINIT_CB_ID        = 0x04U,    /*!< CRYP MspInit callback ID         */
00163   HAL_CRYP_MSPDEINIT_CB_ID      = 0x05U     /*!< CRYP MspDeInit callback ID       */
00164 
00165 } HAL_CRYP_CallbackIDTypeDef;
00166 /**
00167   * @}
00168   */
00169 
00170 /** @defgroup HAL_CRYP_Callback_pointer_definition HAL CRYP Callback pointer definition
00171   * @brief  HAL CRYP Callback pointer definition
00172   * @{
00173   */
00174 
00175 typedef  void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp);    /*!< pointer to a common CRYP callback function */
00176 
00177 /**
00178   * @}
00179   */
00180 
00181 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
00182 
00183 /* Exported constants --------------------------------------------------------*/
00184 /** @defgroup CRYP_Exported_Constants CRYP Exported Constants
00185   * @{
00186   */
00187 
00188 /** @defgroup CRYP_Error_Definition   CRYP Error Definition
00189   * @{
00190   */
00191 #define HAL_CRYP_ERROR_NONE              0x00000000U  /*!< No error        */
00192 #define HAL_CRYP_ERROR_WRITE             0x00000001U  /*!< Write error     */
00193 #define HAL_CRYP_ERROR_READ              0x00000002U  /*!< Read error      */
00194 #define HAL_CRYP_ERROR_DMA               0x00000004U  /*!< DMA error       */
00195 #define HAL_CRYP_ERROR_BUSY              0x00000008U  /*!< Busy flag error */
00196 #define HAL_CRYP_ERROR_TIMEOUT           0x00000010U  /*!< Timeout error */
00197 #define HAL_CRYP_ERROR_NOT_SUPPORTED     0x00000020U  /*!< Not supported mode */
00198 #define HAL_CRYP_ERROR_AUTH_TAG_SEQUENCE 0x00000040U  /*!< Sequence are not respected only for GCM or CCM */
00199 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00200 #define  HAL_CRYP_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U)    /*!< Invalid Callback error  */
00201 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
00202 
00203 /**
00204   * @}
00205   */
00206 
00207 
00208 /** @defgroup CRYP_Data_Width_Unit CRYP Data Width Unit
00209   * @{
00210   */
00211 
00212 #define CRYP_DATAWIDTHUNIT_WORD   0x00000000U  /*!< By default, size unit is word */
00213 #define CRYP_DATAWIDTHUNIT_BYTE   0x00000001U  /*!< By default, size unit is word */
00214 
00215 /**
00216   * @}
00217   */
00218 
00219 /** @defgroup CRYP_Header_Width_Unit CRYP Header Width Unit
00220   * @{
00221   */
00222 
00223 #define CRYP_HEADERWIDTHUNIT_WORD   0x00000000U  /*!< By default, header size unit is word */
00224 #define CRYP_HEADERWIDTHUNIT_BYTE   0x00000001U  /*!< By default, header size unit is byte */
00225 
00226 /**
00227   * @}
00228   */
00229 
00230 /** @defgroup CRYP_Algorithm_Mode CRYP Algorithm Mode
00231   * @{
00232   */
00233 
00234 #define CRYP_DES_ECB     CRYP_CR_ALGOMODE_DES_ECB
00235 #define CRYP_DES_CBC     CRYP_CR_ALGOMODE_DES_CBC
00236 #define CRYP_TDES_ECB    CRYP_CR_ALGOMODE_TDES_ECB
00237 #define CRYP_TDES_CBC    CRYP_CR_ALGOMODE_TDES_CBC
00238 #define CRYP_AES_ECB     CRYP_CR_ALGOMODE_AES_ECB
00239 #define CRYP_AES_CBC     CRYP_CR_ALGOMODE_AES_CBC
00240 #define CRYP_AES_CTR     CRYP_CR_ALGOMODE_AES_CTR
00241 #define CRYP_AES_GCM     CRYP_CR_ALGOMODE_AES_GCM
00242 #define CRYP_AES_CCM     CRYP_CR_ALGOMODE_AES_CCM
00243 
00244 /**
00245   * @}
00246   */
00247 
00248 /** @defgroup CRYP_Key_Size CRYP Key Size
00249   * @{
00250   */
00251 
00252 #define CRYP_KEYSIZE_128B         0x00000000U
00253 #define CRYP_KEYSIZE_192B         CRYP_CR_KEYSIZE_0
00254 #define CRYP_KEYSIZE_256B         CRYP_CR_KEYSIZE_1
00255 
00256 /**
00257   * @}
00258   */
00259 
00260 /** @defgroup CRYP_Data_Type CRYP Data Type
00261   * @{
00262   */
00263 
00264 #define CRYP_DATATYPE_32B         0x00000000U
00265 #define CRYP_DATATYPE_16B         CRYP_CR_DATATYPE_0
00266 #define CRYP_DATATYPE_8B          CRYP_CR_DATATYPE_1
00267 #define CRYP_DATATYPE_1B          CRYP_CR_DATATYPE
00268 
00269 /**
00270   * @}
00271   */
00272 
00273 /** @defgroup CRYP_Interrupt  CRYP Interrupt
00274   * @{
00275   */
00276 
00277 #define CRYP_IT_INI       CRYP_IMSCR_INIM   /*!< Input FIFO Interrupt */
00278 #define CRYP_IT_OUTI      CRYP_IMSCR_OUTIM  /*!< Output FIFO Interrupt */
00279 
00280 /**
00281   * @}
00282   */
00283 
00284 /** @defgroup CRYP_Flags CRYP Flags
00285   * @{
00286   */
00287 
00288 /* Flags in the SR register */
00289 #define CRYP_FLAG_IFEM    CRYP_SR_IFEM  /*!< Input FIFO is empty */
00290 #define CRYP_FLAG_IFNF    CRYP_SR_IFNF  /*!< Input FIFO is not Full */
00291 #define CRYP_FLAG_OFNE    CRYP_SR_OFNE  /*!< Output FIFO is not empty */
00292 #define CRYP_FLAG_OFFU    CRYP_SR_OFFU  /*!< Output FIFO is Full */
00293 #define CRYP_FLAG_BUSY    CRYP_SR_BUSY  /*!< The CRYP core is currently processing a block of data
00294                                              or a key preparation (for AES decryption). */
00295 /* Flags in the RISR register */
00296 #define CRYP_FLAG_OUTRIS  0x01000002U  /*!< Output FIFO service raw interrupt status */
00297 #define CRYP_FLAG_INRIS   0x01000001U  /*!< Input FIFO service raw interrupt status*/
00298 
00299 /**
00300   * @}
00301   */
00302 
00303 /** @defgroup CRYP_Configuration_Skip CRYP Key and IV Configuration Skip Mode
00304   * @{
00305   */
00306 
00307 #define CRYP_KEYIVCONFIG_ALWAYS        0x00000000U            /*!< Peripheral Key and IV configuration to do systematically */
00308 #define CRYP_KEYIVCONFIG_ONCE          0x00000001U            /*!< Peripheral Key and IV configuration to do only once      */
00309 
00310 /**
00311   * @}
00312   */
00313 
00314 /**
00315   * @}
00316   */
00317 
00318 /* Exported macros -----------------------------------------------------------*/
00319 /** @defgroup CRYP_Exported_Macros CRYP Exported Macros
00320   * @{
00321   */
00322 
00323 /** @brief Reset CRYP handle state
00324   * @param  __HANDLE__ specifies the CRYP handle.
00325   * @retval None
00326   */
00327 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00328 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) do{\
00329                                                       (__HANDLE__)->State = HAL_CRYP_STATE_RESET;\
00330                                                       (__HANDLE__)->MspInitCallback = NULL;\
00331                                                       (__HANDLE__)->MspDeInitCallback = NULL;\
00332                                                      }while(0)
00333 #else
00334 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_CRYP_STATE_RESET)
00335 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
00336 
00337 /**
00338   * @brief  Enable/Disable the CRYP peripheral.
00339   * @param  __HANDLE__: specifies the CRYP handle.
00340   * @retval None
00341   */
00342 
00343 #define __HAL_CRYP_ENABLE(__HANDLE__)  ((__HANDLE__)->Instance->CR |=  CRYP_CR_CRYPEN)
00344 #define __HAL_CRYP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &=  ~CRYP_CR_CRYPEN)
00345 
00346 /** @brief  Check whether the specified CRYP status flag is set or not.
00347   * @param  __FLAG__: specifies the flag to check.
00348   *         This parameter can be one of the following values for CRYP:
00349   *            @arg CRYP_FLAG_BUSY: The CRYP core is currently processing a block of data
00350   *                                 or a key preparation (for AES decryption).
00351   *            @arg CRYP_FLAG_IFEM: Input FIFO is empty
00352   *            @arg CRYP_FLAG_IFNF: Input FIFO is not full
00353   *            @arg CRYP_FLAG_INRIS: Input FIFO service raw interrupt is pending
00354   *            @arg CRYP_FLAG_OFNE: Output FIFO is not empty
00355   *            @arg CRYP_FLAG_OFFU: Output FIFO is full
00356   *            @arg CRYP_FLAG_OUTRIS: Input FIFO service raw interrupt is pending
00357   * @retval The state of __FLAG__ (TRUE or FALSE).
00358   */
00359 #define CRYP_FLAG_MASK  0x0000001FU
00360 
00361 #define __HAL_CRYP_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 24)) == 0x01U)?((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)): \
00362                                                    ((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)))
00363 
00364 /** @brief  Check whether the specified CRYP interrupt is set or not.
00365   * @param  __HANDLE__: specifies the CRYP handle.
00366   * @param  __INTERRUPT__: specifies the interrupt to check.
00367   *         This parameter can be one of the following values for CRYP:
00368   *            @arg CRYP_IT_INI: Input FIFO service masked interrupt status
00369   *            @arg CRYP_IT_OUTI: Output FIFO service masked interrupt status
00370   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
00371   */
00372 
00373 #define __HAL_CRYP_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) == (__INTERRUPT__))
00374 
00375 /**
00376   * @brief  Enable the CRYP interrupt.
00377   * @param  __HANDLE__: specifies the CRYP handle.
00378   * @param  __INTERRUPT__: CRYP Interrupt.
00379   *         This parameter can be one of the following values for CRYP:
00380   *            @ CRYP_IT_INI : Input FIFO service interrupt mask.
00381   *            @ CRYP_IT_OUTI : Output FIFO service interrupt mask.CRYP interrupt.
00382   * @retval None
00383   */
00384 
00385 #define __HAL_CRYP_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) |= (__INTERRUPT__))
00386 
00387 /**
00388   * @brief  Disable the CRYP interrupt.
00389   * @param  __HANDLE__: specifies the CRYP handle.
00390   * @param  __INTERRUPT__: CRYP Interrupt.
00391   *         This parameter can be one of the following values for CRYP:
00392   *            @ CRYP_IT_INI : Input FIFO service interrupt mask.
00393   *            @ CRYP_IT_OUTI : Output FIFO service interrupt mask.CRYP interrupt.
00394   * @retval None
00395   */
00396 
00397 #define __HAL_CRYP_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) &= ~(__INTERRUPT__))
00398 
00399 /**
00400   * @}
00401   */
00402 
00403 /* Include CRYP HAL Extended module */
00404 #include "stm32h7xx_hal_cryp_ex.h"
00405 
00406 /* Exported functions --------------------------------------------------------*/
00407 /** @defgroup CRYP_Exported_Functions CRYP Exported Functions
00408   * @{
00409   */
00410 
00411 /** @addtogroup CRYP_Exported_Functions_Group1
00412   * @{
00413   */
00414 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
00415 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
00416 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
00417 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
00418 HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf);
00419 HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf);
00420 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
00421 HAL_StatusTypeDef HAL_CRYP_RegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID,
00422                                             pCRYP_CallbackTypeDef pCallback);
00423 HAL_StatusTypeDef HAL_CRYP_UnRegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID);
00424 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
00425 /**
00426   * @}
00427   */
00428 
00429 /** @addtogroup CRYP_Exported_Functions_Group2
00430   * @{
00431   */
00432 
00433 /* encryption/decryption ***********************************/
00434 HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output,
00435                                    uint32_t Timeout);
00436 HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output,
00437                                    uint32_t Timeout);
00438 HAL_StatusTypeDef HAL_CRYP_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
00439 HAL_StatusTypeDef HAL_CRYP_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
00440 HAL_StatusTypeDef HAL_CRYP_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
00441 HAL_StatusTypeDef HAL_CRYP_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
00442 
00443 /**
00444   * @}
00445   */
00446 
00447 
00448 /** @addtogroup CRYP_Exported_Functions_Group3
00449   * @{
00450   */
00451 /* Interrupt Handler functions  **********************************************/
00452 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
00453 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
00454 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
00455 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
00456 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
00457 uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
00458 
00459 /**
00460   * @}
00461   */
00462 
00463 /**
00464   * @}
00465   */
00466 
00467 /* Private macros --------------------------------------------------------*/
00468 /** @defgroup CRYP_Private_Macros   CRYP Private Macros
00469   * @{
00470   */
00471 
00472 /** @defgroup CRYP_IS_CRYP_Definitions CRYP Private macros to check input parameters
00473   * @{
00474   */
00475 
00476 #define IS_CRYP_ALGORITHM(ALGORITHM) (((ALGORITHM) == CRYP_DES_ECB)   || \
00477                                       ((ALGORITHM)  == CRYP_DES_CBC)   || \
00478                                       ((ALGORITHM)  == CRYP_TDES_ECB)  || \
00479                                       ((ALGORITHM)  == CRYP_TDES_CBC)  || \
00480                                       ((ALGORITHM)  == CRYP_AES_ECB)   || \
00481                                       ((ALGORITHM)  == CRYP_AES_CBC)   || \
00482                                       ((ALGORITHM)  == CRYP_AES_CTR)   || \
00483                                       ((ALGORITHM)  == CRYP_AES_GCM)   || \
00484                                       ((ALGORITHM)  == CRYP_AES_CCM))
00485 
00486 #define IS_CRYP_KEYSIZE(KEYSIZE)(((KEYSIZE) == CRYP_KEYSIZE_128B)   || \
00487                                  ((KEYSIZE) == CRYP_KEYSIZE_192B)   || \
00488                                  ((KEYSIZE) == CRYP_KEYSIZE_256B))
00489 
00490 #define IS_CRYP_DATATYPE(DATATYPE)(((DATATYPE) == CRYP_DATATYPE_32B)   || \
00491                                    ((DATATYPE) == CRYP_DATATYPE_16B) || \
00492                                    ((DATATYPE) == CRYP_DATATYPE_8B) || \
00493                                    ((DATATYPE) == CRYP_DATATYPE_1B))
00494 
00495 #define IS_CRYP_INIT(CONFIG)(((CONFIG) == CRYP_KEYIVCONFIG_ALWAYS) || \
00496                              ((CONFIG) == CRYP_KEYIVCONFIG_ONCE))
00497 
00498 /**
00499   * @}
00500   */
00501 
00502 /**
00503   * @}
00504   */
00505 
00506 
00507 /* Private constants ---------------------------------------------------------*/
00508 /** @defgroup CRYP_Private_Constants CRYP Private Constants
00509   * @{
00510   */
00511 
00512 /**
00513   * @}
00514   */
00515 /* Private defines -----------------------------------------------------------*/
00516 /** @defgroup CRYP_Private_Defines CRYP Private Defines
00517   * @{
00518   */
00519 
00520 /**
00521   * @}
00522   */
00523 
00524 /* Private variables ---------------------------------------------------------*/
00525 /** @defgroup CRYP_Private_Variables CRYP Private Variables
00526   * @{
00527   */
00528 
00529 /**
00530   * @}
00531   */
00532 /* Private functions prototypes ----------------------------------------------*/
00533 /** @defgroup CRYP_Private_Functions_Prototypes CRYP Private Functions Prototypes
00534   * @{
00535   */
00536 
00537 /**
00538   * @}
00539   */
00540 
00541 /* Private functions ---------------------------------------------------------*/
00542 /** @defgroup CRYP_Private_Functions CRYP Private Functions
00543   * @{
00544   */
00545 
00546 /**
00547   * @}
00548   */
00549 
00550 
00551 /**
00552   * @}
00553   */
00554 
00555 
00556 #endif /* CRYP */
00557 /**
00558   * @}
00559   */
00560 
00561 #ifdef __cplusplus
00562 }
00563 #endif
00564 
00565 #endif /* STM32H7xx_HAL_CRYP_H */
00566