Merge upstream rustls v0.23.40 into watfaq-rustls#10
Merged
Conversation
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.
Fixed on main in 6d09f24
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
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>
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.
Summary
Merges upstream rustls v0.23.40 into
watfaq-rustls(theutls-0.23branch), preserving all Reality/vless custom patches.Key Changes from Upstream
rustls-webpki0.103.5,webpki-roots1.x,x509-parser0.17,zeroize1.8,zlib-rs0.6,aws-lc-rs1.14,hpke-rs0.6,brotli8,hickory-resolver0.25,asn10.22ClientHelloInputrefactor: upstream moved session setup into a struct withnew()/start_handshake()methods; our fork retains the free-functionstart_handshake<T>withsession_id_generatorandreality_stategenericsClientExtensionsInput: replacesVec<ClientExtension>as the extra extensions type instart_handshakeandfor_client_with_session_id_generatorClientHelloPayloadhelpers removed:find_extension,sni_extension,psk(), etc. replaced byDeref/DerefMuttoClientExtensions(direct field access)HandshakeMessagePayloadis now a newtype: field access changed from.payloadto.0SessionIdkept public: remainspub structwithpub(crate)fields soreality.rscan construct it directlyhybrid.rsandmlkem.rsmoved fromrustls-post-quantum/src/intorustls/src/crypto/aws_lc_rs/pq/rustls-test(common test utilities),nixsignal handling in bogoClientSessionValue::retrieve(): replaces thefind_sessionfree functionEchConfig::state(): replacesEchState::newReality Patch Preservation
All custom Reality/vless code is intact:
rustls/src/client/reality.rs— unchangedstart_handshakefree function withreality_stateparameteremit_client_hello_for_retrygeneric overT: SessionIdGeneratorSessionIdpublic struct with direct field accessx25519-dalekwithstatic_secretsfeature in workspace depsBugs Fixed During Merge
support_tls13→supported_versions.tls13(field name fix)start_handshakecleaned upearly_key_schedulerenamed totls13_early_data_key_schedule(upstream rename)