Skip to content

Merge upstream rustls v0.23.40 into watfaq-rustls#10

Merged
ibigbug merged 404 commits into
utls-0.23from
merge-latest-0.23
May 11, 2026
Merged

Merge upstream rustls v0.23.40 into watfaq-rustls#10
ibigbug merged 404 commits into
utls-0.23from
merge-latest-0.23

Conversation

@ibigbug
Copy link
Copy Markdown
Member

@ibigbug ibigbug commented May 11, 2026

Summary

Merges upstream rustls v0.23.40 into watfaq-rustls (the utls-0.23 branch), preserving all Reality/vless custom patches.

Key Changes from Upstream

  • Dependency bumps: rustls-webpki 0.103.5, webpki-roots 1.x, x509-parser 0.17, zeroize 1.8, zlib-rs 0.6, aws-lc-rs 1.14, hpke-rs 0.6, brotli 8, hickory-resolver 0.25, asn1 0.22
  • ClientHelloInput refactor: upstream moved session setup into a struct with new()/start_handshake() methods; our fork retains the free-function start_handshake<T> with session_id_generator and reality_state generics
  • ClientExtensionsInput: replaces Vec<ClientExtension> as the extra extensions type in start_handshake and for_client_with_session_id_generator
  • ClientHelloPayload helpers removed: find_extension, sni_extension, psk(), etc. replaced by Deref/DerefMut to ClientExtensions (direct field access)
  • HandshakeMessagePayload is now a newtype: field access changed from .payload to .0
  • SessionId kept public: remains pub struct with pub(crate) fields so reality.rs can construct it directly
  • PQ crypto moved: hybrid.rs and mlkem.rs moved from rustls-post-quantum/src/ into rustls/src/crypto/aws_lc_rs/pq/
  • New crates: rustls-test (common test utilities), nix signal handling in bogo
  • ClientSessionValue::retrieve(): replaces the find_session free function
  • EchConfig::state(): replaces EchState::new

Reality Patch Preservation

All custom Reality/vless code is intact:

  • rustls/src/client/reality.rs — unchanged
  • start_handshake free function with reality_state parameter
  • emit_client_hello_for_retry generic over T: SessionIdGenerator
  • SessionId public struct with direct field access
  • x25519-dalek with static_secrets feature in workspace deps

Bugs Fixed During Merge

  • support_tls13supported_versions.tls13 (field name fix)
  • Duplicate session_id assignment in start_handshake cleaned up
  • early_key_schedule renamed to tls13_early_data_key_schedule (upstream rename)

ctz and others added 30 commits April 18, 2025 09:54
This is a minor refactor of the existing emptiness check.  It does
not change the underlying type of tickets as this is shared with
TLS1.2.
For rustls#2424

Signed-off-by: Eric Lagergren <elagergren@spideroak.com>
For rustls#2424

Signed-off-by: Eric Lagergren <elagergren@spideroak.com>
Signed-off-by: Eric Lagergren <elagergren@spideroak.com>
Co-authored-by: CodeMan62 <sharmahimanshu15082007@gmail.com>
Now a given decoded `ProtocolName` cannot be empty, there is no need
to check that manually.
Retire `Vec<ServerName>`, as in practice there can never be more
than one value: unknown name types (and everything that follows them)
cannot be decoded, and only one value of each name type is allowed.

Eliminates `ServerName` type which was confusingly overlapping
with `rustls-pki-types::ServerName`.
For kTLS we want to be able to interact with rustls in order to refresh
traffic keys and save session tickets for future usage. The remaining
parts of the TLS protocol are possible to implement externally provided
that the user is willing to put in enough effort.

This commit introduces a new API that provides exactly 3 capabilities to
the user:
1. Refresh the TX traffic secrets.
2. Refresh the RX traffic secrets.
3. Handle a provided new_session_ticket message and save said session
   ticket for later use.

That's it. Everything else needs to be implemented by the library user.
While dangerous_extract_secrets allows users to extract secrets from a
connection there is more to implementing a TLS connection than just
encryption and decryption. Just getting the ExtractedSecrets does not
allow for handling TLS 1.3 key updates or session tickets. As such, this
commit deprecates it in favour of dangerous_into_kernel_connection,
which does support both of those things.
DarkmatterVale and others added 22 commits February 24, 2026 16:53
Previously, require_ems was defaulted solely based on cfg!(feature = "fips"),
which is a compile-time check tied to the fips cargo feature. The fips feature
unconditionally pulls in aws-lc-rs as the cryptographic provider, making it
impossible for third-party FIPS-compliant CryptoProvider implementations
(e.g., those backed by BoringSSL) to get correct FIPS policy defaults without
also pulling in aws-lc-rs — which may conflict with their own crypto backend.

