Skip to content

Support JSSE jdk.tls.allowLegacyMasterSecret to require TLS Extended Master Secret - #448

Merged
rlm2002 merged 1 commit into
wolfSSL:masterfrom
cconlon:jsseAllowLegacyMasterSecret
Nov 11, 2026
Merged

rlm2002 merged 1 commit into
wolfSSL:masterfrom
cconlon:jsseAllowLegacyMasterSecret

Conversation

@cconlon

@cconlon cconlon commented Nov 10, 2026

Copy link
Copy Markdown
Member

Adds support for the SunJSSE jdk.tls.allowLegacyMasterSecret System property. When set to "false", TLS 1.2 and earlier handshakes that do not negotiate Extended Master Secret (RFC 7627) fail instead of falling back to a legacy master secret.

  • JNI: add WolfSSLSession.requireExtendedMasterSecret(), wrapping native wolfSSL_RequireExtendedMasterSecret() (wolfSSL 5.9.4+)
  • JSSE: require EMS when the property is "false". TLS 1.3 is not affected, and the property is ignored when
    jdk.tls.useExtendedMasterSecret=false.
  • Fails closed: if native wolfSSL cannot require EMS (older than 5.9.4, or EMS not compiled in), handshake setup throws
    SSLException when a protocol below TLS 1.3 can be negotiated

@cconlon cconlon self-assigned this Nov 10, 2026
Copilot AI balanced review requested due to automatic review settings November 10, 2026 00:07
@cconlon

cconlon commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

@claude review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Security-sensitive EMS enforcement relies on native wolfSSL code absent from this snapshot, leaving fail-closed handshake behavior and compatibility across supported, older, and EMS-disabled builds unverified.

No open issues 🎉

1 file not reviewed
  • native/com_wolfssl_WolfSSLSession.h: Generated file
What changed in this PR

Adds wolfJSSE support for jdk.tls.allowLegacyMasterSecret, allowing applications to require Extended Master Secret (EMS) for TLS 1.2 and earlier.

Changes:

  • Adds a Java/JNI wrapper for requiring EMS with native wolfSSL 5.9.4+.
  • Validates the property and fails closed when EMS cannot be required, while preserving TLS 1.3 and explicitly disabled EMS behavior.
  • Documents the property and adds native-wrapper and JSSE handshake tests.
File Description
src/​test/​com/​wolfssl/​test/​WolfSSLSessionTest.java Tests native support detection and calls after session cleanup.
src/​test/​com/​wolfssl/​provider/​jsse/​test/​WolfSSLTestFactory.java Captures handshake exceptions for test assertions.
src/​test/​com/​wolfssl/​provider/​jsse/​test/​WolfSSLEngineTest.java Tests EMS enforcement, unsupported configurations, and property validation.
src/​java/​com/​wolfssl/​WolfSSLSession.java Exposes requireExtendedMasterSecret().
src/​java/​com/​wolfssl/​provider/​jsse/​WolfSSLUtil.java Parses and validates the new system property.
src/​java/​com/​wolfssl/​provider/​jsse/​WolfSSLEngineHelper.java Applies EMS requirements during session setup.
README.md Documents property behavior and native requirements.
native/​com_wolfssl_WolfSSLSession.h Declares the new JNI entry point.
native/​com_wolfssl_WolfSSLSession.c Wraps native EMS enforcement with capability guards.

Review effort: Balanced

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and found no bugs. It changes when TLS handshakes fail during security negotiation, so a human should still look at it before merge.

What was reviewed:

  • I followed the JNI path from requireExtendedMasterSecret() to the native wolfSSL_RequireExtendedMasterSecret(). The version and feature checks return NOT_COMPILED_IN when support is missing.
  • In setLocalExtendedMasterSecret(), a "false" value is ignored when EMS is disabled. If requiring EMS fails, setup throws SSLException unless only (D)TLS 1.3 can be negotiated.
  • setLocalParams() calls applyConfiguredCipherProtocolSettings() before setLocalExtendedMasterSecret(). That means effectiveProtocols is already set when isPreTLS13Enabled() reads it, and the method assumes older protocols are possible if the list is null.
  • I did not run the build or the JUnit tests.
Extended reasoning...

The change adds a JNI wrapper and native function for requiring TLS Extended Master Secret (RFC 7627). It also adds wolfJSSE handling of the jdk.tls.allowLegacyMasterSecret property, with new tests and README text. This touches TLS handshake security: when a TLS 1.2 or earlier peer does not negotiate EMS, the handshake now fails instead of falling back to a legacy master secret. I deferred because this is crypto and protocol security behavior, and the fail-closed rules depend on the native wolfSSL version and build flags. The repository has no CODEOWNERS file, and the timeline shows no outstanding objections.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #448

Scan targets checked: wolfssljni-src, wolfssljni-bugs
Not reviewed (no scan target covers them): README.md
Coverage: 6 of 8 in-scope changed file(s) opened by the reviewer; not opened: src/test/com/wolfssl/provider/jsse/test/WolfSSLEngineTest.java, src/test/com/wolfssl/test/WolfSSLSessionTest.java

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@cconlon cconlon assigned rlm2002 and wolfSSL-Bot and unassigned cconlon Nov 10, 2026
@rlm2002
rlm2002 merged commit 92388d7 into wolfSSL:master Nov 11, 2026
110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants