1 /**
2   ******************************************************************************
3   * @file    stm32mp1xx_hal_cryp.h
4   * @author  MCD Application Team
5   * @brief   Header file of CRYP HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10   * All rights reserved.</center></h2>
11   *
12   * This software component is licensed by ST under BSD 3-Clause license,
13   * the "License"; You may not use this file except in compliance with the
14   * License. You may obtain a copy of the License at:
15   *                        opensource.org/licenses/BSD-3-Clause
16   *
17   ******************************************************************************
18   */
19 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32MP1xx_HAL_CRYP_H
22 #define STM32MP1xx_HAL_CRYP_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include "stm32mp1xx_hal_def.h"
31 
32 /** @addtogroup STM32MP1xx_HAL_Driver
33   * @{
34   */
35 #if defined (CRYP1) || defined (CRYP2)
36 /** @addtogroup CRYP
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup CRYP_Exported_Types CRYP Exported Types
42   * @{
43   */
44 
45 /**
46   * @brief CRYP Init Structure definition
47   */
48 
49 typedef struct
50 {
51   uint32_t DataType;                   /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string.
52                                         This parameter can be a value of @ref CRYP_Data_Type */
53   uint32_t KeySize;                    /*!< Used only in AES mode : 128, 192 or 256 bit key length in CRYP1.
54                                             This parameter can be a value of @ref CRYP_Key_Size */
55   uint32_t *pKey;                      /*!< The key used for encryption/decryption */
56   uint32_t *pInitVect;                 /*!< The initialization vector used also as initialization
57                                          counter in CTR mode */
58   uint32_t Algorithm;                  /*!<  DES/ TDES Algorithm ECB/CBC
59                                         AES Algorithm ECB/CBC/CTR/GCM or CCM
60                                         This parameter can be a value of @ref CRYP_Algorithm_Mode */
61   uint32_t *Header;                    /*!< used only in AES GCM and CCM Algorithm for authentication,
62                                         GCM : also known as Additional Authentication Data
63                                         CCM : named B1 composed of the associated data length and Associated Data. */
64   uint32_t HeaderSize;                /*!< The size of header buffer in word  */
65   uint32_t *B0;                       /*!< B0 is first authentication block used only  in AES CCM mode */
66   uint32_t DataWidthUnit;             /*!< Data With Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
67   uint32_t KeyIVConfigSkip;            /*!< CRYP peripheral Key and IV configuration skip, to config Key and Initialization
68                                            Vector only once and to skip configuration for consecutive processings.
69                                            This parameter can be a value of @ref CRYP_Configuration_Skip */
70 
71 } CRYP_ConfigTypeDef;
72 
73 
74 /**
75   * @brief  CRYP State Structure definition
76   */
77 
78 typedef enum
79 {
80   HAL_CRYP_STATE_RESET             = 0x00U,  /*!< CRYP not yet initialized or disabled  */
81   HAL_CRYP_STATE_READY             = 0x01U,  /*!< CRYP initialized and ready for use    */
82   HAL_CRYP_STATE_BUSY              = 0x02U  /*!< CRYP BUSY, internal processing is ongoing  */
83 } HAL_CRYP_STATETypeDef;
84 
85 
86 /**
87   * @brief  CRYP handle Structure definition
88   */
89 
90 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
91 typedef struct __CRYP_HandleTypeDef
92 #else
93 typedef struct
94 #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */
95 {
96 
97   CRYP_TypeDef                      *Instance;            /*!< CRYP registers base address */
98 
99   CRYP_ConfigTypeDef                Init;             /*!< CRYP required parameters */
100 
101   uint32_t                          *pCrypInBuffPtr;  /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
102 
103   uint32_t                          *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */
104 
105   __IO uint16_t                     CrypHeaderCount;   /*!< Counter of header data */
106 
107   __IO uint16_t                     CrypInCount;      /*!< Counter of input data */
108 
109   __IO uint16_t                     CrypOutCount;     /*!< Counter of output data */
110 
111   uint16_t                          Size;           /*!< length of input data in word */
112 
113   uint32_t                          Phase;            /*!< CRYP peripheral phase */
114 
115   DMA_HandleTypeDef                 *hdmain;          /*!< CRYP In DMA handle parameters */
116 
117   DMA_HandleTypeDef                 *hdmaout;         /*!< CRYP Out DMA handle parameters */
118 
119 #ifdef HAL_MDMA_MODULE_ENABLED
120   MDMA_HandleTypeDef                *hmdmain;         /*!< CRYP In MDMA handle parameters */
121 
122   MDMA_HandleTypeDef                *hmdmaout;        /*!< CRYP Out MDMA handle parameters */
123 #endif
124 
125 
126   HAL_LockTypeDef                   Lock;             /*!< CRYP locking object */
127 
128   __IO  HAL_CRYP_STATETypeDef       State;            /*!< CRYP peripheral state */
129 
130   __IO uint32_t                     ErrorCode;        /*!< CRYP peripheral error code */
131 
132   uint32_t                          Version;          /*!< CRYP1 IP version*/
133 
134   uint32_t                          KeyIVConfig;      /*!< CRYP peripheral Key and IV configuration flag, used when
135                                                            configuration can be skipped */
136 
137   uint32_t                          SizesSum;         /*!< Sum of successive payloads lengths (in bytes), stored
138                                                            for a single signature computation after several
139                                                            messages processing */
140 
141 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
142   void (*InCpltCallback)(struct __CRYP_HandleTypeDef *hcryp);      /*!< CRYP Input FIFO transfer completed callback  */
143   void (*OutCpltCallback)(struct __CRYP_HandleTypeDef *hcryp);     /*!< CRYP Output FIFO transfer completed callback */
144   void (*ErrorCallback)(struct __CRYP_HandleTypeDef *hcryp);       /*!< CRYP Error callback */
145 
146   void (* MspInitCallback)(struct __CRYP_HandleTypeDef *hcryp);    /*!< CRYP Msp Init callback  */
147   void (* MspDeInitCallback)(struct __CRYP_HandleTypeDef *hcryp);  /*!< CRYP Msp DeInit callback  */
148 
149 #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */
150 
151 } CRYP_HandleTypeDef;
152 
153 
154 /**
155   * @}
156   */
157 
158 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
159 /** @defgroup HAL_CRYP_Callback_ID_enumeration_definition HAL CRYP Callback ID enumeration definition
160   * @brief  HAL CRYP Callback ID enumeration definition
161   * @{
162   */
163 typedef enum
164 {
165   HAL_CRYP_INPUT_COMPLETE_CB_ID    = 0x01U,    /*!< CRYP Input FIFO transfer completed callback ID */
166   HAL_CRYP_OUTPUT_COMPLETE_CB_ID   = 0x02U,    /*!< CRYP Output FIFO transfer completed callback ID */
167   HAL_CRYP_ERROR_CB_ID             = 0x03U,    /*!< CRYP Error callback ID           */
168 
169   HAL_CRYP_MSPINIT_CB_ID        = 0x04U,    /*!< CRYP MspInit callback ID         */
170   HAL_CRYP_MSPDEINIT_CB_ID      = 0x05U     /*!< CRYP MspDeInit callback ID       */
171 
172 } HAL_CRYP_CallbackIDTypeDef;
173 /**
174   * @}
175   */
176 
177 /** @defgroup HAL_CRYP_Callback_pointer_definition HAL CRYP Callback pointer definition
178   * @brief  HAL CRYP Callback pointer definition
179   * @{
180   */
181 
182 typedef  void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp);    /*!< pointer to a common CRYP callback function */
183 
184 /**
185   * @}
186   */
187 
188 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
189 
190 /* Exported constants --------------------------------------------------------*/
191 /** @defgroup CRYP_Exported_Constants CRYP Exported Constants
192   * @{
193   */
194 
195 /** @defgroup CRYP_Error_Definition   CRYP Error Definition
196   * @{
197   */
198 #define HAL_CRYP_ERROR_NONE              0x00000000U  /*!< No error        */
199 #define HAL_CRYP_ERROR_WRITE             0x00000001U  /*!< Write error     */
200 #define HAL_CRYP_ERROR_READ              0x00000002U  /*!< Read error      */
201 #define HAL_CRYP_ERROR_DMA               0x00000004U  /*!< DMA error       */
202 #define HAL_CRYP_ERROR_BUSY              0x00000008U  /*!< Busy flag error */
203 #define HAL_CRYP_ERROR_TIMEOUT           0x00000010U  /*!< Timeout error */
204 #define HAL_CRYP_ERROR_NOT_SUPPORTED     0x00000020U  /*!< Not supported mode */
205 #define HAL_CRYP_ERROR_AUTH_TAG_SEQUENCE 0x00000040U  /*!< Sequence are not respected only for GCM or CCM */
206 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
207 #define  HAL_CRYP_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U)    /*!< Invalid Callback error  */
208 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
209 
210 /**
211   * @}
212   */
213 
214 
215 /** @defgroup CRYP_Data_Width_Unit CRYP Data Width Unit
216   * @{
217   */
218 
219 #define CRYP_DATAWIDTHUNIT_WORD   0x00000000U  /*!< By default, size unit is word */
220 #define CRYP_DATAWIDTHUNIT_BYTE   0x00000001U  /*!< By default, size unit is word */
221 
222 /**
223   * @}
224   */
225 
226 /** @defgroup CRYP_Algorithm_Mode CRYP Algorithm Mode
227   * @{
228   */
229 
230 #define CRYP_DES_ECB     CRYP_CR_ALGOMODE_DES_ECB
231 #define CRYP_DES_CBC     CRYP_CR_ALGOMODE_DES_CBC
232 #define CRYP_TDES_ECB    CRYP_CR_ALGOMODE_TDES_ECB
233 #define CRYP_TDES_CBC    CRYP_CR_ALGOMODE_TDES_CBC
234 #define CRYP_AES_ECB     CRYP_CR_ALGOMODE_AES_ECB
235 #define CRYP_AES_CBC     CRYP_CR_ALGOMODE_AES_CBC
236 #define CRYP_AES_CTR     CRYP_CR_ALGOMODE_AES_CTR
237 #define CRYP_AES_GCM     CRYP_CR_ALGOMODE_AES_GCM
238 #define CRYP_AES_CCM     CRYP_CR_ALGOMODE_AES_CCM
239 
240 /**
241   * @}
242   */
243 
244 /** @defgroup CRYP_Key_Size CRYP Key Size
245   * @{
246   */
247 
248 #define CRYP_KEYSIZE_128B         0x00000000U
249 #define CRYP_KEYSIZE_192B         CRYP_CR_KEYSIZE_0
250 #define CRYP_KEYSIZE_256B         CRYP_CR_KEYSIZE_1
251 
252 /**
253   * @}
254   */
255 
256 /** @defgroup CRYP_Data_Type CRYP Data Type
257   * @{
258   */
259 
260 #define CRYP_DATATYPE_32B         0x00000000U
261 #define CRYP_DATATYPE_16B         CRYP_CR_DATATYPE_0
262 #define CRYP_DATATYPE_8B          CRYP_CR_DATATYPE_1
263 #define CRYP_DATATYPE_1B          CRYP_CR_DATATYPE
264 
265 /**
266   * @}
267   */
268 
269 /** @defgroup CRYP_Interrupt  CRYP Interrupt
270   * @{
271   */
272 
273 #define CRYP_IT_INI       CRYP_IMSCR_INIM   /*!< Input FIFO Interrupt */
274 #define CRYP_IT_OUTI      CRYP_IMSCR_OUTIM  /*!< Output FIFO Interrupt */
275 
276 /**
277   * @}
278   */
279 
280 /** @defgroup CRYP_Flags CRYP Flags
281   * @{
282   */
283 
284 /* Flags in the SR register */
285 #define CRYP_FLAG_IFEM    CRYP_SR_IFEM  /*!< Input FIFO is empty */
286 #define CRYP_FLAG_IFNF    CRYP_SR_IFNF  /*!< Input FIFO is not Full */
287 #define CRYP_FLAG_OFNE    CRYP_SR_OFNE  /*!< Output FIFO is not empty */
288 #define CRYP_FLAG_OFFU    CRYP_SR_OFFU  /*!< Output FIFO is Full */
289 #define CRYP_FLAG_BUSY    CRYP_SR_BUSY  /*!< The CRYP core is currently processing a block of data
290                                              or a key preparation (for AES decryption). */
291 /* Flags in the RISR register */
292 #define CRYP_FLAG_OUTRIS  0x01000002U  /*!< Output FIFO service raw interrupt status */
293 #define CRYP_FLAG_INRIS   0x01000001U  /*!< Input FIFO service raw interrupt status*/
294 
295 /**
296   * @}
297   */
298 
299 /** @defgroup CRYP_Configuration_Skip CRYP Key and IV Configuration Skip Mode
300   * @{
301   */
302 
303 #define CRYP_KEYIVCONFIG_ALWAYS        0x00000000U            /*!< Peripheral Key and IV configuration to do systematically */
304 #define CRYP_KEYIVCONFIG_ONCE          0x00000001U            /*!< Peripheral Key and IV configuration to do only once      */
305 
306 /**
307   * @}
308   */
309 
310 /**
311   * @}
312   */
313 
314 /* Exported macros -----------------------------------------------------------*/
315 /** @defgroup CRYP_Exported_Macros CRYP Exported Macros
316   * @{
317   */
318 
319 /** @brief Reset CRYP handle state
320   * @param  __HANDLE__ specifies the CRYP handle.
321   * @retval None
322   */
323 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
324 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) do{\
325                                                       (__HANDLE__)->State = HAL_CRYP_STATE_RESET;\
326                                                       (__HANDLE__)->MspInitCallback = NULL;\
327                                                       (__HANDLE__)->MspDeInitCallback = NULL;\
328                                                      }while(0)
329 #else
330 #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_CRYP_STATE_RESET)
331 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
332 
333 /**
334   * @brief  Enable/Disable the CRYP peripheral.
335   * @param  __HANDLE__: specifies the CRYP handle.
336   * @retval None
337   */
338 
339 #define __HAL_CRYP_ENABLE(__HANDLE__)  ((__HANDLE__)->Instance->CR |=  CRYP_CR_CRYPEN)
340 #define __HAL_CRYP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &=  ~CRYP_CR_CRYPEN)
341 
342 /** @brief  Check whether the specified CRYP status flag is set or not.
343   * @param  __FLAG__: specifies the flag to check.
344   *         This parameter can be one of the following values for CRYP:
345   *            @arg CRYP_FLAG_BUSY: The CRYP core is currently processing a block of data
346   *                                 or a key preparation (for AES decryption).
347   *            @arg CRYP_FLAG_IFEM: Input FIFO is empty
348   *            @arg CRYP_FLAG_IFNF: Input FIFO is not full
349   *            @arg CRYP_FLAG_INRIS: Input FIFO service raw interrupt is pending
350   *            @arg CRYP_FLAG_OFNE: Output FIFO is not empty
351   *            @arg CRYP_FLAG_OFFU: Output FIFO is full
352   *            @arg CRYP_FLAG_OUTRIS: Input FIFO service raw interrupt is pending
353   * @retval The state of __FLAG__ (TRUE or FALSE).
354   */
355 #define CRYP_FLAG_MASK  0x0000001FU
356 
357 #define __HAL_CRYP_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 24)) == 0x01U)?((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)): \
358                                                    ((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)))
359 
360 /** @brief  Check whether the specified CRYP interrupt is set or not.
361   * @param  __HANDLE__: specifies the CRYP handle.
362   * @param  __INTERRUPT__: specifies the interrupt to check.
363   *         This parameter can be one of the following values for CRYP:
364   *            @arg CRYP_IT_INI: Input FIFO service masked interrupt status
365   *            @arg CRYP_IT_OUTI: Output FIFO service masked interrupt status
366   * @retval The state of __INTERRUPT__ (TRUE or FALSE).
367   */
368 
369 #define __HAL_CRYP_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) == (__INTERRUPT__))
370 
371 /**
372   * @brief  Enable the CRYP interrupt.
373   * @param  __HANDLE__: specifies the CRYP handle.
374   * @param  __INTERRUPT__: CRYP Interrupt.
375   *         This parameter can be one of the following values for CRYP:
376   *            @ CRYP_IT_INI : Input FIFO service interrupt mask.
377   *            @ CRYP_IT_OUTI : Output FIFO service interrupt mask.CRYP interrupt.
378   * @retval None
379   */
380 
381 #define __HAL_CRYP_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) |= (__INTERRUPT__))
382 
383 /**
384   * @brief  Disable the CRYP interrupt.
385   * @param  __HANDLE__: specifies the CRYP handle.
386   * @param  __INTERRUPT__: CRYP Interrupt.
387   *         This parameter can be one of the following values for CRYP:
388   *            @ CRYP_IT_INI : Input FIFO service interrupt mask.
389   *            @ CRYP_IT_OUTI : Output FIFO service interrupt mask.CRYP interrupt.
390   * @retval None
391   */
392 
393 #define __HAL_CRYP_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IMSCR) &= ~(__INTERRUPT__))
394 
395 /**
396   * @}
397   */
398 
399 /* Include CRYP HAL Extended module */
400 #include "stm32mp1xx_hal_cryp_ex.h"
401 
402 /* Exported functions --------------------------------------------------------*/
403 /** @defgroup CRYP_Exported_Functions CRYP Exported Functions
404   * @{
405   */
406 
407 /** @addtogroup CRYP_Exported_Functions_Group1
408   * @{
409   */
410 HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp);
411 HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp);
412 void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp);
413 void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp);
414 HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf);
415 HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf);
416 #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
417 HAL_StatusTypeDef HAL_CRYP_RegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID,
418                                             pCRYP_CallbackTypeDef pCallback);
419 HAL_StatusTypeDef HAL_CRYP_UnRegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID);
420 #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */
421 /**
422   * @}
423   */
424 
425 /** @addtogroup CRYP_Exported_Functions_Group2
426   * @{
427   */
428 
429 /* encryption/decryption ***********************************/
430 HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output,
431                                    uint32_t Timeout);
432 HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output,
433                                    uint32_t Timeout);
434 HAL_StatusTypeDef HAL_CRYP_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
435 HAL_StatusTypeDef HAL_CRYP_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
436 HAL_StatusTypeDef HAL_CRYP_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
437 HAL_StatusTypeDef HAL_CRYP_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output);
438 
439 /**
440   * @}
441   */
442 
443 
444 /** @addtogroup CRYP_Exported_Functions_Group3
445   * @{
446   */
447 /* Interrupt Handler functions  **********************************************/
448 void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp);
449 HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp);
450 void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp);
451 void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp);
452 void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp);
453 uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
454 
455 /**
456   * @}
457   */
458 
459 /**
460   * @}
461   */
462 
463 /* Private macros --------------------------------------------------------*/
464 /** @defgroup CRYP_Private_Macros   CRYP Private Macros
465   * @{
466   */
467 
468 /** @defgroup CRYP_IS_CRYP_Definitions CRYP Private macros to check input parameters
469   * @{
470   */
471 
472 #define IS_CRYP_ALGORITHM(ALGORITHM) (((ALGORITHM) == CRYP_DES_ECB)   || \
473                                       ((ALGORITHM)  == CRYP_DES_CBC)   || \
474                                       ((ALGORITHM)  == CRYP_TDES_ECB)  || \
475                                       ((ALGORITHM)  == CRYP_TDES_CBC)  || \
476                                       ((ALGORITHM)  == CRYP_AES_ECB)   || \
477                                       ((ALGORITHM)  == CRYP_AES_CBC)   || \
478                                       ((ALGORITHM)  == CRYP_AES_CTR)   || \
479                                       ((ALGORITHM)  == CRYP_AES_GCM)   || \
480                                       ((ALGORITHM)  == CRYP_AES_CCM))
481 
482 #define IS_CRYP_KEYSIZE(KEYSIZE)(((KEYSIZE) == CRYP_KEYSIZE_128B)   || \
483                                  ((KEYSIZE) == CRYP_KEYSIZE_192B)   || \
484                                  ((KEYSIZE) == CRYP_KEYSIZE_256B))
485 
486 #define IS_CRYP_DATATYPE(DATATYPE)(((DATATYPE) == CRYP_DATATYPE_32B)   || \
487                                    ((DATATYPE) == CRYP_DATATYPE_16B) || \
488                                    ((DATATYPE) == CRYP_DATATYPE_8B) || \
489                                    ((DATATYPE) == CRYP_DATATYPE_1B))
490 
491 #define IS_CRYP_INIT(CONFIG)(((CONFIG) == CRYP_KEYIVCONFIG_ALWAYS) || \
492                              ((CONFIG) == CRYP_KEYIVCONFIG_ONCE))
493 
494 /**
495   * @}
496   */
497 
498 /**
499   * @}
500   */
501 
502 
503 /* Private constants ---------------------------------------------------------*/
504 /** @defgroup CRYP_Private_Constants CRYP Private Constants
505   * @{
506   */
507 
508 /**
509   * @}
510   */
511 /* Private defines -----------------------------------------------------------*/
512 /** @defgroup CRYP_Private_Defines CRYP Private Defines
513   * @{
514   */
515 
516 /**
517   * @}
518   */
519 
520 /* Private variables ---------------------------------------------------------*/
521 /** @defgroup CRYP_Private_Variables CRYP Private Variables
522   * @{
523   */
524 
525 /**
526   * @}
527   */
528 /* Private functions prototypes ----------------------------------------------*/
529 /** @defgroup CRYP_Private_Functions_Prototypes CRYP Private Functions Prototypes
530   * @{
531   */
532 
533 /**
534   * @}
535   */
536 
537 /* Private functions ---------------------------------------------------------*/
538 /** @defgroup CRYP_Private_Functions CRYP Private Functions
539   * @{
540   */
541 
542 /**
543   * @}
544   */
545 
546 
547 /**
548   * @}
549   */
550 
551 
552 #endif /* CRYP1 || CRYP2 */
553 /**
554   * @}
555   */
556 
557 #ifdef __cplusplus
558 }
559 #endif
560 
561 #endif /* STM32MP1xx_HAL_CRYP_H */
562 
563 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
564