-
Notifications
You must be signed in to change notification settings - Fork 925
force local wc_nnn hash struct variables to zeros #6068
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -573,10 +573,13 @@ static int InitSha512_256(wc_Sha512* sha512) | |
| static int InitSha512_Family(wc_Sha512* sha512, void* heap, int devId, | ||
| int (*initfp)(wc_Sha512*)) | ||
| { | ||
| int ret = 0; | ||
| int ret = 0; | ||
|
|
||
| if (sha512 == NULL) | ||
| if (sha512 == NULL) { | ||
| return BAD_FUNC_ARG; | ||
| } | ||
|
|
||
| XMEMSET(sha512, 0, sizeof(wc_Sha512)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed wc_InitSha383_ex(). |
||
|
|
||
| sha512->heap = heap; | ||
| #ifdef WOLFSSL_SMALL_STACK_CACHE | ||
|
|
@@ -588,8 +591,9 @@ static int InitSha512_Family(wc_Sha512* sha512, void* heap, int devId, | |
| #endif | ||
|
|
||
| ret = initfp(sha512); | ||
| if (ret != 0) | ||
| if (ret != 0) { | ||
| return ret; | ||
| } | ||
|
|
||
| #if defined(USE_INTEL_SPEEDUP) && \ | ||
| (defined(HAVE_INTEL_AVX1) || defined(HAVE_INTEL_AVX2)) | ||
|
|
@@ -1620,6 +1624,7 @@ int wc_InitSha512_224(wc_Sha512* sha) | |
| { | ||
| return wc_InitSha512_224_ex(sha, NULL, INVALID_DEVID); | ||
| } | ||
|
|
||
| int wc_Sha512_224Update(wc_Sha512* sha, const byte* data, word32 len) | ||
| { | ||
| return wc_Sha512Update(sha, data, len); | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed wc_InitSha256_ex()
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SparkiDev thanks for your review! Would you recommend that I do a
XMEMSETin each of these?I'm not entirely convinced it is a good idea for software-only hashes. The only reason I found this and started to do the initializations was due to undesired hardware encryption state data being copied into a new sha
ctxinstance.Please advise. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the PR is to memset the data structure when using hardware and they are the implementations for hardware, then yes.
If you can't find a common for each function, then it needs to be done in each.