cancel
Showing results for 
Search instead for 
Did you mean: 

HAL stm32F2 version 1.9.2 potential locked in CRYP_TDES_Process

Adalgiso
Associate II

Hi,

In

static HAL_StatusTypeDef CRYP_TDES_Process(CRYP_HandleTypeDef *hcryp, uint32_t Timeout)

{

 uint32_t temp; /* Temporary CrypOutBuff */

 uint16_t incount; /* Temporary CrypInCount Value */ 

 uint16_t outcount; /* Temporary CrypOutCount Value */

 /* Enable CRYP */

 __HAL_CRYP_ENABLE(hcryp);

 /*Temporary CrypOutCount Value*/

 outcount = hcryp->CrypOutCount;

 /*Start processing*/

 while((hcryp->CrypInCount < (hcryp->Size/4U)) && (outcount < (hcryp->Size/4U)))

 {  

  /* Temporary CrypInCount Value */ 

  incount = hcryp->CrypInCount;  

  /* Write plain data and get cipher data */

  if(((hcryp->Instance->SR & CRYP_FLAG_IFNF ) != 0x0U) && (incount < (hcryp->Size/4U)))

  {

   /* Write the input block in the IN FIFO */

   hcryp->Instance->DIN = *(uint32_t *)(hcryp->pCrypInBuffPtr + hcryp->CrypInCount );

   hcryp->CrypInCount++;

   hcryp->Instance->DIN = *(uint32_t *)(hcryp->pCrypInBuffPtr + hcryp->CrypInCount );

   hcryp->CrypInCount++;

  }

  /* Wait for OFNE flag to be raised */

  if(CRYP_WaitOnOFNEFlag(hcryp, Timeout) != HAL_OK)

  {

   /* Disable the CRYP peripheral clock */

   __HAL_CRYP_DISABLE(hcryp);

   /* Change state & errorCode*/

   hcryp->ErrorCode |= HAL_CRYP_ERROR_TIMEOUT;

   hcryp->State = HAL_CRYP_STATE_READY;

   /* Process unlocked */

   __HAL_UNLOCK(hcryp);

#if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1)

   /*Call registered error callback*/

   hcryp->ErrorCallback(hcryp);

#else

   /*Call legacy weak error callback*/

   HAL_CRYP_ErrorCallback(hcryp);

#endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */

  }

...

  if(CRYP_WaitOnOFNEFlag(hcryp, Timeout) != HAL_OK) does not return HAL_OK

Crypt is disabled but function does not return so function may never return.

0 REPLIES 0