Closed
Conversation
This was referenced Jan 22, 2023
dgarske
requested changes
Jan 24, 2023
Contributor
dgarske
left a comment
There was a problem hiding this comment.
As discussed please implement fix using the memset we discussed. Bug here is use of uninitialized stack memory.
| ESP32_SHA_HW = 1, | ||
| ESP32_SHA_SW = 2, | ||
| ESP32_SHA_FAIL_NEED_UNROLL = -1 | ||
| ESP32_SHA_FAIL_NEED_UNROLL = 3 |
Contributor
There was a problem hiding this comment.
If -1 worked consider reverting this change.
…essif_ED25519_fix
…essif_ED25519_fix
|
Can one of the admins verify this patch? |
Contributor
|
Closing in favor of #6068. |
Contributor
Author
|
@dgarske I do not believe the zeroize of buffer will fully resolve this issue. The situation that caused the odd ED25519 failure here was the use of a copy of an already-initialized SHA |
Contributor
Author
|
For reference, see #5948 (comment) for notes on resolution of this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR reorders the items in the WC_ESP32SHA typedef struct in the esp32-crypt.h used by Espressif HW Acceleration as noted in #5948 (comment), addressing the byte-alignment problem that cause the ESP32 ED25519 test to fail with Stack Smashing disabled. (The test did not fail with Stack Smashing set to
Normal)Fixes zd# n/a
Testing
Confirm Error Condition
With a struct like this, having the
lockDepthlisted first, Stack Smashing set toNoneand Espressif Hardware Acceleration enabled:Results in this error -229 (SIG_VERIFY_E = wolfcrypt signature verify error):
Confirm Success
Load the VisualGDB project and confirm
Stack Smashingis set toNone:Run the wolfSSL test as changed in this PR (be sure the latest wolfSSL component is installed) and confirm all tests pass:
Thank you @dgarske for suggesting item order. I may have otherwise simply changed the struct item
modetype fromESP32_MODE modetobyte modeas a working but still very fragile solution.Note the
ESP32_SHA_FAIL_NEED_UNROLLvalue, although changed in this PR, did not actually affect the success or failure of the ED25519 test as related to this byte alignment problem. It is changed only as related to a Best Practice advice.This code is still somewhat fragile. It might be nice to have something detect such byte alignment problems in Espressif, and possibly other environments as noted in #5989.
Checklist