-
Notifications
You must be signed in to change notification settings - Fork 89
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
RSA Verify Refactor #709
RSA Verify Refactor #709
Conversation
src/internal.c
Outdated
|
||
if (ret == WS_SUCCESS) { | ||
if (publicKeyTypeSz != 14 && | ||
WMEMCMP(publicKeyType, "x509v3-ssh-rsa", 14) != 0) { |
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.
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.
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.
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.
src/internal.c
Outdated
WFREE(checkDigest, heap, DYNTYPE_BUFFER); | ||
#endif | ||
if (checkSig) | ||
WFREE(checkSig, heap, DYNTYPE_BUFFER); |
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.
Should be DYNTYPE_TEMP
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
RSA Verify Refactor
RSA Verify Refactor
RSA Verify Refactor
RSA Verify Refactor
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
while
version will repeatedly call the command. There's a 1/256 chance of the signature failing before the fix.