2025-04-24 3:23 AM - last edited on 2025-04-28 3:46 AM by Andrew Neil
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.
2025-04-28 3:16 AM
Hi @linglitel
Which versions of MbedTLS and X-Cube-CryptoLib are used ?
Can you provide minimal test project ?
Best Regards
2025-04-30 4:29 AM
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.
2025-05-08 2:13 AM
@CMYL Hi, just checking in — is there any progress regarding this issue?