RSA Verify Refactor#709
Merged
dgarske merged 1 commit intowolfSSL:masterfrom Jun 5, 2024
Merged
Conversation
dgarske
requested changes
Jun 5, 2024
|
|
||
| if (ret == WS_SUCCESS) { | ||
| if (publicKeyTypeSz != 14 && | ||
| WMEMCMP(publicKeyType, "x509v3-ssh-rsa", 14) != 0) { |
Member
There was a problem hiding this comment.
Would be nice to have the "x509v3-ssh-rsa" as a macro and also use XSTRLEN. Is this a new check? Do you expect any compatibility issues?
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Contributor
Author
There was a problem hiding this comment.
I do want to double check the strings and use names for the strings in general, I think that's outside the scope of this PR.
| WFREE(checkDigest, heap, DYNTYPE_BUFFER); | ||
| #endif | ||
| if (checkSig) | ||
| WFREE(checkSig, heap, DYNTYPE_BUFFER); |
JacobBarthelmeh
previously approved these changes
Jun 5, 2024
34b2e7a to
e1439e3
Compare
1. If the signature to verify is short, pad it to the key length with leading zeros. Some implementations of SSH will prune leading zeros from an mpint value as a string for the signature. 2. Change some of the GetSize() and play with pointers to using GetStringRef() or GetMpint(). 3. Added an RSA private key for testing with PuTTY client.
e1439e3 to
12b0a43
Compare
dgarske
approved these changes
Jun 5, 2024
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
Some implementations of SSH will remove all leading zeros from an encoded RSA signature, which is allowed per the RFCs. Our verify function requires the signature to be the same size as the key. This refactor will pad a signature with leading zeros if it is short. (ZD 18095)
Testing
Run the echoserver and the PuTTY plink tools:
The
whileversion will repeatedly call the command. There's a 1/256 chance of the signature failing before the fix.