-
Notifications
You must be signed in to change notification settings - Fork 58
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
Fix RSA signatures #82
Conversation
This parameter is used as both input and output. If it were set to 0, for example, the botan signing call would correctly fail.
@randombit could you help check if the fix is appropriate? Thanks @dewyatt ! |
Re the check you had to remove: PKCS signature formatting is 0001FFFF.... but how Botan implements unpadded RSA signatures the leading 00 byte is removed. I think the correct check here is changing the test to |
Apparently in_length isn't always adequate here and we should be more explicit anyways.
Codecov Report
@@ Coverage Diff @@
## master #82 +/- ##
==========================================
+ Coverage 21.29% 22.52% +1.22%
==========================================
Files 24 24
Lines 8939 8994 +55
Branches 10 10
==========================================
+ Hits 1904 2026 +122
+ Misses 7031 6964 -67
Partials 4 4
Continue to review full report at Codecov.
|
Apparently this was checking the PKCS encoding leading bytes and I was covering up a bug by removing this.
@randombit Thanks! Ok I see that makes sense from the RFC ( Anyways, it took me a while to finally realize it, but it looks like the issue was something different.
That first byte in hashbuf_from_sig is uninitialized memory (so it tended to fail that check I removed). Can you give it another quick look and let me know if it looks good to you? |
Argh yes uninitialized memory would do it, sorry about that - what you have here looks good to me. |
Hopefully closes https://github.com/riboseinc/rnp/issues/79
I think the main piece I'm not sure on here is the removal of the legacy code, but it was necessary to get
rnp --verify
to agree with the other tools.rnp/rnpv/gpg now all agree that the signatures are valid (and invalid when tampered with).
I think the crux of the issue here is a mismatch in parameter names in botan_privkey_load_rsa vs RSA_PrivateKey, so I filed a PR there: randombit/botan#1045