This change also considers the runtime CryptoProvider::fips() status when
defaulting require_ems in both ClientConfig and ServerConfig builders. If the
configured provider reports itself as FIPS-compliant, require_ems is now
automatically set to true, ensuring that ClientConfig::fips() and
ServerConfig::fips() return the correct result without requiring the fips
cargo feature.

This is backward-compatible: existing users of the fips feature see no
behavior change, while third-party providers now work correctly out of the
box.
In the case where SNI is disabled, `inner_sni` falls out of sync with
`self.inner_name`.  `inner_sni` is used to alter the inner hello's
`server_name`, but `self.inner_name` was used as a basis for padding.

This means padding would be added even if the extension wasn't, which
ironically leaks the length of the inner name.
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	bogo/Cargo.toml
#	bogo/src/main.rs
#	ci-bench/Cargo.toml
#	ci-bench/src/benchmark.rs
#	ci-bench/src/main.rs
#	ci-bench/src/util.rs
#	connect-tests/Cargo.toml
#	examples/Cargo.toml
#	examples/src/bin/ech-client.rs
#	examples/src/bin/limitedclient.rs
#	examples/src/bin/server_acceptor.rs
#	examples/src/bin/simple_0rtt_client.rs
#	examples/src/bin/simpleserver.rs
#	examples/src/bin/tlsclient-mio.rs
#	examples/src/bin/tlsserver-mio.rs
#	examples/src/bin/unbuffered-async-client.rs
#	examples/src/bin/unbuffered-server.rs
#	fuzz/Cargo.toml
#	openssl-tests/src/ffdhe.rs
#	openssl-tests/src/ffdhe_kx_with_openssl.rs
#	openssl-tests/src/raw_key_openssl_interop.rs
#	openssl-tests/src/validate_ffdhe_params.rs
#	provider-example/examples/server.rs
#	provider-example/src/aead.rs
#	provider-example/src/kx.rs
#	provider-example/src/verify.rs
#	rustls-bench/Cargo.toml
#	rustls-bench/src/main.rs
#	rustls-fuzzing-provider/Cargo.toml
#	rustls-fuzzing-provider/src/lib.rs
#	rustls-post-quantum/Cargo.toml
#	rustls-post-quantum/README.md
#	rustls-post-quantum/benches/benchmarks.rs
#	rustls-post-quantum/src/lib.rs
#	rustls/Cargo.toml
#	rustls/benches/benchmarks.rs
#	rustls/build.rs
#	rustls/src/client/client_conn.rs
#	rustls/src/client/hs.rs
#	rustls/src/crypto/aws_lc_rs/pq/hybrid.rs
#	rustls/src/crypto/aws_lc_rs/pq/mlkem.rs
#	rustls/src/lib.rs
#	rustls/src/msgs/handshake.rs
#	rustls/src/quic.rs
#	rustls/src/server/server_conn.rs
#	rustls/tests/api.rs
#	rustls/tests/api_ffdhe.rs
#	rustls/tests/client_cert_verifier.rs
#	rustls/tests/common/mod.rs
#	rustls/tests/key_log_file_env.rs
#	rustls/tests/process_provider.rs
#	rustls/tests/server_cert_verifier.rs
#	rustls/tests/unbuffered.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@ibigbug ibigbug changed the title Merge latest 0.23 Merge upstream rustls v0.23.40 into watfaq-rustls May 11, 2026
Reality computes a cryptographic session_id (encrypted auth data tied to
the server's public key). If a session_id_generator was also provided,
it would overwrite Reality's value, silently breaking the handshake.

Guard the session_id_generator block to only run when Reality is not
active, and add a test that verifies Reality's session_id is preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ibigbug ibigbug merged commit 0828f67 into utls-0.23 May 11, 2026
1 check passed
@ibigbug ibigbug deleted the merge-latest-0.23 branch May 11, 2026 14:01
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.