Skip to content

RTG-5132 Bump BoringSSL - #524

Merged
Lekensteyn merged 4 commits into
masterfrom
bas/RTG-5132
Sep 30, 2026
Merged

Lekensteyn merged 4 commits into
masterfrom
bas/RTG-5132

Conversation

@bwesterb

@bwesterb bwesterb commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Most of our patches required work:

  1. pq: (a) Upstream removed Kyber. We keep X25519Kyber768 and P256Kyber768 by implementing Kyber768 on top of ML-KEM-768.

    (b) Improve documentation of what's currently supported.

  2. allow-crl-extensions-bad-version: Properly document what the patch actually does. Also improve its tests.

  3. relax-cert-validation: Upstream removed enforce_rsa_key_usage; inline the behaviour instead.

I tested the Kyber key exchanges of the new BoringSSL against the old both as client and server. I didn't add a Go test for it to keep the patch small (not wanting to bring in a Kyber implementation.)

@bwesterb
bwesterb requested review from cjpatton and johnhurt August 20, 2026 15:39
Most of our patches required work:

1. pq: (a) Upstream removed Kyber. We keep X25519Kyber768 and
   P256Kyber768 by implementing Kyber768 on top of ML-KEM-768.

   (b) Improve documentation of what's currently supported.

2. allow-crl-extensions-bad-version: Properly document what the patch
   actually does. Also improve its tests.

3. relax-cert-validation: Upstream removed enforce_rsa_key_usage;
   inline the behaviour instead.

@Lekensteyn Lekensteyn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I was worried about the impact of the RSA Key Usage not relaxing TLS 1.3, but that was already the status quo before.

What wasn't immediately obvious to me, and explains why the reported kind of breakage is not more widespread: X.509 certificates with RSA keys pass the key usage check either (1) when the requested key usage bit is set, or (2) when the Key Usage extension is missing.

The last case should cover the majority of RSA keys, like the one generated with openssl req -new -x509 -keyout server.pem -out server.pem -sha256 -nodes -subj /

@Lekensteyn Lekensteyn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

While trying to apply the boring-pq patch on boringssl, I noticed some more minor issues. See comments.

@@ -141,21 +157,30 @@ index 055b3e025..09d6508f4 100644
+OPENSSL_EXPORT void SSL_CTX_use_second_keyshare(SSL_CTX *ctx, int enabled);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unit tests (part of ninja run_tests) fail unless this is applied:

--- a/include/openssl/prefix_symbols.h
+++ b/include/openssl/prefix_symbols.h
@@ -2102,2 +2102,3 @@
 #pragma redefine_extname SSL_CTX_use_psk_identity_hint BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_CTX_use_psk_identity_hint)
+#pragma redefine_extname SSL_CTX_use_second_keyshare BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_CTX_use_second_keyshare)
 #pragma redefine_extname SSL_ECH_KEYS_add BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_ECH_KEYS_add)
@@ -2451,2 +2452,3 @@
 #pragma redefine_extname SSL_use_psk_identity_hint BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_use_psk_identity_hint)
+#pragma redefine_extname SSL_use_second_keyshare BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_use_second_keyshare)
 #pragma redefine_extname SSL_used_hello_retry_request BORINGSSL_ADD_USER_LABEL_AND_PREFIX(SSL_used_hello_retry_request)
@@ -5239,2 +5241,3 @@
 #define SSL_CTX_use_psk_identity_hint BORINGSSL_ADD_PREFIX(SSL_CTX_use_psk_identity_hint)
+#define SSL_CTX_use_second_keyshare BORINGSSL_ADD_PREFIX(SSL_CTX_use_second_keyshare)
 #define SSL_ECH_KEYS_add BORINGSSL_ADD_PREFIX(SSL_ECH_KEYS_add)
@@ -5588,2 +5591,3 @@
 #define SSL_use_psk_identity_hint BORINGSSL_ADD_PREFIX(SSL_use_psk_identity_hint)
+#define SSL_use_second_keyshare BORINGSSL_ADD_PREFIX(SSL_use_second_keyshare)
 #define SSL_used_hello_retry_request BORINGSSL_ADD_PREFIX(SSL_used_hello_retry_request)

This possibly changed in commit google/boringssl@d32c35e (committed 2026-01-27, part of 0.20260204.0).

Comment thread boring-sys/patches/boring-pq.patch Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To prevent this From line from changing after patch changes, I used --zero-commit:

git format-patch --zero-commit --no-numbered --no-signature

Comment thread boring-sys/patches/boring-pq.patch Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's prepend SSL_GROUP_X25519_MLKEM768 here to ensure it is enabled when using SSL_set_compliance_policy(ssl, ssl_compliance_policy_fips_202205).

Alternatively, we stop patching this and require our users to move away from this API.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We have users of the API

Comment thread boring-sys/patches/boring-pq.patch Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This note is obsolete and needs to be removed, X25519MLKEM768 is already enabled by default since 0.20260713.0 (commit date 2026-07-09) via google/boringssl@e748fac

Comment thread boring-sys/patches/boring-pq.patch Outdated
index 53fd5ea99..e21047412 100644
--- a/ssl/test/runner/common.go
+++ b/ssl/test/runner/common.go
@@ -2186,7 +2186,7 @@ type ProtocolBugs struct {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This diff below seems incorrect and should be removed:

--- a/ssl/test/runner/common.go
+++ b/ssl/test/runner/common.go
@@ -2186,7 +2186,7 @@ type ProtocolBugs struct {
        FailIfHelloRetryRequested bool

        // FailIfPostQuantumOffered will cause a server to reject a ClientHello if
-       // post-quantum curves are supported.
+       // post-quantum curves are not supported.
        FailIfPostQuantumOffered bool

        // ExpectKeyShares, if not nil, lists (in order) the curves that a ClientHello

The previous comment was correct. If this flag is set, the peer will reject a Client Hello if PQ curves are included (supported).

Enable X25519MLKEM768 in the fips202205 compliance profile, previously
we added P256Kyber768Draft00 to it as well. Update commit message to
reflect that X25519MLKEM768 is already enabled by default.

Update prefix_symbols.h for the added `SSL_use_second_keyshare` API,
otherwise `ninja run_tests` fails.

Remove unnecessary fuzzer and test changes (`-curves`, comments). Remove
NotJustMLKEMKeyShare case, this was a wrongly resolved merge conflict,
NotJustMLKEMKeyShare-X25519MLKEM768 already covers it.
Comment thread boring/src/lib.rs Outdated
Comment on lines +16 to +17
//! By default, the crate statically links against a pinned BoringSSL revision, vendored as a
//! submodule at `boring-sys/deps/boringssl`. The current pin is upstream tag `0.20260813.0`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This comment is likely to become stale. Perhaps add an AGENTS.md with a note about this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We have no AGENTS.md, but thanks for the reminder. I updated it. We also need to bump the crate major version according the the comment.

Resolved conflicts due to upstream changes:

 * 4dc638345 Turn SSL_SESSION into an opaque struct
   Simple rename of SSL_SESSION -> SSLSession.
 * ba26b4cb8 Add ssl_compliance_policy_fips_202609
   Trivial context change, updated commit message as well.
@Lekensteyn

Copy link
Copy Markdown
Collaborator

So, one of the tests is failing:

thread 'x509::tests::trusted_first::test_verify_cert' (9925) panicked at boring/src/x509/tests/trusted_first.rs:50:5:
assertion `left == right` failed
  left: Err(X509VerifyError { code: 10, error: "certificate has expired" })
 right: Ok(())

Presumably caused by google/boringssl@defe581 ("Always enable X509_V_FLAG_TRUSTED_FIRST", part of 0.20260903.0).

As a result, this test always fails -- permitting alternative trust paths that validate:

    assert_eq!(
        Err(X509VerifyError::CERT_HAS_EXPIRED),
        verify(
            &leaf,
            &[&root1, &root2],
            &[&intermediate, &root1_cross],
            |param| param.clear_flags(X509VerifyFlags::TRUSTED_FIRST), // <-- no-op
         )
    );

@nox this test was introduced in commit dfd49f4. Is anything relying on the ability to disable the effects of this flag?

Since boringssl 0.20260903.0 (commit defe5810ee8b), the
X509_V_FLAG_TRUSTED_FIRST flag has no effect. Adjust tests accordingly.
We should consider removing this flag and X509_V_FLAG_NO_ALT_CHAINS too
since the constant is zero, any code using it needs to be re-evaluated.
@Lekensteyn
Lekensteyn merged commit 45512aa into master Sep 30, 2026
29 checks passed
@nox

nox commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@nox this test was introduced in commit dfd49f4. Is anything relying on the ability to disable the effects of this flag?

I added this to make the older FIPS build match the newer BoringSSL default. Clearing the flag was just a regression-test control; our application code enables it. Making the behavior unconditional is consistent with the original fix.

@Lekensteyn
Lekensteyn deleted the bas/RTG-5132 branch October 12, 2026 16:26
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.

4 participants