Netty, OkHTTP, Springboot test fixes.#334
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses wolfJSSE correctness issues identified during FIPS test coverage with Netty, Spring Boot, and OkHttp test suites. The changes focus on fixing SSLEngine buffer handling, close_notify state management, TrustManager exception propagation, hostname verification, session cache behavior, and trust store compatibility.
Changes:
- Fixed SSLEngine buffer underflow/overflow handling for partial TLS records and small output buffers
- Corrected close_notify shutdown state transitions and handshake status behavior for TLS 1.3
- Preserved TrustManager CertificateException as the cause of SSLHandshakeException in both SSLSocket and SSLEngine paths
- Improved hostname verification using SNI hostname over session peer IP and added server-side SNIMatcher enforcement
- Fixed session timeout boundary behavior and filtering of invalid/expired sessions from session context APIs
- Corrected trust store operator precedence bug and OCSP chain issuer handling
- Enhanced session value binding preservation and peer principal compatibility
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WolfSSLTrustX509Test.java | Added regression test for OCSP chain/issuer handling |
| WolfSSLTestFactory.java | Improved error diagnostics for close_notify test failures |
| WolfSSLSocketTest.java | Added test for SSLHandshakeException cause chain preservation |
| WolfSSLSessionContextTest.java | Added tests for session timeout boundary and invalidation filtering |
| WolfSSLJSSETestSuite.java | Removed trailing blank line |
| WolfSSLEngineTest.java | Added tests for exception cause chains, TLS 1.3 close_notify, buffer underflow/overflow |
| WolfSSLX509.java | Added equals() and hashCode() methods to Principal inner class |
| WolfSSLTrustX509.java | Fixed operator precedence bug and simplified OCSP chain/issuer handling |
| WolfSSLSocket.java | Preserved verify exception for SSLHandshakeException cause chain |
| WolfSSLSessionContext.java | Added session validation and timeout checking in getSession() and getIds() |
| WolfSSLInternalVerifyCb.java | Added verify exception storage and provider-level hostname verification |
| WolfSSLImplementSSLSession.java | Preserved session bindings on copy and improved peer principal compatibility |
| WolfSSLEngineHelper.java | Added getLastVerifyException() method and improved SNI auto-configuration |
| WolfSSLEngine.java | Fixed buffer overflow/underflow handling, close_notify state management, and exception cause chains |
| WolfSSLContext.java | Added cause to IllegalStateException when engine creation fails |
| WolfSSLAuthStore.java | Fixed session timeout boundary condition and added error handling |
| WolfSSLCertManager.java | Fixed trust-peer-cert mode CA loading condition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c219b1 to
82e9fa1
Compare
a3d80c9 to
dd6aab3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cconlon
left a comment
There was a problem hiding this comment.
I'll review this more early next week. Does this branch pass all of our existing SunJSSE tests?
- Add native JNI wrapper for wolfSSL_SNI_GetFromBuffer(), switch SSLEngine SNI extraction to use it with Java fallback for NOT_COMPILED_IN builds - Add clearPendingAppData() helper, clear stale pending app data on unwrap() exception paths, closeInbound(), and closeOutbound() - Reset pendingNetConsumed when stashing new decrypted data - Move getBytes() length validation before allocation - Add TLS-only clarifying comment on record-header underflow check - Detect peer closing connection during handshake (SSLHandshakeException) - Store verifyException on hostname verification failure paths - Add debug logging in setNativeTimeout catch block - Move word32 dropCount declarations before (void) casts for C89 - Re-interrupt thread on InterruptedException in session context tests - Add restoreClientSessionCacheProperty() test helper
12141ee to
9cf8fd4
Compare
9cf8fd4 to
882e216
Compare
882e216 to
f85402f
Compare
f85402f to
9d4381e
Compare
9d4381e to
655ea82
Compare
|
Changed one native file to address the claude feedback related to the c89 after declaration. This has nothing to do with my changes, but I still implemented it since it seems like something that should be done. I addressed the rest of the claude feedback related to my changes. |
|
Claude comments:
Native reuse suggestions:
|
ae5020e to
a675e39
Compare
|
I have a commit in one of my wolfssljni PRs that will fix the Patched JNI CI failure. Once that PR gets in, we can rebase this on top of master and the test should pass. Commit ref: bf911ff |
a675e39 to
5677a93
Compare
|
I added a few more bug fixes I found after your most recent okhttp feedback. These changes are contained in the last 2 commits. I changed the changed the setEnabledProtocols(empty) behavior in both WolfSSLServerSocket and WolfSSLSocket to accept empty arrays as this is what sunjsse does and what testsuites like netty and okhttp expect. When empty, no protocol restrictions are applied and wolfSSL uses its default protocol set. I also modified two of the unit tests accordingly. Still passes all sunJSSE tests. |
16f7c96 to
5876be8
Compare
|
Looks good overall, please hold off making any more fixes in this PR until we can get it in. For test failures, please rebase on master once #343 gets merged in, thanks. |
…, and trust manager
5876be8 to
817c3f6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
817c3f6 to
b86baa8
Compare
wolfJSSE fixes for FIPS test coverage (JSSE correctness / root-cause fixes)
Summary
This PR consolidates wolfJSSE fixes identified while running the Netty, Spring Boot,
and OkHttp test suites on the wolfSSL OpenJDK FIPS base image.
Key fixes
isOutboundDone()) when buffered close_notify datais still pending
in both SSLSocket and SSLEngine paths
when endpoint identification is enabled
SSLEngine(host, port)when no explicit SNI is configuredSSLEngine(host, -1)unknown-port hints (Netty compatibility)-1)selection
ExtendedSSLSessionsignature algorithm arrays>= timeout)SSLSessionContext.getIds()/getSession()WolfSSLTrustX509.getAcceptedIssuers()operator precedence bugWolfSSLCertManagerCA loading behavior with trust-peer-cert mode(
WOLFSSL_TRUST_PEER_CERT)equals()/hashCode()forWolfSSLX509principal compatibility pathsFixed Netty TLS 1.3 cipher/protocol parity in wolfJSSE: reconcile enabled protocols with configured cipher suites both at engine init and when SSLEngine.setEnabledCipherSuites()/setEnabledProtocols() is called pre-handshake.
Diagnostics / test coverage