-
Notifications
You must be signed in to change notification settings - Fork 50
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 PSS salt lengths #422
Fix RSA PSS salt lengths #422
Conversation
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.
Thanks, @trishankatdatadog. Great patch and issue/pr description!
Can automatically verify RSA PSS signatures regardless of the input salt length
Testing that would indeed be great. Do you have capacities?
Done. PTAL? |
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.
Thanks for adding tests, @trishankatdatadog! Left two non-blocking comments inline.
@lukpueh OK, done, simplified tests, PTAL, thx! |
- use maximum salt length by default when creating sigs - use automatic salt length inferred from sigs when verifying this should be the simplest, backwards-compatible, and secure way to verify cross-platform RSA PSS signatures, especially with Golang crypto/rsa
2b94e8e
to
1811500
Compare
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.
💯
Thanks, Lukas! Could we please get a release? Cc @yzhan289 |
In secure-systems-lab#422 we changed `create_rsa_signature` to use the maximum salt length available, instead of the digest length, when creating rsassa-pss signatures, and adapted `verify_rsa_signature` to infer the salt length automatically. This made it impossible for users of the old verify function, which could only handle digest sized salts, to verify signatures created by users of the new signing function (see secure-systems-lab#430). Since the advantage of max salt lengths is mostly academic, this patch reverts `create_rsa_signature` to use digest sized salts. Note that we now use the `padding.PSS.DIGEST_LENGTH` constant instead of passing the actual digest length, as we did before. Using the constant has the same result, but is recommended by the library documentation. Also note that the patch does not revert the `verify_rsa_signature` part of secure-systems-lab#422. This allows verifying signatures created with the securesystemslib release that used max salt lengths, or created outside of securesystemslib. Signed-off-by: Lukas Puehringer <[email protected]>
In secure-systems-lab#422 we changed `create_rsa_signature` to use the maximum salt length available, instead of the digest length, when creating rsassa-pss signatures, and adapted `verify_rsa_signature` to infer the salt length automatically. This made it impossible for users of the old verify function, which could only handle digest sized salts, to verify signatures created by users of the new signing function (see secure-systems-lab#430). Since the advantage of max salt lengths is mostly academic, this patch reverts `create_rsa_signature` to use digest sized salts (as agreed in secure-systems-lab#431). Note that we now use the `padding.PSS.DIGEST_LENGTH` constant instead of passing the actual digest length, as we did before. Using the constant has the same result, but is recommended by the library documentation. Also note that the patch does not revert the `verify_rsa_signature` part of secure-systems-lab#422. This allows verifying signatures created with the securesystemslib release that used max salt lengths, or created outside of securesystemslib. Signed-off-by: Lukas Puehringer <[email protected]>
Fixes: #421
Description of the changes being introduced by the pull request:
This PR does two things:
This should be the simplest, most backwards-compatible, and yet most secure way to verify cross-platform RSA PSS signatures.
Missing tests
Please verify and check that the pull request fulfils the following requirements: