Hardening for RSA-PSS verify, AES-GMAC init, JNI exceptions, debug logging - #273
Open
cconlon wants to merge 5 commits into
Open
Hardening for RSA-PSS verify, AES-GMAC init, JNI exceptions, debug logging#273cconlon wants to merge 5 commits into
cconlon wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Hardening changes across JCE/JNI and tests to make crypto behavior safer and more predictable (RSA-PSS verify semantics, AES-GMAC tag handling, JNI exception safety, and removal of sensitive debug hex dumps).
Changes:
- Add tests and implementation changes so RSA-PSS verify returns
falsefor invalid signatures rather than throwing. - Validate AES-GMAC tag length at
Mac.init()and ensure rejected init does not mutate existing MAC state. - Preserve pending JNI exceptions / avoid using unresolved field IDs, fix an OCSP doc comment sentinel, and remove sensitive
LogHexdumps.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/wolfcrypt/test/RsaTest.java | Extends RSA-PSS tests for corrupted signatures and salt-length discovery behavior. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMacTest.java | Adds AES-GMAC tag-length validation and “rejected init preserves state” tests. |
| src/main/java/com/wolfssl/wolfcrypt/Rsa.java | Updates RSA-PSS verify Javadoc to reflect new error/return semantics. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptMac.java | Validates GMAC tag length before mutating fields and avoids silent truncation. |
| jni/jni_wolfssl_cert_manager.c | Corrects OCSP-response success sentinel in the doc comment. |
| jni/jni_rsa.c | Adjusts RSA-PSS verify JNI behavior to map invalid signature failures to false. |
| jni/jni_rng.c | Removes debug hex dump of RNG output. |
| jni/jni_native_struct.c | Preserves pending JNI exceptions and avoids unresolved jfieldID usage. |
| jni/jni_hmac.c | Removes debug hex dumps of HMAC input/output. |
| jni/jni_fips.c | Removes debug hex dumps of sensitive material (keys/plaintext/secrets/RNG output) in FIPS paths. |
| jni/jni_ecc.c | Removes debug hex dumps of ECC private/export/shared-secret outputs. |
| jni/jni_dh.c | Removes debug hex dumps of DH private/secret material. |
| jni/jni_des3.c | Removes debug hex dumps of DES3 input/output buffers. |
| jni/jni_aescmac.c | Removes debug hex dumps of CMAC inputs/outputs and verify MAC bytes. |
| jni/jni_aes.c | Removes debug hex dumps of AES input/output buffers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
This PR fixes 5 Fenrir issues:
Mac.init()instead of silently truncatinggetNativeStruct()verifyreturnsfalsefor an invalid signature instead of throwingWOLFSSL_SUCCESSis 1, not 0)LogHexin FIPS and non-FIPS paths