cancel
Showing results for 
Search instead for 
Did you mean: 

X-CUBE cryptolib in sbsfu

Istillaga
Senior

Hi,

I am implementing the sbsfu encryption functionality on the stm32u575 micros which do not contain hardware accelerator. For this I have decided to use x-cube cryptolib to be able to encrypt and decrypt messages. I have tested the example aes_cbc_encryptdecrypt on the u575zi-q motherboard and it works perfectly. Now I am trying to implement the same example on a u575 micro with sbsfu, but when encrypting, it does not produce the expected ciphertext values for the default text. Any help?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Istillaga,

 

I could reproduce the problem.

The issue is that SBSFU is using CRC.

 What you need to do is to reset the CRC.

In cmox_low_level.c please add the force reset of the CRC IP like this:

cmox_init_retval_t cmox_ll_init(void *pArg)
{
  (void)pArg;
  /* Ensure CRC is enabled for cryptographic processing */
  __HAL_RCC_CRC_FORCE_RESET();
  __HAL_RCC_CRC_RELEASE_RESET();
  __HAL_RCC_CRC_CLK_ENABLE();
  return CMOX_INIT_SUCCESS;
}

 Then you should be ok

Best regards

Jocelyn

View solution in original post

3 REPLIES 3
Jocelyn RICARD
ST Employee

Hello @Istillaga ,

I'm not sure to understand your setup.

"I am implementing the sbsfu encryption functionality" does not really makes sense to me.

You use SBSFU to launch your application securely and you implement crypto inside your application ?

Is that what your are saying?

Best regards

Jocelyn

Istillaga
Senior

Hello @Jocelyn RICARD,
Yes, that's what I wanted to say. I have implemented crypto in my application but it is not encrypting well.
I'm sorry I wrote quickly and I didn't realise that the sentence didn't make sense.

Hello @Istillaga,

 

I could reproduce the problem.

The issue is that SBSFU is using CRC.

 What you need to do is to reset the CRC.

In cmox_low_level.c please add the force reset of the CRC IP like this:

cmox_init_retval_t cmox_ll_init(void *pArg)
{
  (void)pArg;
  /* Ensure CRC is enabled for cryptographic processing */
  __HAL_RCC_CRC_FORCE_RESET();
  __HAL_RCC_CRC_RELEASE_RESET();
  __HAL_RCC_CRC_CLK_ENABLE();
  return CMOX_INIT_SUCCESS;
}

 Then you should be ok

Best regards

Jocelyn