Repository navigation
rsa: fix verify_recover size query, digest output and no padding - #517
Open
ColtonWilley wants to merge 2 commits into
Open
ColtonWilley wants to merge 2 commits into
ColtonWilley wants to merge 2 commits into
Conversation
The NULL-buffer size query failed, breaking pkeyutl -verifyrecover and pyca recover_data_from_signature(). With a digest set, check the DigestInfo and output only the digest; support RSA_NO_PADDING, used by OpenSC C_Verify for CKM_RSA_X_509 and RSA-PSS. Matches the default provider.
Size query, digest-only output, malformed DigestInfo and no padding, against the default provider.
There was a problem hiding this comment.
🔵 Needs a closer look
Cryptographic recovery changes need human review and runtime validation across supported wolfSSL/OpenSSL configurations.
No open issues 🎉
What changed in this PR
This PR updates RSA signature recovery in the wolfSSL provider to improve compatibility with OpenSSL’s default provider and consumers such as pyca/cryptography and OpenSC.
Changes:
- Supports NULL-buffer size queries and
RSA_NO_PADDINGrecovery. - Validates DigestInfo and returns only the digest when a digest algorithm is configured.
- Adds regression tests for recovery output, malformed inputs, buffer sizes, and default-provider compatibility.
| File | Description |
|---|---|
test/unit.h |
Declares the new recovery test. |
test/unit.c |
Registers the new recovery test. |
test/test_rsa.c |
Adds recovery and compatibility regression cases. |
src/wp_rsa_sig.c |
Updates recovery behavior, validation, and API documentation. |
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.
wp_rsa_verify_recoverfailed the NULL-buffer size query, returned the DigestInfo instead of the digest, and rejectedRSA_NO_PADDING. In replace-default mode this breaks pyca/cryptographyrecover_data_from_signature(),openssl pkeyutl -verifyrecover, and OpenSCC_VerifyforCKM_RSA_X_509and all RSA-PSS mechanisms (CKR_GENERAL_ERROR). It now matches the default provider; verified with real pyca and OpenSCpkcs11-tool --verifyon a virtual CAC card.