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