cancel
Showing results for 
Search instead for 
Did you mean: 

SM32H7 Crypto library resets CRC

franck23
Senior

Hi,

I am migrating some code from an STM32F745 to an STM32H743.

I came into some trouble while using the crypto library and the hardware CRC at the same time.

The STM32H743 crypto library resets the CRC DR register every time AES_CBC_Decrypt_Append is called.

This was not the case when using the STM32F745.

The workaround is to save restore the CRC.DR register as shown below:

// Save CRC_DR register
uint32_t CRC_DR = hcrc.Instance->DR;
 
// Call crypto function
 
// Restore CRC_DR register
__HAL_CRC_INITIALCRCVALUE_CONFIG(&hcrc, CRC_DR);
__HAL_CRC_DR_RESET(&hcrc);

Crypto library used:

AES256CBC.h

STM32F745: STM32CryptographicV3.1.2_CM7_GCC_FPU.a

STM32H743: libSTM32CryptographicV3.1.1_STM32H7_GCC.a

I hope it can help others.

2 REPLIES 2

This has been noted before, ST really needs to remove these "Am I an STM32" checks from these libraries

I think some of the windowing and graphic libraries also do this.

Used also to be problems with earlier crypto libraries where they would fail or provide bad results if the CRC unit clock was not enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

IIRC the ST crypto library readme says that the CRC device is not available when the crypto library is used.

-- pa