@@ -64,9 +64,10 @@ typedef struct
6464 uint32_t * Header ; /*!< used only in AES GCM and CCM Algorithm for authentication,
6565 GCM : also known as Additional Authentication Data
6666 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 */
6868 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*/
7071 uint32_t KeyIVConfigSkip ; /*!< CRYP peripheral Key and IV configuration skip, to config Key and Initialization
7172 Vector only once and to skip configuration for consecutive processings.
7273 This parameter can be a value of @ref CRYP_Configuration_Skip */
@@ -182,10 +183,12 @@ typedef struct
182183
183184 uint32_t Key_saved [8 ]; /*!< copy of key registers */
184185
185- uint32_t Size_saved ; /*!< copy of input buffer size */
186+ uint16_t Size_saved ; /*!< copy of input buffer size */
186187
187188 uint16_t CrypHeaderCount_saved ; /*!< copy of CRYP header data counter when processing is suspended */
188189
190+ uint32_t SizesSum_saved ; /*!< copy of SizesSum when processing is suspended */
191+
189192 uint32_t ResumingFlag ; /*!< resumption flag to bypass steps already carried out */
190193
191194 FunctionalState AutoKeyDerivation_saved ; /*!< copy of CRYP handle auto key derivation parameter */
@@ -259,6 +262,17 @@ typedef void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp); /*!< point
259262#define CRYP_DATAWIDTHUNIT_WORD 0x00000000U /*!< By default, size unit is word */
260263#define CRYP_DATAWIDTHUNIT_BYTE 0x00000001U /*!< By default, size unit is byte */
261264
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+
262276/**
263277 * @}
264278 */
@@ -565,6 +579,13 @@ uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp);
565579#define IS_CRYP_INIT (CONFIG )(((CONFIG) == CRYP_KEYIVCONFIG_ALWAYS) || \
566580 ((CONFIG) == CRYP_KEYIVCONFIG_ONCE))
567581
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+
568589/**
569590 * @}
570591 */
0 commit comments