Open
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses Fenrir-reported JNI/JCE issues across RSA, HMAC, Ed25519, Curve25519, and related native bindings, and expands JUnit coverage for key crypto workflows and edge cases.
Changes:
- Fixes JNI argument handling/size conversions for RSA and corrects Ed25519 verify parameter usage.
- Adds stronger bounds validation and improved cleanup (local refs / pinned arrays) in several JNI modules.
- Adds/extends JUnit tests for Ed25519, Curve25519, RSA PKCS8 + raw export sizing, and HMAC offset/length behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/wolfssl/wolfcrypt/test/WolfCryptTestSuite.java | Adds Ed25519/Curve25519 tests to the suite. |
| src/test/java/com/wolfssl/wolfcrypt/test/RsaTest.java | Adds PKCS8 decode/verify and raw export sizing tests. |
| src/test/java/com/wolfssl/wolfcrypt/test/HmacTest.java | Adds tests for offset/length validation and ByteBuffer updates. |
| src/test/java/com/wolfssl/wolfcrypt/test/Ed25519Test.java | New JUnit coverage for Ed25519 sign/verify/export/import. |
| src/test/java/com/wolfssl/wolfcrypt/test/Curve25519Test.java | New JUnit coverage for Curve25519 shared secret and export/import. |
| src/main/java/com/wolfssl/wolfcrypt/Ed25519.java | Exposes Ed25519 key/signature sizes as Java constants. |
| src/main/java/com/wolfssl/wolfcrypt/Curve25519.java | Exposes Curve25519 key size as a Java constant. |
| src/main/java/com/wolfssl/provider/jce/WolfCryptCipher.java | Returns defensive copy of IV from engineGetIV(). |
| jni/jni_rsa.c | Fixes size type handling, cleanup, and encrypt-size checks in RSA JNI. |
| jni/jni_pwdbased.c | Avoids dereferencing NULL Java arrays when pinning password/salt buffers. |
| jni/jni_hmac.c | Adds offset/length bounds validation and fixes error propagation in final. |
| jni/jni_fips.c | Ensures pinned IV array is released on BAD_FUNC_ARG path. |
| jni/jni_ed25519.c | Improves NULL checks, removes stray printf, fixes sig length lookup. |
| jni/jni_ecc.c | Adds missing releases for pinned parameter arrays. |
| jni/jni_curve25519.c | Improves NULL checks and streamlines error handling for Curve25519 JNI. |
| jni/jni_chacha.c | Ensures pinned input is released on error and on success. |
| jni/include/com_wolfssl_wolfcrypt_Ed25519.h | Exposes Ed25519 size constants to JNI header. |
| jni/include/com_wolfssl_wolfcrypt_Curve25519.h | Exposes Curve25519 key size constant to JNI header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… variant, add tests
…tions, add Curve25519 JUnit tests
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.
Summary
This PR fixes 19 JNI/JCE issues identified by Fenrir, and adds some missing JUnit test coverage for Ed25519, Curve25519, RSA PKCS8 decode, RSA CRT export, and HMAC offset/length validation.