Skip to main content
Associate
January 4, 2025
Solved

Are x-cube-cryptolib V.4 cmox_ functions reentrant?

  • January 4, 2025
  • 1 reply
  • 747 views

Hi, I planned of implementing this library in a new STM32G4 application. I have no RTOS, and I need to make  cryptographic functions calls from both main loop and interrupts. So, instead of wasting time in building a thread-safe scheduling mechanism that's perhaps not necessary, it would be very helpful knowing in advance what cryptolib functions are already reentrant... if not the entire library. Another doubts is regarding HAL's: Cryptolib examples are all based on HAL's, but I only use the LL library. I tried some cryptolib functions adapting the CRC module initialization to LL's and they seem working fine. However getting an explicit confirmation that the entire x-cube-cryptolib is actually NOT based on HAL's would speed its implementation up. Thanks!

 

Best answer by Jocelyn RICARD

Hello @mcasoni ,

Unfortunately the X-CUBE-CRYPTOLIB is not re-entrant.

One reason is the usage of this CRC that is not protected.

The development team is working to remove this constraint but it will not come before end of the year.

Regarding dependency with HAL, the cryptolib does not require usage of HAL.

Examples use HAL for convenience only.

Best regards

Jocelyn

1 reply

Jocelyn RICARD
Jocelyn RICARDBest answer
ST Employee
January 10, 2025

Hello @mcasoni ,

Unfortunately the X-CUBE-CRYPTOLIB is not re-entrant.

One reason is the usage of this CRC that is not protected.

The development team is working to remove this constraint but it will not come before end of the year.

Regarding dependency with HAL, the cryptolib does not require usage of HAL.

Examples use HAL for convenience only.

Best regards

Jocelyn

mcasoniAuthor
Associate
January 10, 2025

Hello Jocelyn,

indeed, it makes sense.

Thank you for your prompt reply.

Regards

Massimo