264#if defined (AES) || defined (CRYP)
272#ifdef HAL_CRYP_MODULE_ENABLED
279#define CRYP_TIMEOUT_KEYPREPARATION 82U
280#define CRYP_TIMEOUT_GCMCCMINITPHASE 299U
281#define CRYP_TIMEOUT_GCMCCMHEADERPHASE 290U
283#define CRYP_PHASE_READY 0x00000001U
284#define CRYP_PHASE_PROCESS 0x00000002U
287#define CRYP_OPERATINGMODE_ENCRYPT 0x00000000U
288#define CRYP_OPERATINGMODE_KEYDERIVATION AES_CR_MODE_0
289#define CRYP_OPERATINGMODE_DECRYPT AES_CR_MODE_1
290#define CRYP_OPERATINGMODE_KEYDERIVATION_DECRYPT AES_CR_MODE
291#define CRYP_PHASE_INIT 0x00000000U
292#define CRYP_PHASE_HEADER AES_CR_GCMPH_0
293#define CRYP_PHASE_PAYLOAD AES_CR_GCMPH_1
294#define CRYP_PHASE_FINAL AES_CR_GCMPH
296#define CRYP_PHASE_INIT 0x00000000U
297#define CRYP_PHASE_HEADER CRYP_CR_GCM_CCMPH_0
298#define CRYP_PHASE_PAYLOAD CRYP_CR_GCM_CCMPH_1
299#define CRYP_PHASE_FINAL CRYP_CR_GCM_CCMPH
300#define CRYP_OPERATINGMODE_ENCRYPT 0x00000000U
301#define CRYP_OPERATINGMODE_DECRYPT CRYP_CR_ALGODIR
305#define CRYP_CCM_CTR1_0 0x07FFFFFFU
306#define CRYP_CCM_CTR1_1 0xFFFFFF00U
307#define CRYP_CCM_CTR1_2 0x00000001U
322#define CRYP_SET_PHASE(__HANDLE__, __PHASE__) do{(__HANDLE__)->Instance->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\
323 (__HANDLE__)->Instance->CR |= (uint32_t)(__PHASE__);\
326#define HAL_CRYP_FIFO_FLUSH(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRYP_CR_FFLUSH)
329#define CRYP_SET_PHASE(__HANDLE__, __PHASE__) do{(__HANDLE__)->Instance->CR &= (uint32_t)(~AES_CR_GCMPH);\
330 (__HANDLE__)->Instance->CR |= (uint32_t)(__PHASE__);\
352#if defined (CRYP_CR_ALGOMODE_AES_GCM)|| defined (AES)
373#if defined (CRYP_CR_ALGOMODE_AES_GCM)
444#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
454 if (hcryp->MspInitCallback == NULL)
460 hcryp->MspInitCallback(hcryp);
476 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_DATATYPE | CRYP_CR_KEYSIZE | CRYP_CR_ALGOMODE,
481 MODIFY_REG(hcryp->
Instance->CR, AES_CR_DATATYPE | AES_CR_KEYSIZE | AES_CR_CHMOD,
524#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
526 if (hcryp->MspDeInitCallback == NULL)
531 hcryp->MspDeInitCallback(hcryp);
561 if ((hcryp == NULL) || (pConf == NULL))
595 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_DATATYPE | CRYP_CR_KEYSIZE | CRYP_CR_ALGOMODE,
599 MODIFY_REG(hcryp->
Instance->CR, AES_CR_DATATYPE | AES_CR_KEYSIZE | AES_CR_CHMOD,
643 if ((hcryp == NULL) || (pConf == NULL))
720#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
736 pCRYP_CallbackTypeDef pCallback)
740 if (pCallback == NULL)
743 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
754 case HAL_CRYP_INPUT_COMPLETE_CB_ID :
755 hcryp->InCpltCallback = pCallback;
758 case HAL_CRYP_OUTPUT_COMPLETE_CB_ID :
759 hcryp->OutCpltCallback = pCallback;
762 case HAL_CRYP_ERROR_CB_ID :
763 hcryp->ErrorCallback = pCallback;
766 case HAL_CRYP_MSPINIT_CB_ID :
767 hcryp->MspInitCallback = pCallback;
770 case HAL_CRYP_MSPDEINIT_CB_ID :
771 hcryp->MspDeInitCallback = pCallback;
776 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
786 case HAL_CRYP_MSPINIT_CB_ID :
787 hcryp->MspInitCallback = pCallback;
790 case HAL_CRYP_MSPDEINIT_CB_ID :
791 hcryp->MspDeInitCallback = pCallback;
796 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
805 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
840 case HAL_CRYP_INPUT_COMPLETE_CB_ID :
844 case HAL_CRYP_OUTPUT_COMPLETE_CB_ID :
848 case HAL_CRYP_ERROR_CB_ID :
852 case HAL_CRYP_MSPINIT_CB_ID :
856 case HAL_CRYP_MSPDEINIT_CB_ID :
862 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
872 case HAL_CRYP_MSPINIT_CB_ID :
876 case HAL_CRYP_MSPDEINIT_CB_ID :
882 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
891 hcryp->
ErrorCode |= HAL_CRYP_ERROR_INVALID_CALLBACK;
969 hcryp->
Size = Size * 4U;
981 algo = hcryp->
Instance->CR & CRYP_CR_ALGOMODE;
1009 HAL_CRYP_FIFO_FLUSH(hcryp);
1015 status = CRYP_TDES_Process(hcryp, Timeout);
1025 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1054 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
1142 hcryp->
Size = Size * 4U;
1155 algo = hcryp->
Instance->CR & CRYP_CR_ALGOMODE;
1183 HAL_CRYP_FIFO_FLUSH(hcryp);
1189 status = CRYP_TDES_Process(hcryp, Timeout);
1200 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1228 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
1314 hcryp->
Size = Size * 4U;
1327 algo = (hcryp->
Instance->CR & CRYP_CR_ALGOMODE);
1354 HAL_CRYP_FIFO_FLUSH(hcryp);
1372 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1399 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
1477 hcryp->
Size = Size * 4U;
1490 algo = hcryp->
Instance->CR & CRYP_CR_ALGOMODE;
1517 HAL_CRYP_FIFO_FLUSH(hcryp);
1537 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1566 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
1626 uint32_t DoKeyIVConfig = 1U;
1645 hcryp->
Size = Size * 4U;
1658 algo = hcryp->
Instance->CR & CRYP_CR_ALGOMODE;
1686 HAL_CRYP_FIFO_FLUSH(hcryp);
1717 if (DoKeyIVConfig == 1U)
1739 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1765 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
1791 if (DoKeyIVConfig == 1U)
1877 hcryp->
Size = Size * 4U;
1890 algo = hcryp->
Instance->CR & CRYP_CR_ALGOMODE;
1918 HAL_CRYP_FIFO_FLUSH(hcryp);
1935 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
1962 algo = hcryp->
Instance->CR & AES_CR_CHMOD;
2040 uint32_t itstatus = hcryp->
Instance->MISR;
2042 if ((itstatus & (CRYP_IT_INI | CRYP_IT_OUTI)) != 0U)
2047 CRYP_TDES_IT(hcryp);
2054 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
2150 return hcryp->
State;
2236 if (((hcryp->
Instance->SR & CRYP_FLAG_IFNF) != 0x0U) && (incount < (hcryp->
Size / 4U)))
2246 if (CRYP_WaitOnOFNEFlag(hcryp, Timeout) !=
HAL_OK)
2257#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
2259 hcryp->ErrorCallback(hcryp);
2269 if (((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U) && (outcount < (hcryp->
Size / 4U)))
2272 for (i = 0U; i < 2U; i++)
2326#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
2328 hcryp->InCpltCallback(hcryp);
2341 for (i = 0U; i < 2U; i++)
2366#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
2368 hcryp->OutCpltCallback(hcryp);
2383#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
2385 hcryp->ErrorCallback(hcryp);
2404 uint32_t DoKeyIVConfig = 1U;
2423 if (DoKeyIVConfig == 1U)
2481 uint32_t DoKeyIVConfig = 1U;
2500 if (DoKeyIVConfig == 1U)
2526 if (hcryp->
Size != 0U)
2580 uint32_t DoKeyIVConfig = 1U;
2599 if (DoKeyIVConfig == 1U)
2646 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_ALGOMODE, CRYP_CR_ALGOMODE_AES_KEY);
2655 if (CRYP_WaitOnBUSYFlag(hcryp, Timeout) !=
HAL_OK)
2730 __IO uint32_t count = 0U;
2731 uint32_t DoKeyIVConfig = 1U;
2750 if (DoKeyIVConfig == 1U)
2805 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_ALGOMODE, CRYP_CR_ALGOMODE_AES_KEY);
2863 if (hcryp->
Size != 0U)
2916 __IO uint32_t count = 0U;
2917 uint32_t DoKeyIVConfig = 1U;
2935 if (DoKeyIVConfig == 1U)
2989 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_ALGOMODE, CRYP_CR_ALGOMODE_AES_KEY);
3049 if (hcryp->
Size != 0U)
3080 hcryp->
Instance->DMACR &= (uint32_t)(~CRYP_DMACR_DIEN);
3083 CLEAR_BIT(hcryp->
Instance->CR, AES_CR_DMAINEN);
3100#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3102 hcryp->InCpltCallback(hcryp);
3123 hcryp->
Instance->DMACR &= (uint32_t)(~CRYP_DMACR_DOEN);
3124 #if defined (CRYP_CR_ALGOMODE_AES_GCM)
3137 CLEAR_BIT(hcryp->
Instance->CR, AES_CR_DMAOUTEN);
3155#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3157 hcryp->OutCpltCallback(hcryp);
3187#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3189 hcryp->ErrorCallback(hcryp);
3231#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3233 hcryp->ErrorCallback(hcryp);
3246#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3248 hcryp->ErrorCallback(hcryp);
3255 hcryp->
Instance->DMACR = CRYP_DMACR_DOEN | CRYP_DMACR_DIEN;
3273#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3275 hcryp->ErrorCallback(hcryp);
3288#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3290 hcryp->ErrorCallback(hcryp);
3301 SET_BIT(hcryp->
Instance->CR, (AES_CR_DMAINEN));
3306 SET_BIT(hcryp->
Instance->CR, (AES_CR_DMAINEN | AES_CR_DMAOUTEN));
3333 if (((hcryp->
Instance->SR & CRYP_FLAG_IFNF) != 0x0U) && (incount < (hcryp->
Size / 4U)))
3347 if (CRYP_WaitOnOFNEFlag(hcryp, Timeout) !=
HAL_OK)
3358#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3360 hcryp->ErrorCallback(hcryp);
3370 if (((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U) && (outcount < (hcryp->
Size / 4U)))
3373 for (i = 0U; i < 4U; i++)
3410#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3412 hcryp->ErrorCallback(hcryp);
3423 for (i = 0U; i < 4U; i++)
3460 if (((hcryp->
Instance->SR & CRYP_FLAG_IFNF) != 0x0U) && (incount < (hcryp->
Size / 4U)))
3477#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3479 hcryp->InCpltCallback(hcryp);
3489 if (((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U) && (outcount < (hcryp->
Size / 4U)))
3492 for (i = 0U; i < 4U; i++)
3518#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3520 hcryp->OutCpltCallback(hcryp);
3531 for (i = 0U; i < 4U; i++)
3558#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3560 hcryp->OutCpltCallback(hcryp);
3581#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
3583 hcryp->InCpltCallback(hcryp);
3597#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
3599 hcryp->ErrorCallback(hcryp);
3630 case CRYP_KEYSIZE_192B:
3674#if defined (CRYP_CR_ALGOMODE_AES_GCM)|| defined (AES)
3685 uint32_t wordsize = (uint32_t)(hcryp->
Size) / 4U ;
3687 uint32_t DoKeyIVConfig = 1U;
3712 if (DoKeyIVConfig == 1U)
3739 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN)
3744 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
3823 if ((hcryp->
Size % 16U) != 0U)
3826 wordsize = ((wordsize / 4U) * 4U) ;
3835 while ((hcryp->
CrypInCount < wordsize) && (outcount < wordsize))
3846 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
3862 if ((hcryp->
Size % 16U) != 0U)
3882 __IO uint32_t count = 0U;
3883 uint32_t DoKeyIVConfig = 1U;
3885 uint32_t loopcounter;
3886 uint32_t lastwordsize;
3914 if (DoKeyIVConfig == 1U)
3955 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN);
4036 if (hcryp->
Size == 0U)
4047 else if (hcryp->
Size >= 16U)
4060#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
4062 hcryp->InCpltCallback(hcryp);
4077 npblb = 16U - (uint32_t)(hcryp->
Size);
4080 if ((npblb % 4U) == 0U)
4082 lastwordsize = (16U - npblb) / 4U;
4086 lastwordsize = ((16U - npblb) / 4U) + 1U;
4090 for (loopcounter = 0U; loopcounter < lastwordsize ; loopcounter++)
4095 while (loopcounter < 4U)
4105 for (loopcounter = 0U; loopcounter < hcryp->
Init.
HeaderSize ; loopcounter++)
4110 while (loopcounter < 4U)
4123#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
4125 hcryp->InCpltCallback(hcryp);
4164 __IO uint32_t count = 0U;
4166 uint32_t DoKeyIVConfig = 1U;
4191 if (DoKeyIVConfig == 1U)
4232 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN);
4301 if (hcryp->
Size != 0U)
4307 if ((hcryp->
Size % 16U) == 0U)
4313 wordsize = (uint32_t)(hcryp->
Size) + (16U - ((uint32_t)(hcryp->
Size) % 16U)) ;
4345 uint32_t wordsize = (uint32_t)(hcryp->
Size) / 4U;
4347 uint32_t DoKeyIVConfig = 1U;
4349 uint32_t loopcounter;
4351 uint32_t lastwordsize;
4377 if (DoKeyIVConfig == 1U)
4413 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 1), 16);
4414 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 2), 16);
4415 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 3), 16);
4420 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 1));
4421 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 2));
4422 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 3));
4435 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN)
4440 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
4506 for (loopcounter = 0U; (loopcounter < hcryp->
Init.
HeaderSize); loopcounter += 4U)
4567 for (loopcounter = 0U; (loopcounter < (hcryp->
Init.
HeaderSize % 4U)); loopcounter++)
4572 while (loopcounter < 4U)
4599 if (hcryp->
Size != 0U)
4601 if ((hcryp->
Size % 16U) != 0U)
4604 wordsize = ((wordsize / 4U) * 4U) ;
4612 while ((hcryp->
CrypInCount < wordsize) && (outcount < wordsize))
4623 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
4639 if ((hcryp->
Size % 16U) != 0U)
4642 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
4645 if ((npblb % 4U) == 0U)
4647 lastwordsize = (16U - npblb) / 4U;
4651 lastwordsize = ((16U - npblb) / 4U) + 1U;
4654 for (loopcounter = 0U; loopcounter < lastwordsize; loopcounter ++)
4660 while (loopcounter < 4U)
4714 if ((hcryp->
Size % 16U) != 0U)
4717 wordsize = ((wordsize / 4U) * 4U) ;
4725 while ((hcryp->
CrypInCount < wordsize) && (outcount < wordsize))
4733 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
4749 if ((hcryp->
Size % 16U) != 0U)
4771 uint32_t DoKeyIVConfig = 1U;
4773 __IO uint32_t count = 0U;
4800 if (DoKeyIVConfig == 1U)
4834 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 1), 16);
4835 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 2), 16);
4836 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 3), 16);
4841 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 1));
4842 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 2));
4843 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 3));
4871 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN);
4929 __IO uint32_t count = 0U;
4930 uint32_t DoKeyIVConfig = 1U;
4932 uint32_t loopcounter;
4934 uint32_t lastwordsize;
4960 if (DoKeyIVConfig == 1U)
4995 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 1), 16);
4996 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 2), 16);
4997 hcryp->
Instance->DIN = __ROR(*(uint32_t *)(hcryp->
Init.
B0 + 3), 16);
5002 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 1));
5003 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 2));
5004 hcryp->
Instance->DIN = __RBIT(*(uint32_t *)(hcryp->
Init.
B0 + 3));
5033 while ((hcryp->
Instance->CR & CRYP_CR_CRYPEN) == CRYP_CR_CRYPEN);
5095 for (loopcounter = 0U; (loopcounter < hcryp->
Init.
HeaderSize); loopcounter += 4U)
5169 for (loopcounter = 0U; (loopcounter < (hcryp->
Init.
HeaderSize % 4U)); loopcounter++)
5174 while (loopcounter < 4U)
5207 if (hcryp->
Size != 0U)
5209 if (hcryp->
Size >= 16U)
5211 if ((hcryp->
Size % 16U) == 0U)
5217 wordsize = (uint32_t)(hcryp->
Size) + (16U - ((uint32_t)(hcryp->
Size) % 16U)) ;
5224 if ((hcryp->
Size < 16U) != 0U)
5227 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
5230 if ((npblb % 4U) == 0U)
5232 lastwordsize = (16U - npblb) / 4U;
5236 lastwordsize = ((16U - npblb) / 4U) + 1U;
5239 for (loopcounter = 0U; loopcounter < lastwordsize; loopcounter ++)
5245 while (loopcounter < 4U)
5309 if (hcryp->
Size != 0U)
5315 if ((hcryp->
Size % 16U) == 0U)
5321 wordsize = (uint32_t)(hcryp->
Size) + 16U - ((uint32_t)(hcryp->
Size) % 16U) ;
5349 uint32_t loopcounter;
5351 uint32_t lastwordsize;
5361 if (hcryp->
Size == 0U)
5390#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
5392 hcryp->InCpltCallback(hcryp);
5401 for (i = 0U; i < 4U; i++)
5427#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
5429 hcryp->OutCpltCallback(hcryp);
5437 else if ((hcryp->
Size % 16U) != 0U)
5444 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
5447 if ((npblb % 4U) == 0U)
5449 lastwordsize = (16U - npblb) / 4U;
5453 lastwordsize = ((16U - npblb) / 4U) + 1U;
5457 for (loopcounter = 0U; loopcounter < lastwordsize; loopcounter++)
5462 while (loopcounter < 4U)
5470 if ((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U)
5472 for (i = 0U; i < 4U; i++)
5476 if (((hcryp->
Size) / 4U) == 0U)
5478 for (i = 0U; i < ((uint32_t)(hcryp->
Size) % 4U); i++)
5504#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
5506 hcryp->OutCpltCallback(hcryp);
5520 for (i = 0U; i < 4U; i++)
5546#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
5548 hcryp->OutCpltCallback(hcryp);
5569#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
5571 hcryp->InCpltCallback(hcryp);
5585 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
5588 if ((npblb % 4U) == 0U)
5590 lastwordsize = (16U - npblb) / 4U;
5594 lastwordsize = ((16U - npblb) / 4U) + 1U;
5598 for (loopcounter = 0U; loopcounter < lastwordsize; loopcounter++)
5603 while (loopcounter < 4U)
5624 uint32_t loopcounter;
5625 uint32_t size_in_bytes;
5627 uint32_t mask[12] = {0x0U, 0xFF000000U, 0xFFFF0000U, 0xFFFFFF00U,
5628 0x0U, 0x0000FF00U, 0x0000FFFFU, 0xFF00FFFFU,
5629 0x0U, 0x000000FFU, 0x0000FFFFU, 0x00FFFFFFU};
5642 if (size_in_bytes != 0U)
5653 if ((size_in_bytes % 16U) == 0U)
5656 for (loopcounter = 0U; (loopcounter < (size_in_bytes / 4U)); loopcounter += 4U)
5668 if (CRYP_WaitOnIFEMFlag(hcryp, Timeout) !=
HAL_OK)
5686 for (loopcounter = 0U; (loopcounter < ((size_in_bytes / 16U) * 4U)); loopcounter += 4U)
5698 if (CRYP_WaitOnIFEMFlag(hcryp, Timeout) !=
HAL_OK)
5713 for (loopcounter = 0U; (loopcounter < ((size_in_bytes / 4U) % 4U)); loopcounter++)
5719 if ((size_in_bytes % 4U) == 0U)
5722 while (loopcounter < 4U)
5732 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (size_in_bytes % 4U)];
5736 while (loopcounter < 4U)
5743 if (CRYP_WaitOnIFEMFlag(hcryp, Timeout) !=
HAL_OK)
5758 if (CRYP_WaitOnBUSYFlag(hcryp, Timeout) !=
HAL_OK)
5787 if ((size_in_bytes % 16U) == 0U)
5790 for (loopcounter = 0U; (loopcounter < (size_in_bytes / 4U)); loopcounter += 4U)
5822 for (loopcounter = 0U; (loopcounter < ((size_in_bytes / 16U) * 4U)); loopcounter += 4U)
5851 for (loopcounter = 0U; (loopcounter < ((size_in_bytes / 4U) % 4U)); loopcounter++)
5857 if ((size_in_bytes % 4U) == 0U)
5860 while (loopcounter < 4U)
5870 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (size_in_bytes % 4U)];
5874 while (loopcounter < 4U)
5927 __IO uint32_t count = 0U;
5928 uint32_t loopcounter;
5929 uint32_t headersize_in_bytes;
5931 uint32_t mask[12] = {0x0U, 0xFF000000U, 0xFFFF0000U, 0xFFFFFF00U,
5932 0x0U, 0x0000FF00U, 0x0000FFFFU, 0xFF00FFFFU,
5933 0x0U, 0x000000FFU, 0x0000FFFFU, 0x00FFFFFFU};
5945 if (headersize_in_bytes != 0U)
5956 if ((headersize_in_bytes % 16U) == 0U)
5959 for (loopcounter = 0U; (loopcounter < (headersize_in_bytes / 4U)); loopcounter += 4U)
5995 for (loopcounter = 0U; (loopcounter < ((headersize_in_bytes / 16U) * 4U)); loopcounter += 4U)
6028 for (loopcounter = 0U; (loopcounter < ((headersize_in_bytes / 4U) % 4U)); loopcounter++)
6034 if ((headersize_in_bytes % 4U) == 0U)
6037 while (loopcounter < 4U)
6047 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (headersize_in_bytes % 4U)];
6051 while (loopcounter < 4U)
6112 if ((headersize_in_bytes % 16U) == 0U)
6115 for (loopcounter = 0U; (loopcounter < (headersize_in_bytes / 4U)); loopcounter += 4U)
6155 for (loopcounter = 0U; (loopcounter < ((headersize_in_bytes / 16U) * 4U)); loopcounter += 4U)
6192 for (loopcounter = 0U; (loopcounter < ((headersize_in_bytes / 4U) % 4U)); loopcounter++)
6198 if ((headersize_in_bytes % 4U) == 0U)
6201 while (loopcounter < 4U)
6211 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (headersize_in_bytes % 4U)];
6215 while (loopcounter < 4U)
6275 uint32_t loopcounter;
6277 uint32_t lastwordsize;
6280 uint32_t headersize_in_bytes;
6282 uint32_t mask[12] = {0x0U, 0xFF000000U, 0xFFFF0000U, 0xFFFFFF00U,
6283 0x0U, 0x0000FF00U, 0x0000FFFFU, 0xFF00FFFFU,
6284 0x0U, 0x000000FFU, 0x0000FFFFU, 0x00FFFFFFU};
6318 else if (((headersize_in_bytes / 4U) - (hcryp->
CrypHeaderCount)) >= 4U)
6334 for (loopcounter = 0U; loopcounter < ((headersize_in_bytes / 4U) % 4U); loopcounter++)
6339 if ((headersize_in_bytes % 4U) == 0U)
6342 while (loopcounter < 4U)
6353 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (headersize_in_bytes % 4U)];
6358 while (loopcounter < 4U)
6385 if (hcryp->
Size == 0U)
6396 else if (hcryp->
Size >= 16U)
6410#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
6412 hcryp->InCpltCallback(hcryp);
6426 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
6429 if ((npblb % 4U) == 0U)
6431 lastwordsize = (16U - npblb) / 4U;
6435 lastwordsize = ((16U - npblb) / 4U) + 1U;
6439 for (loopcounter = 0U; loopcounter < lastwordsize; loopcounter++)
6444 while (loopcounter < 4U)
6452 else if (((headersize_in_bytes / 4U) - (hcryp->
CrypHeaderCount)) >= 4U)
6467 for (loopcounter = 0U; loopcounter < ((headersize_in_bytes / 4U) % 4U); loopcounter++)
6473 if ((headersize_in_bytes % 4U) == 0U)
6476 while (loopcounter < 4U)
6487 tmp &= mask[(hcryp->
Init.
DataType * 2U) + (headersize_in_bytes % 4U)];
6492 while (loopcounter < 4U)
6513 uint32_t lastwordsize;
6517 uint32_t temp[4] = {0};
6518 uint32_t temp2[4] = {0};
6520 uint32_t intermediate_data[4] = {0};
6524 npblb = ((((uint32_t)(hcryp->
Size) / 16U) + 1U) * 16U) - (uint32_t)(hcryp->
Size);
6527 if ((npblb % 4U) == 0U)
6529 lastwordsize = (16U - npblb) / 4U;
6533 lastwordsize = ((16U - npblb) / 4U) + 1U;
6556 for (index = 0; index < lastwordsize; index ++)
6569 if (CRYP_WaitOnOFNEFlag(hcryp, Timeout) !=
HAL_OK)
6580#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
6582 hcryp->ErrorCallback(hcryp);
6588 if ((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U)
6590 for (index = 0U; index < 4U; index++)
6593 intermediate_data[index] = hcryp->
Instance->DOUT;
6607 MODIFY_REG(hcryp->
Instance->CR, CRYP_CR_ALGOMODE, CRYP_AES_GCM);
6614 if ((npblb % 4U) == 1U)
6616 intermediate_data[lastwordsize - 1U] &= 0xFFFFFF00U;
6618 if ((npblb % 4U) == 2U)
6620 intermediate_data[lastwordsize - 1U] &= 0xFFFF0000U;
6622 if ((npblb % 4U) == 3U)
6624 intermediate_data[lastwordsize - 1U] &= 0xFF000000U;
6629 if ((npblb % 4U) == 1U)
6631 intermediate_data[lastwordsize - 1U] &= __REV(0xFFFFFF00U);
6633 if ((npblb % 4U) == 2U)
6635 intermediate_data[lastwordsize - 1U] &= __REV(0xFFFF0000U);
6637 if ((npblb % 4U) == 3U)
6639 intermediate_data[lastwordsize - 1U] &= __REV(0xFF000000U);
6644 if ((npblb % 4U) == 1U)
6646 intermediate_data[lastwordsize - 1U] &= __ROR((0xFFFFFF00U), 16);
6648 if ((npblb % 4U) == 2U)
6650 intermediate_data[lastwordsize - 1U] &= __ROR((0xFFFF0000U), 16);
6652 if ((npblb % 4U) == 3U)
6654 intermediate_data[lastwordsize - 1U] &= __ROR((0xFF000000U), 16);
6659 if ((npblb % 4U) == 1U)
6661 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFFFFFF00U);
6663 if ((npblb % 4U) == 2U)
6665 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFFFF0000U);
6667 if ((npblb % 4U) == 3U)
6669 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFF000000U);
6672 for (index = 0U; index < lastwordsize; index ++)
6675 hcryp->
Instance->DIN = intermediate_data[index];
6684 if (CRYP_WaitOnOFNEFlag(hcryp, Timeout) !=
HAL_OK)
6695#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)
6697 hcryp->ErrorCallback(hcryp);
6704 if ((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U)
6706 for (index = 0U; index < 4U; index++)
6708 intermediate_data[index] = hcryp->
Instance->DOUT;
6721 iv1temp = hcryp->
Instance->CSGCMCCM7R;
6726 temp[0] = hcryp->
Instance->CSGCMCCM0R;
6727 temp[1] = hcryp->
Instance->CSGCMCCM1R;
6728 temp[2] = hcryp->
Instance->CSGCMCCM2R;
6729 temp[3] = hcryp->
Instance->CSGCMCCM3R;
6740 for (index = 0; index < lastwordsize; index ++)
6753 if (CRYP_WaitOnOFNEFlag(hcryp, Timeout) !=
HAL_OK)
6764#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
6766 hcryp->ErrorCallback(hcryp);
6773 if ((hcryp->
Instance->SR & CRYP_FLAG_OFNE) != 0x0U)
6775 for (index = 0U; index < 4U; index++)
6778 intermediate_data[index] = hcryp->
Instance->DOUT;
6788 temp2[0] = hcryp->
Instance->CSGCMCCM0R;
6789 temp2[1] = hcryp->
Instance->CSGCMCCM1R;
6790 temp2[2] = hcryp->
Instance->CSGCMCCM2R;
6791 temp2[3] = hcryp->
Instance->CSGCMCCM3R;
6800 for (index = lastwordsize; index < 4U; index ++)
6802 intermediate_data[index] = 0U;
6804 if ((npblb % 4U) == 1U)
6806 intermediate_data[lastwordsize - 1U] &= 0xFFFFFF00U;
6808 if ((npblb % 4U) == 2U)
6810 intermediate_data[lastwordsize - 1U] &= 0xFFFF0000U;
6812 if ((npblb % 4U) == 3U)
6814 intermediate_data[lastwordsize - 1U] &= 0xFF000000U;
6816 for (index = 0U; index < 4U ; index ++)
6818 intermediate_data[index] ^= temp[index];
6819 intermediate_data[index] ^= temp2[index];
6821 for (index = 0U; index < 4U; index ++)
6824 hcryp->
Instance->DIN = intermediate_data[index] ;
6828 if (CRYP_WaitOnBUSYFlag(hcryp, Timeout) !=
HAL_OK)
6839#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
6841 hcryp->ErrorCallback(hcryp);
6864 for (index = 0U; index < lastwordsize; index ++)
6881#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
6883 hcryp->ErrorCallback(hcryp);
6893 for (index = 0U; index < 4U; index++)
6896 intermediate_data[index] = hcryp->
Instance->DOUTR;
6913 if ((npblb % 4U) == 1U)
6915 intermediate_data[lastwordsize - 1U] &= 0xFFFFFF00U;
6917 if ((npblb % 4U) == 2U)
6919 intermediate_data[lastwordsize - 1U] &= 0xFFFF0000U;
6921 if ((npblb % 4U) == 3U)
6923 intermediate_data[lastwordsize - 1U] &= 0xFF000000U;
6928 if ((npblb % 4U) == 1U)
6930 intermediate_data[lastwordsize - 1U] &= __REV(0xFFFFFF00U);
6932 if ((npblb % 4U) == 2U)
6934 intermediate_data[lastwordsize - 1U] &= __REV(0xFFFF0000U);
6936 if ((npblb % 4U) == 3U)
6938 intermediate_data[lastwordsize - 1U] &= __REV(0xFF000000U);
6943 if ((npblb % 4U) == 1U)
6945 intermediate_data[lastwordsize - 1U] &= __ROR((0xFFFFFF00U), 16);
6947 if ((npblb % 4U) == 2U)
6949 intermediate_data[lastwordsize - 1U] &= __ROR((0xFFFF0000U), 16);
6951 if ((npblb % 4U) == 3U)
6953 intermediate_data[lastwordsize - 1U] &= __ROR((0xFF000000U), 16);
6958 if ((npblb % 4U) == 1U)
6960 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFFFFFF00U);
6962 if ((npblb % 4U) == 2U)
6964 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFFFF0000U);
6966 if ((npblb % 4U) == 3U)
6968 intermediate_data[lastwordsize - 1U] &= __RBIT(0xFF000000U);
6973 for (index = 0U; index < lastwordsize; index ++)
6975 hcryp->
Instance->DINR = intermediate_data[index];
6995#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1U)
6997 hcryp->ErrorCallback(hcryp);
7006 for (index = 0U; index < 4U; index++)
7008 intermediate_data[index] = hcryp->
Instance->DOUTR;
7015#if defined (CRYP_CR_ALGOMODE_AES_GCM)
7035 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
7063 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
7092 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
7122 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
#define CRYP_AES_GCM_GMAC
#define CRYP_KEYIVCONFIG_ONCE
#define CRYP_DATATYPE_16B
#define CRYP_DATATYPE_32B
#define CRYP_DATAWIDTHUNIT_WORD
#define HAL_CRYP_ERROR_DMA
#define HAL_CRYP_ERROR_NOT_SUPPORTED
#define HAL_CRYP_ERROR_NONE
#define HAL_CRYP_ERROR_BUSY
#define HAL_CRYP_ERROR_TIMEOUT
#define HAL_CRYP_ERROR_READ
#define HAL_CRYP_ERROR_WRITE
void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp)
DeInitializes CRYP MSP.
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
Initializes the CRYP MSP.
HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf)
Get CRYP Configuration parameters in associated handle.
HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp)
De-Initializes the CRYP peripheral.
HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf)
Configure the CRYP according to the specified parameters in the CRYP_ConfigTypeDef.
HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
Initializes the CRYP according to the specified parameters in the CRYP_ConfigTypeDef and creates the ...
HAL_StatusTypeDef HAL_CRYP_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output)
Encryption in interrupt mode.
HAL_StatusTypeDef HAL_CRYP_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output)
Decryption in itnterrupt mode.
HAL_StatusTypeDef HAL_CRYP_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output)
Decryption in DMA mode.
HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, uint32_t Timeout)
Encryption mode.
HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, uint32_t Timeout)
Decryption mode.
HAL_StatusTypeDef HAL_CRYP_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output)
Encryption in DMA mode.
uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp)
Return the CRYP error code.
void HAL_CRYP_InCpltCallback(CRYP_HandleTypeDef *hcryp)
Input FIFO transfer completed callback.
void HAL_CRYP_IRQHandler(CRYP_HandleTypeDef *hcryp)
This function handles cryptographic interrupt request.
void HAL_CRYP_ErrorCallback(CRYP_HandleTypeDef *hcryp)
CRYP error callback.
HAL_CRYP_STATETypeDef HAL_CRYP_GetState(CRYP_HandleTypeDef *hcryp)
Returns the CRYP state.
void HAL_CRYP_OutCpltCallback(CRYP_HandleTypeDef *hcryp)
Output FIFO transfer completed callback.
#define __HAL_CRYP_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the CRYP pending status flag.
#define __HAL_CRYP_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the CRYP interrupt.
#define __HAL_CRYP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified CRYP interrupt source is enabled or not.
#define __HAL_CRYP_DISABLE(__HANDLE__)
#define __HAL_CRYP_GET_IT(__HANDLE__, __INTERRUPT__)
Check whether the specified CRYP interrupt is set or not.
#define __HAL_CRYP_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the CRYP interrupt.
#define __HAL_CRYP_ENABLE(__HANDLE__)
Enable/Disable the CRYP peripheral.
#define __HAL_CRYP_GET_FLAG(__HANDLE__, __FLAG__)
HAL_CRYP_STATETypeDef
CRYP State Structure definition.
#define IS_CRYP_KEYSIZE(KEYSIZE)
#define IS_CRYP_INIT(CONFIG)
#define IS_CRYP_DATATYPE(DATATYPE)
#define IS_CRYP_ALGORITHM(ALGORITHM)
#define CRYP_KEYSIZE_128B
#define CRYP_KEYSIZE_256B
#define CRYP_OPERATINGMODE_ENCRYPT
#define CRYP_PHASE_HEADER
#define CRYP_OPERATINGMODE_KEYDERIVATION
#define CRYP_OPERATINGMODE_DECRYPT
#define CRYP_PHASE_PROCESS
#define CRYP_OPERATINGMODE_KEYDERIVATION_DECRYPT
#define CRYP_TIMEOUT_GCMCCMINITPHASE
#define CRYP_TIMEOUT_GCMCCMHEADERPHASE
#define CRYP_PHASE_PAYLOAD
#define CRYP_TIMEOUT_KEYPREPARATION
static void CRYP_AES_IT(CRYP_HandleTypeDef *hcryp)
Handle CRYP block input/output data handling under interruption.
static void CRYP_AES_ProcessData(CRYP_HandleTypeDef *hcrypt, uint32_t Timeout)
Process Data: Write Input data in polling mode and used in AES functions.
static HAL_StatusTypeDef CRYP_AESGCM_Process_DMA(CRYP_HandleTypeDef *hcryp)
Encryption/Decryption process in AES GCM mode and prepare the authentication TAG using DMA.
static void CRYP_SetKey(CRYP_HandleTypeDef *hcryp, uint32_t KeySize)
Writes Key in Key registers.
static HAL_StatusTypeDef CRYP_WaitOnCCFlag(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Handle CRYP hardware block Timeout when waiting for CCF flag to be raised.
static HAL_StatusTypeDef CRYP_GCMCCM_SetHeaderPhase(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Sets the header phase in polling mode.
static HAL_StatusTypeDef CRYP_AES_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Decryption in ECB/CBC & CTR mode with AES Standard.
static void CRYP_DMAError(DMA_HandleTypeDef *hdma)
DMA CRYP communication error callback.
static HAL_StatusTypeDef CRYP_AES_Encrypt_IT(CRYP_HandleTypeDef *hcryp)
Encryption in ECB/CBC & CTR mode with AES Standard using interrupt mode.
static HAL_StatusTypeDef CRYP_AESCCM_Process(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
AES CCM encryption/decryption processing in polling mode for TinyAES IP, no encrypt/decrypt performed...
static void CRYP_SetDMAConfig(CRYP_HandleTypeDef *hcryp, uint32_t inputaddr, uint16_t Size, uint32_t outputaddr)
Set the DMA configuration and start the DMA transfer.
static void CRYP_Workaround(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Workaround used for GCM/CCM mode.
static HAL_StatusTypeDef CRYP_AESCCM_Process_DMA(CRYP_HandleTypeDef *hcryp)
AES CCM encryption/decryption process in DMA mode for TinyAES IP, no encrypt/decrypt performed,...
static void CRYP_GCMCCM_SetPayloadPhase_IT(CRYP_HandleTypeDef *hcryp)
Sets the payload phase in interrupt mode.
static HAL_StatusTypeDef CRYP_AESCCM_Process_IT(CRYP_HandleTypeDef *hcryp)
AES CCM encryption/decryption process in interrupt mode for TinyAES IP, no encrypt/decrypt performed,...
static HAL_StatusTypeDef CRYP_GCMCCM_SetHeaderPhase_DMA(CRYP_HandleTypeDef *hcryp)
Sets the header phase when using DMA in process.
static void CRYP_GCMCCM_SetHeaderPhase_IT(CRYP_HandleTypeDef *hcryp)
Sets the header phase in interrupt mode.
static HAL_StatusTypeDef CRYP_AES_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Encryption in ECB/CBC & CTR Algorithm with AES Standard.
static HAL_StatusTypeDef CRYP_AESGCM_Process(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)
Encryption/Decryption process in AES GCM mode and prepare the authentication TAG.
static HAL_StatusTypeDef CRYP_AES_Decrypt_IT(CRYP_HandleTypeDef *hcryp)
Decryption in ECB/CBC & CTR mode with AES Standard using interrupt mode.
static void CRYP_DMAOutCplt(DMA_HandleTypeDef *hdma)
DMA CRYP output data process complete callback.
static void CRYP_DMAInCplt(DMA_HandleTypeDef *hdma)
DMA CRYP input data process complete callback.
static HAL_StatusTypeDef CRYP_AES_Decrypt_DMA(CRYP_HandleTypeDef *hcryp)
Decryption in ECB/CBC & CTR mode with AES Standard using DMA mode.
static HAL_StatusTypeDef CRYP_AESGCM_Process_IT(CRYP_HandleTypeDef *hcryp)
Encryption/Decryption process in AES GCM mode and prepare the authentication TAG in interrupt mode.
#define CRYP_SET_PHASE(__HANDLE__, __PHASE__)
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
Start the DMA Transfer with interrupt enabled.
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
#define HAL_IS_BIT_SET(REG, BIT)
HAL_StatusTypeDef
HAL Status structures definition
#define __HAL_UNLOCK(__HANDLE__)
#define HAL_IS_BIT_CLR(REG, BIT)
#define __HAL_LOCK(__HANDLE__)
CRYP Init Structure definition.
CRYP handle Structure definition.
__IO HAL_CRYP_STATETypeDef State
FunctionalState AutoKeyDerivation
__IO uint16_t CrypHeaderCount
DMA_HandleTypeDef * hdmaout
uint32_t * pCrypOutBuffPtr
__IO uint16_t CrypOutCount
uint32_t * pCrypInBuffPtr
__IO uint16_t CrypInCount
DMA_HandleTypeDef * hdmain
DMA handle Structure definition.
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)