Fixes for PSK hint, timeout range, peer-name and cookie-callback JNI cleanup - #410
Open
cconlon wants to merge 5 commits into
Open
Fixes for PSK hint, timeout range, peer-name and cookie-callback JNI cleanup#410cconlon wants to merge 5 commits into
cconlon wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses several JNI/JSSE edge cases in wolfssljni (Fenrir fixes) around PSK hint handling, timeout validation, peer-name getters, DTLS cookie callback JNI cleanup, and example/runtime classpath ordering.
Changes:
- Add JNI validation for
setTimeoutinputs and corresponding new unit test coverage for invalid ranges. - Harden JNI peer certificate issuer/subject getters against null conversions; improve DTLS cookie callback local-ref cleanup.
- Allow PSK client callback to be invoked even when the native PSK hint is NULL; reorder example classpath so the example main class resolves first.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/test/com/wolfssl/test/WolfSSLSessionTest.java |
Adds a new test covering invalid setTimeout values and state preservation. |
src/test/com/wolfssl/provider/jsse/test/WolfSSLParametersPskTest.java |
Adds a new engine handshake test for the “no server PSK hint” case. |
src/java/com/wolfssl/WolfSSLSession.java |
Updates setTimeout Javadoc to document the accepted range and return behavior. |
native/com_wolfssl_WolfSSLSession.c |
Enforces setTimeout range in JNI; guards against NULL issuer/subject name conversion. |
native/com_wolfssl_WolfSSLContext.c |
Cleans up JNI local references across all DTLS cookie callback exit paths; allows NULL PSK hints. |
examples/provider/DualProviderFIPSTest.sh |
Reorders runtime classpath to prioritize examples/provider. |
.github/workflows/fips-ready-dual-provider.yml |
Matches classpath ordering change in CI for DualProviderFIPSTest runtime. |
Suppressed comments (1)
src/test/com/wolfssl/provider/jsse/test/WolfSSLParametersPskTest.java:405
- The assertions currently require an empty string hint, but the native fix explicitly allows the hint pointer to be NULL, which will surface to Java as
null(seeNativePskClientCbcreating nojstringwhenhint == NULL). Adjust the test to (1) assert the callback ran (using a sentinel) and (2) acceptnullor empty string as the “no hint” case.
/* Absent server hint arrives as an empty String, not a failure */
assertNotNull("PSK client callback did not receive a hint",
recvHint[0]);
assertEquals("", recvHint[0]);
💡 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 includes five Fenrir fixes:
setTimeoutvalues outside [0, UINT32_MAX] withBAD_FUNC_ARGinstead of truncating them.NewStringUTF.examples/providerahead of the wolfcrypt-jni jar so the example's own main class resolves first.