cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 + TrustZone enabled, mbedTLS and X-CUBE-CRYPTOLIB return incorrect SHA256.

linglitel
Associate II

STM32U585 

When TrustZone is enabled, X-CUBE-CRYPTOLIB produces incorrect SHA256 hash values.
Additionally, mbedTLS generates incorrect public keys when creating ECDSA key pairs, and this issue is 100% reproducible.
Neither hardware acceleration is enabled, and both mbedTLS and X-CUBE-mbedTLS have been correctly configured.
When TrustZone is not enabled, both libraries work correctly without any issues.

I have searched the internet, but I couldn't find any information related to this issue.

I have submitted a support ticket, but they directed me to seek help through the community.
I believe this is a technical issue, but I am unable to resolve it myself. What should I do next?
Thank you.

rtaImage.png

rtaImage.png

rtaImage.png

  

3 REPLIES 3
CMYL
ST Employee

Hi @linglitel 

Which versions of MbedTLS and X-Cube-CryptoLib are used ?

Can you provide minimal test project ?

 

Best Regards

Thank you for your reply. I have published a minimal reproducible example on GitHub, using the latest version of X-CUBE-CRYPTOLIB, which is definitely obtained from ST.

I have correctly enabled TrustZone (TZEN) according to the community's instructions.

The issue does not appear to be related to any other peripherals, so I only enabled ICACHE and GPIO to monitor the MCU's behavior.

However, it still doesn't work as expected — the SHA256 output is consistently incorrect, although the result remains the same on every run.

Apologies, but the minimal example does not use mbedtls because its behavior is consistent with X-CUBE-CRYPTOLIB, always producing the same incorrect value. If needed, I can upload an example that uses STM32-MW-MBEDTLS, which is maintained by ST.This is github link
https://github.com/linglitel/bad_value_with_trustzone_for_STM32u585
I am sincerely appreciative.

linglitel_0-1746012293749.png

linglitel_1-1746012390848.pnglinglitel_2-1746012424601.png

 

 

linglitel
Associate II

@CMYL  Hi, just checking in — is there any progress regarding this issue?