Repository navigation
rsa: accept short PKCS#1 v1.5 signatures without a digest - #514
Open
ColtonWilley wants to merge 2 commits into
Open
ColtonWilley wants to merge 2 commits into
ColtonWilley wants to merge 2 commits into
Conversation
rpm-sequoia verifies OpenPGP RSA signatures via EVP_PKEY_verify with no digest set and leading zeros stripped from the signature MPI, so ~1 in 256 fail. Left-pad them as the default provider's RSA_public_decrypt does. PSS, X9.31 and PKCS#1 with a digest still require full length (RFC 8017).
Accepted without a digest, rejected with one, as the default provider does.
There was a problem hiding this comment.
🟢 Approval recommended
The padding change is narrowly scoped, buffer cleanup is sound, and regression coverage checks acceptance and rejection behavior with no unresolved findings.
No open issues 🎉
What changed in this PR
This PR fixes RSA verification compatibility with rpm-sequoia in replace-default mode by accepting short PKCS#1 v1.5 signatures when no digest is configured.
Changes:
- Left-pads short signatures with zeros only for digest-free PKCS#1 v1.5 verification.
- Preserves existing signature-length behavior for other verification modes.
- Adds regression coverage for valid short signatures, corrupted signatures, and digest-based length checks.
| File | Description |
|---|---|
test/unit.h |
Declares the short-signature regression test. |
test/unit.c |
Registers the regression test. |
test/test_rsa.c |
Tests short-signature behavior against both providers. |
src/wp_rsa_sig.c |
Adds conditional left-padding and frees the temporary buffer. |
Review effort: Balanced
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.
In replace-default mode, rpm on RHEL 10 rejects ~1 in 256 validly signed RSA packages (
Header V4 RSA/SHA256 Signature: BAD). rpm-sequoia verifies viaEVP_PKEY_verifywith no digest set and the signature's leading zero bytes stripped, which the default provider accepts. Such short PKCS#1 v1.5 signatures are now left-padded; PSS, X9.31 and PKCS#1 with a digest still require full length (RFC 8017).