@@ -64,9 +64,10 @@ typedef struct
64
64
uint32_t * Header ; /*!< used only in AES GCM and CCM Algorithm for authentication,
65
65
GCM : also known as Additional Authentication Data
66
66
CCM : named B1 composed of the associated data length and Associated Data. */
67
- uint32_t HeaderSize ; /*!< The size of header buffer in word */
67
+ uint32_t HeaderSize ; /*!< The size of header buffer */
68
68
uint32_t * B0 ; /*!< B0 is first authentication block used only in AES CCM mode */
69
- uint32_t DataWidthUnit ; /*!< Data With Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
69
+ uint32_t DataWidthUnit ; /*!< Payload Data Width Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/
70
+ uint32_t HeaderWidthUnit ; /*!< Header Width Unit, this parameter can be value of @ref CRYP_Header_Width_Unit*/
70
71
uint32_t KeyIVConfigSkip ; /*!< CRYP peripheral Key and IV configuration skip, to config Key and Initialization
71
72
Vector only once and to skip configuration for consecutive processings.
72
73
This parameter can be a value of @ref CRYP_Configuration_Skip */
@@ -182,10 +183,12 @@ typedef struct
182
183
183
184
uint32_t Key_saved [8 ]; /*!< copy of key registers */
184
185
185
- uint32_t Size_saved ; /*!< copy of input buffer size */
186
+ uint16_t Size_saved ; /*!< copy of input buffer size */
186
187
187
188
uint16_t CrypHeaderCount_saved ; /*!< copy of CRYP header data counter when processing is suspended */
188
189
190
+ uint32_t SizesSum_saved ; /*!< copy of SizesSum when processing is suspended */
191
+
189
192
uint32_t ResumingFlag ; /*!< resumption flag to bypass steps already carried out */
190
193
191
194
FunctionalState AutoKeyDerivation_saved ; /*!< copy of CRYP handle auto key derivation parameter */
@@ -259,6 +262,17 @@ typedef void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp); /*!< point
259
262
#define CRYP_DATAWIDTHUNIT_WORD 0x00000000U /*!< By default, size unit is word */
260
263
#define CRYP_DATAWIDTHUNIT_BYTE 0x00000001U /*!< By default, size unit is byte */
261
264
265
+ /**
266
+ * @}
267
+ */
268
+
269
+ /** @defgroup CRYP_Header_Width_Unit CRYP Header Width Unit
270
+ * @{
271
+ */
272
+
273
+ #define CRYP_HEADERWIDTHUNIT_WORD 0x00000000U /*!< By default, header size unit is word */
274
+ #define CRYP_HEADERWIDTHUNIT_BYTE 0x00000001U /*!< By default, header size unit is byte */
275
+
262
276
/**
263
277
* @}
264
278
*/
@@ -565,6 +579,13 @@ uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
565
579
#define IS_CRYP_INIT (CONFIG )(((CONFIG) == CRYP_KEYIVCONFIG_ALWAYS) || \
566
580
((CONFIG) == CRYP_KEYIVCONFIG_ONCE))
567
581
582
+ #define IS_CRYP_BUFFERSIZE (ALGO , DATAWIDTH , SIZE ) \
583
+ (((((ALGO) == CRYP_AES_CTR)) && \
584
+ ((((DATAWIDTH) == CRYP_DATAWIDTHUNIT_WORD) && (((SIZE) % 4U) == 0U)) || \
585
+ (((DATAWIDTH) == CRYP_DATAWIDTHUNIT_BYTE) && (((SIZE) % 16U) == 0U)))) || \
586
+ (((ALGO) == CRYP_AES_ECB) || ((ALGO) == CRYP_AES_CBC) || \
587
+ ((ALGO)== CRYP_AES_GCM_GMAC) || ((ALGO) == CRYP_AES_CCM)))
588
+
568
589
/**
569
590
* @}
570
591
*/
0 commit comments