-
Notifications
You must be signed in to change notification settings - Fork 3k
AES hardware acceleration not working for STM32F439xI #4928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @andresag01 Thanks for raising this. I don't understand the description, is the target device STM32F439Xl or UBLOX_EVK_ODIN_W2 ? |
@RonEld UBLOX_EVK_ODIN_W2 is a |
I see, thanks, |
cc @adustm |
This issue isn't affecting only u-blox targets. This issue affects at least all STM32F439xI-family targets that support AES hardware acceleration. |
@RonEld: The ciphersuite used for this specific server and example is TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256. So I suppose its AES-128. |
Hello, Thanks for reporting. I have reproduced the issue and will look at it. |
Seems that using the HW acceleration for crypto also breaks the SD-cards init. |
STM32F439xI-family AES hardware acceleration occasionally produces incorrect output (ARMmbed#4928). Don't enable AES HW acceleration on STM32F439xI-family targets by default until issue ARMmbed#4928 is fixed.
Hello, I have a question. Is it possible that once the issue happens ('TLS handshake failure'), the server refuses a new connection from my IP address for a while ?
|
@JanneKiiskila Why would you suggest this? AES and SD/SPI should be completely unrelated. Do you have an application example of this failure? |
@adustm: I looked up the error number
Also, from the tls-client app error message you got, it seems the failure was in line tls-client/main.cpp:205:
It looks to me like the device is not able to resolve the DNS? Perhaps the device is not in the network or the server is somehow unreachable? Perhaps there is some network configuration that is causing your device to return this error when it is reset quickly too many times? It seems that there are multiple functions in I suppose that it is also possible for servers to refuse connections from the same IP in quick succession, but I would expect the error to have a different value. Of course, I could be wrong... |
I just wanted to quickly ask if there were any updates regarding this issue... |
Dear all, Could someone look at that ? teratermaes_sw.txt Kind regards |
Hi @adustm As you can see, it's not only a different message length. It's a different message. The msgtype is 21 ( alert message) instead of 22 (handshake message. The reason for TLS failure is a fatal alert message received by the server. We need to investigate reason for the alert message, and why with HW acceleration the server failed. I suggest you test AES GCM with and with HW accelerated AES, perhaps there is something wrong with this part of the message |
The SD-card issue for us is related to the fact that we we encrypt the SD-card content, so it seems the HW crypto block doesn't work reliably. With the mbed-os-example-client we see the TLS failure. |
Hi @adustm, |
Hello @RonEld
No error was returned by HAL_CRYP_AESECB_Encrypt . GCM selftest is also fine (tested with both master branch and mbed-os-5.5 branch). Would you like to suggest another test ? |
I have modified gcm.c so that it can test 2 instances of ctx in parallel, and it's all OK. It looks like the AES hardware is perfectly well managing the save and restore context. Would someone have a multiple aes thread example that I could work on ? Kind regards |
Hi @adustm Regards, |
Hello @RonEld It's all OK.
Any other idea ? |
@JanneKiiskila could I access your program to test it ? |
HI @adustm At the moment, I can think that perhaps there was some preemption, causing the HW to load a different key. Perhaps it's a matter of GCM + AES muti threading scenario. |
Hei, @adustm - I know STM is a member of mbed Cloud Partners, you have access to these repositories which contain the SW we are running. Email was sent with a bit more details. |
Can we raise this to blocker, please. |
The fix will get CI once CI is back running. |
@0xc0170 can you add a reference here to the fixing PR? |
I think this is the PR: #4934 |
That's not the fix, though, that's a workaround. I guess ST, maybe @adustm, is still fighting the problem? |
Hello, |
Uh oh!
There was an error while loading. Please reload this page.
Description
Bug
Our automated tests for the tls-client example in the mbed-os-example-tls fails with the following error message printed in the serial console (target UBLOX_EVK_ODIN_W2) :
When we enable debug printing, we observe that the TLS connection terminates prematurely because the server sent the tls-client a fatal alert message as the MAC of a TLS record does not check out:
We investigated the problem and found that disabling the AES hardware acceleration code fixes it. To test this, we used the following diff:
Target
STM32F439xI family of devices with hardware acceleration enabled
Toolchain:
GCC_ARM
mbed-os sha:
Git tag mbed-os-5.5.5
Expected behavior
The tls-client example should succeed.
Actual behavior
The tls-client example fails with error:
Steps to reproduce
Run the tls-client at mbed-os-example-tls repository (with mbed-os-5.5.4 tag) using the GCC_ARM toolchain on the UBLOX_EVK_ODIN_W2 target. The failure message can be observed in the serial output.
The text was updated successfully, but these errors were encountered: