Repository navigation
Negotiate post-quantum X25519MLKEM768 key exchange by moving TLS from ring to aws-lc-rs - #102
Merged
Merged
Conversation
…ws-lc-rs ring has no ML-KEM, so symphony could only negotiate classical groups with clients that offer the hybrid X25519MLKEM768 first (current browsers, Node 22.20+). rustls 0.23.48 also deprecates ring's default provider for that reason. - One provider, tls::crypto_provider(): aws-lc-rs with key exchange groups X25519MLKEM768, X25519, P-256, P-384, passed explicitly to every ServerConfig and to the mTLS verifier, and installed as the process default. - ring is gone: the ticketer is aws-lc-rs's, the cache-key SHA-256 uses sha2, and tarpit jitter draws from the provider's RNG. - .cargo/config.toml forces aws-lc-sys to build its static AWS-LC from source; CI and release check each artifact links no system libcrypto and exports no OpenSSL symbol. - Tests: Rust negotiation tests against TlsConfigCache configs, and Node cases through a real proxy (the hybrid ones skip below OpenSSL 3.5). - benchmark:handshake measures full and resumed handshake cost per group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
The Linux check no longer drops undefined symbols, so an import of OpenSSL resolving against Node's copy fails it too; macOS now also checks exported symbols and a shared aws-lc. The benchmark reports handshakes it completed, rejects non-positive options, and fails instead of hanging when a seed connection closes without a ticket or a child exits early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
The benchmark becomes benchmark-tls with a bulk echo arm per TLS 1.3 suite, and tears its children down when a run fails. AWS_LC_SYS_STATIC is forced beside USE_SYSTEM. The JS tests offer explicit group lists instead of the runtime's default, including a client that ranks X25519 first; the Rust ALPN test clients offer the production groups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
The parent gives a child 30 s to answer a ready, port or CPU request, sends through a checked channel, and kills a proxy that does not stop in 10 s; a nonzero proxy exit fails the run. A child whose parent goes away exits. Bulk arms now cover the three TLS 1.2 ECDHE-RSA AEAD suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
Bulk clients connect before reporting ready, so the CPU window holds only record encryption. Drops the stock-rustls offer from the hybrid test, which the production offer covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
Bulk lanes warm up with one echo before ready and reject a socket that closed before its echo; the benchmark route sends no PROXY header, so the echo is byte-exact. SECURITY.md says a FIPS build also drops X25519, and the CI comment names what the linkage check matches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
SECURITY.md and CLAUDE.md no longer call every sha2 digest a label: tls::sha256 keys the config cache and compares mTLS CA bundles, so a FIPS build moves it to the provider. CLAUDE.md names what the linkage check matches. Benchmark children send through one helper that exits on a closed channel, the proxy child handles a disconnect from its start, and a settled echo drops its drain listener. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
…hooks aws-lc-sys compiles with the image's TARGET_CC (aarch64-unknown-linux-gnu-gcc) ahead of CC_<target>, so the clang-only --gcc-toolchain flag that main kept for ring's assembly broke the aarch64-gnu build. With ring gone, that target now compiles jemalloc with the same cross GCC and carries no clang flags. The Linux linkage check matched AWS-LC's OPENSSL_memory_* allocator hooks: weak undefined references on ELF that a host may define and OpenSSL does not, so they cannot bind to Node's libcrypto. The check now skips exactly those four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
…c claims - handshake() rejects on close and after 5 s, removes its listeners once settled, and leaves an error handler that closes the socket. - A bulk client refuses to report ready if any lane closed after warm-up, not only the first; the parent bounds each report wait. - The upstream listen rejects on error, and a proxy child whose parent left during start() lets the disconnect handler finish its stop. - SECURITY.md and CLAUDE.md name Node 22.20+ and 24.5+ (24.0-24.4 predate OpenSSL 3.5), and .cargo/config.toml no longer claims to override every form of the AWS-LC variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Dispatch-Task: symphony-pq-kex
kriszyp
marked this pull request as ready for review
December 4, 2026 14:21
This was referenced Dec 4, 2026
kriszyp
added a commit
that referenced
this pull request
Dec 4, 2026
After rebasing onto main (dbebbbc), regenerate Cargo.lock minimally via `cargo fetch` from the PR's previous lockfile so it matches main's Cargo.toml: adds aws-lc-rs 1.19.0 / aws-lc-sys 0.47.0 and its build dependencies, updates rustls 0.23.47 -> 0.23.48 (required by main's Cargo.toml; #102 removed ring so the 0.23.47 pin is no longer needed), and drops ring from symphony and rustls dependencies. Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-105-relock
kriszyp
added a commit
that referenced
this pull request
Dec 4, 2026
#102 added a note on CLAUDE.md:428-429 saying KX_GROUPS is pinned because the lockfile is not committed, which this PR invalidates. Reword it to reflect that a lock update can still pull in a rustls patch release with a different default list. Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-105-relock
kriszyp
added a commit
that referenced
this pull request
Dec 4, 2026
* Commit Cargo.lock and pass --locked in CI and release workflows Stop ignoring Cargo.lock and commit a lockfile pinning rustls 0.23.47 so main builds and passes clippy without the 0.23.48 deprecation warning on rustls::crypto::ring::default_provider(). Pass --locked (directly or via --cargo-flags=--locked for napi build) across CI and release workflow builds so tag releases compile the exact dependency versions CI tested. Refs #99 Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-99 * Document --locked checks and Cargo.lock version sync Align the local Rust CI check commands in CLAUDE.md and the Docker cross-compilation examples in README.md with the --locked workflow invocations, and note that Cargo.toml edits (including release version bumps) must update and commit Cargo.lock (cargo update --workspace). Refs #99 Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-99 * Enforce Cargo.lock with cargo fetch --locked before napi build @napi-rs/cli 2.18.4 invokes an unlocked `cargo metadata` before `cargo build`, which rewrites a stale Cargo.lock before `--cargo-flags=--locked` is ever checked. Run `cargo fetch --locked --target ...` before `npm run build` in CI and release workflows (and the README cross-compile examples) so a stale lockfile fails before napi build runs, and update the remaining local check and Rust version notes in CLAUDE.md and README.md. Refs #99 Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-99 * Regenerate Cargo.lock for aws-lc-rs and rustls 0.23.48 (#102) After rebasing onto main (dbebbbc), regenerate Cargo.lock minimally via `cargo fetch` from the PR's previous lockfile so it matches main's Cargo.toml: adds aws-lc-rs 1.19.0 / aws-lc-sys 0.47.0 and its build dependencies, updates rustls 0.23.47 -> 0.23.48 (required by main's Cargo.toml; #102 removed ring so the 0.23.47 pin is no longer needed), and drops ring from symphony and rustls dependencies. Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-105-relock * Update CLAUDE.md KX_GROUPS note after rebasing onto #102 #102 added a note on CLAUDE.md:428-429 saying KX_GROUPS is pinned because the lockfile is not committed, which this PR invalidates. Reword it to reflect that a lock update can still pull in a rustls patch release with a different default list. Co-Authored-By: Gemini <noreply@google.com> Dispatch-Task: symphony-105-relock --------- Co-authored-by: Gemini <noreply@google.com>
kriszyp
added a commit
that referenced
this pull request
Dec 4, 2026
Sync package + platform + crate versions to 1.9.0. TLS moves from ring to aws-lc-rs and negotiates the hybrid post-quantum X25519MLKEM768 key exchange (#102); Cargo.lock is now committed and enforced with --locked in CI and release builds (#105). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
⊙ Problem
Symphony's TLS used rustls's ring provider, which has no ML-KEM. Every session it terminated used classical key exchange, which a future quantum computer could break from recorded traffic. Current browsers and Node 22.20+ and 24.5+ already offer the hybrid post-quantum group X25519MLKEM768 first.
🤔 Is a client-ordered group list acceptable?
The task asked for X25519MLKEM768, then X25519, then P-256. rustls 0.23 cannot prefer the server's order: it takes the client's first group that is on
KX_GROUPS. Browsers and Node rank the hybrid first and get it; a client ranking X25519 first gets X25519. P-384 stays because ring offered it.💡 Solution
⚖️ Alternatives
cargo testnever installs it.🤔 Is the extra CPU on ECDSA and resumed handshakes worth it?
On macOS arm64 the hybrid costs the proxy 7.2% more CPU per full ECDSA-cert handshake and 7.5–7.8% more per resumed one. RSA handshakes got 7–9% cheaper, AES-GCM records 2–6% cheaper. Dropping the hybrid from
KX_GROUPSundoes the cost and the protection.🤔 Should mTLS accept the wider signature set?
Client certificate checks now use aws-lc-rs's default signature algorithms, adding ECDSA P-521, SHA-512 variants and ML-DSA to ring's. A cert chaining to the configured CA and signed with one of those now verifies, where ring rejected it. An explicit list on the verifier restores ring's set.
🔧 Changes
Cargo.toml— rustls 0.23.48 withaws_lc_rs, tokio-rustls likewise, and the ring dependency removed. 0.23.48 is the release built and tested here. With no committed lockfile (Commit Cargo.lock so release builds ship the dependency versions CI tested #99), each CI build resolves the newest 0.23.x anyway.src/tls.rs—KX_GROUPSand the onecrypto_provider(). Every route'sServerConfigis built with that provider, the session ticketer is aws-lc-rs's, and the config cache's SHA-256 comes fromsha2.src/mtls.rs— the client verifier is built with the same provider, so mTLS signature checks run on aws-lc-rs.src/proxy.rs— the constructor installs that provider as the process default (the first install wins), so a builder that names none cannot auto-install the stock group list.src/tarpit.rs— the hold jitter draws from the provider's RNG instead of ring's.src/proxy_conn.rs— tests use aws-lc-rs instead of ring.client_configand its test module becomepub(crate)so thetls.rstests reuse it, andsymphony_kx()offers the production groups..cargo/config.toml— forces aws-lc-sys to build AWS-LC from the crate and link it statically.forcecovers these names only; the CI linkage check catches a target-suffixed override.CI.ymlandrelease.yml— each Linux artifact fails on a libcrypto, libssl or libaws dependency, or an unprefixed OpenSSL symbol (release). The check skips AWS-LC's four weak allocator hooks (release), which a host may define and OpenSSL does not. Both macOS artifacts get the same check (release). aarch64-gnu now compiles all C with the image's cross GCC (release): aws-lc-sys picks that GCC overCC_<target>, so the clang-only flag main kept for ring's assembly broke its build (comment, release).package.json—npm run benchmark:tls.SECURITY.md— the provider, its groups and the wider mTLS algorithms, and what a FIPS build would change, including movingtls::sha256to the provider.CLAUDE.md— a provider section: why aws-lc-rs, explicit builders, membership vs ranking, the static build, its CI check and the aarch64 compiler, and the wider mTLS algorithms. The module map, ticketer note, test list andmd-5/sha2gotcha are updated.✅ Verification
src/tls.rsand the key exchange suite inproxy.spec.tsnegotiate each group, including the client's order deciding.cargo test: 279 pass (1 macOS-onlythread_cpufailure, also on main).npm test: 247 pass, 0 fail, 3 skipped, with the JA3/JA4 and resumption suites unchanged.Performance: on macOS arm64,
benchmark-tls.tsmeasured proxy CPU changes of −9% to +7% per full handshake, +7.5–7.8% per resumed one, and −5.5% to +0.9% per MiB of records. The largest increases are on hybrid handshakes. Linux is not measured (#100).Test cases and wire sizes
src/tls.rs, against configs fromTlsConfigCache: a client offering the hybrid and X25519, or the production list, gets the hybrid; classical TLS 1.2 and 1.3 clients get their group; TLS 1.2 takes the first classical group offered; the client's order decides among shared groups.__test__/proxy.spec.ts, Node clients through a real TLS-terminating proxy: hybrid only, hybrid ranked first, X25519 ranked above the hybrid, X25519 / P-256 / P-384 only, and TLS 1.2. The hybrid cases skip below OpenSSL 3.5 (opensslOffersMlKem);tlsKeyExchangereturns Node's key exchange info, which Node 22 leaves empty for the hybrid. They pass on Node 26 (OpenSSL 4.1) and, 7/7, on Node 22.23 (OpenSSL 3.5).cargo clippy --all-targetsandcargo fmt --checkare clean on macOS; CI runs them on Linux.Handshake and record-encryption benchmark, ring → aws-lc-rs
macOS arm64 (M3), Node 26.13, proxy
workerThreads: 2, 8 client processes × 6 in flight, 1,200 handshakes per handshake arm, 3 GiB each way per bulk arm. Each build ran 4 times, alternating; medians. The ring build is main with this branch's benchmark script copied in.Native addon size per target, bytes
CI artifacts, as published: main's last run (611f225) against this PR's run. The Linux ones are stripped.
Known limits left as they are
OPENSSL_,EVP_,CRYPTO_,SSL_). A regression to an unprefixed or system libcrypto would import some of them; a full allowlist of undefined symbols is not attempted.PR QA: skipped @ b0f025e — not a harper or harper-pro PR.
Framing-Verdict: chosen-approach-sound
🤖 Generated by Claude Code (Claude Opus 5.5); posted via @kriszyp.
🤖 Generated with Claude Code
Related PRs: #66 overlaps (edits its jemalloc build comment; the linkage check runs beside its artifact steps), 1 others independent
Complexity: medium
Deferred findings
cee7fa13653d8b3bminor reliability —Cargo.toml— aws-lc-rs/aws-lc-sys unpinned with Cargo.lock ignored — filed Commit Cargo.lock so release builds ship the dependency versions CI tested #99a4d3270493895762minor performance —src/tls.rs— Hybrid KEX and aws-lc-rs record cost unmeasured on Linux targets; no per-target binary sizes — filed Benchmark the aws-lc-rs TLS handshake and record cost on the Linux prebuild targets #1001d28ecea445e17d4nit correctness —src/tls.rs— KX_GROUPS omits FFDHE — filed Clients that offer only FFDHE key exchange cannot connect #101a779193efc1b757fnit performance —__test__/benchmark-tls.ts— Grace wait charges bulk teardown CPU to CPU/MiB — filed TLS benchmark's bulk-echo CPU per MiB includes connection teardown #103Origin — the dispatch brief this PR was written from
Switch Symphony's rustls crypto provider from ring to aws-lc-rs and enable the X25519MLKEM768 hybrid post-quantum key exchange for TLS connections that Symphony terminates. Today Symphony can only negotiate classical X25519/P-256 because ring has no ML-KEM, while current browsers and current Node already offer X25519MLKEM768. Key-exchange preference order: X25519MLKEM768 first, then X25519, then SECP256R1 as fallbacks. Preserve any existing per-config key-exchange-group restriction behavior. Open a draft PR.
Acceptance
Dispatch: task
symphony-pq-kex· queued by kris-session · ran by claude/opus/xhigh · worker kris-mac-m3-fleet-18b9c6Ready-For-Promotion: b0f025e urgency=normal late=folded
Review-Coverage: authored=claude; ran=cursor-composer,codex,gemini,cursor-grok; late=cursor-grok:adjudicated; adjudicated=domain; declined=muse; rounds=9; full=3 @ b0f025e
Review-Attention: read ~7m (decisions: bulk-grace-kept, linkage-gate-breadth, perf-cost) @ b0f025e