Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/release-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ jobs:
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
# Use manylinux_2_28 for aarch64-linux to get a newer GCC.
# manylinux2014 ships GCC 4.8.5 which can't compile aws-lc-sys.
# Keep the aarch64 Linux wheel's existing glibc 2.28 baseline.
manylinux: 2_28
# The cross image sets TARGET_CC/CXX which leaks into host builds.
before-script-linux: "unset TARGET_CC TARGET_CXX"
Expand Down
8 changes: 8 additions & 0 deletions js/web-transport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,11 @@ unchanged.
## License

MIT OR Apache-2.0

## Native crypto

The native Quinn backend uses rind through rind-rustls, with an installed process-wide
rustls provider taking precedence. Endpoint keys and Retry integrity always use rind.
Native builds support x86_64, aarch64 and 32-bit ARM; constructing a client or server
returns an error if the CPU lacks a required feature. This also applies with another
TLS provider installed. The native dependency graph no longer builds ring or aws-lc-rs.
8 changes: 1 addition & 7 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ check:
cargo fmt --all --check

# requires: cargo install cargo-hack
# web-transport-ffi excluded from the feature powerset because aws-lc-rs and
# ring are mutually exclusive at link time (one rustls provider must win).
cargo hack check --feature-powerset --workspace --keep-going --exclude web-transport-node --exclude web-transport-ffi
cargo hack check --feature-powerset --workspace --keep-going --exclude web-transport-node
cargo hack check --feature-powerset --target wasm32-unknown-unknown -p web-transport --keep-going
cargo hack check --feature-powerset --target wasm32-unknown-unknown -p web-transport-wasm --keep-going

# web-transport-ffi: explicit check under each TLS provider.
cargo check -p web-transport-ffi
cargo check -p web-transport-ffi --no-default-features --features ring

# requires: cargo install cargo-shear
cargo shear

Expand Down
8 changes: 8 additions & 0 deletions kt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,11 @@ kt/
## Publishing

Publishing to Maven Central is CI-only via `.github/workflows/release-kt.yml`, which runs on every `web-transport-ffi-v*` tag. See the moq-dev org docs for Sonatype credentials.

## Native crypto

The native Quinn backend uses rind through rind-rustls, with an installed process-wide
rustls provider taking precedence. Endpoint keys and Retry integrity always use rind.
Native builds support x86_64, aarch64 and 32-bit ARM; constructing a client or server
returns an error if the CPU lacks a required feature. This also applies with another
TLS provider installed. The native dependency graph no longer builds ring or aws-lc-rs.
8 changes: 8 additions & 0 deletions py/web-transport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,11 @@ uv run pytest
## License

MIT OR Apache-2.0

## Native crypto

The native Quinn backend uses rind through rind-rustls, with an installed process-wide
rustls provider taking precedence. Endpoint keys and Retry integrity always use rind.
Native builds support x86_64, aarch64 and 32-bit ARM; constructing a client or server
returns an error if the CPU lacks a required feature. This also applies with another
TLS provider installed. The native dependency graph no longer builds ring or aws-lc-rs.
4 changes: 0 additions & 4 deletions quest/a1/native-client-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ Do not add a pretend browser certificate-verification bypass, a browser panic or
## Closes

- [#135](https://github.com/moq-dev/web-transport/issues/135) - the implementation completes this report

## Related

- [Quinn on rind](/quest/a1/rind/quinn.md) - replaces the crypto these builders configure
1 change: 0 additions & 1 deletion quest/a1/rind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ Decision prompts (✅ chosen):

## Required

- [Quinn on rind](/quest/a1/rind/quinn.md) - provider-neutral QUIC crypto adapter; Quinn, FFI, Node and router on rind
- [Noq on rind](/quest/a1/rind/noq.md) - Noq's rustls without ring, with rind keys
- [iroh on rind](/quest/a1/rind/iroh.md) - iroh endpoint built with rind's provider
2 changes: 1 addition & 1 deletion quest/a1/rind/noq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ web-transport-noq compiles no ring or aws-lc-rs: its builders run TLS on rind-ru

Per rind's MIGRATING.md, noq 1.4's `rustls` feature works without `ring`. The client and server use `QuicClientConfig::with_initial` and `QuicServerConfig::with_initial`, which are public, with rind-rustls's TLS13_AES_128_GCM_SHA256 QUIC suite as the initial. `EndpointConfig::new` takes a reset `HmacKey` on rind's HMAC, and `ServerConfig::new` a `HandshakeTokenKey` on rind's HKDF and AES-256-GCM. noq-proto's Retry tag already uses pure-Rust aes-gcm.

Replace `crypto::default_provider()` with the installed process provider, else rind. A CPU rind refuses returns an `UnsupportedCpu` error from the finishing methods, as [the Quinn child](/quest/a1/rind/quinn.md) does: `rind::cpu::check()` runs before the HMAC and token keys are built, even with an installed provider, and `Client::default()` documents its panic. Keep test-only ring in dev-dependencies only if a test needs it. Test a handshake and Retry against a ring-backed noq peer.
Replace `crypto::default_provider()` with the installed process provider, else rind. A CPU rind refuses returns an `UnsupportedCpu` error from the finishing methods, as web-transport-quinn does: `rind::cpu::check()` runs before the HMAC and token keys are built, even with an installed provider, and `Client::default()` documents its panic. Keep test-only ring in dev-dependencies only if a test needs it. Test a handshake and Retry against a ring-backed noq peer.
21 changes: 0 additions & 21 deletions quest/a1/rind/quinn.md

This file was deleted.

3 changes: 1 addition & 2 deletions quest/a2/quinn-adapter-removal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

## Goal

web-transport-quinn uses quinn's own provider-neutral `rustls` support and deletes the adapter from [Quinn on rind](/quest/a1/rind/quinn.md).
web-transport-quinn uses quinn's own provider-neutral `rustls` support and deletes the local `web_transport_quinn::crypto` adapter.

## Plan

Bump the quinn pin in web-transport-quinn and web-transport-ffi together (FFI hands its own `quinn` types to `Client::new`) to the release that closes [quinn-rs/quinn#2341](https://github.com/quinn-rs/quinn/issues/2341) and delete the ported session. Keep `web_transport_quinn::crypto`'s public types as thin re-exports or deprecate them; decide that with the maintainer at the time. Keep the interop tests and the CI guard green.

## Required

- [Quinn on rind](/quest/a1/rind/quinn.md) - the adapter this replaces
- [Quinn provider-neutral rustls release](/quest/a2/quinn-provider-release.md) - the upstream release this switches to
5 changes: 0 additions & 5 deletions rs/web-transport-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ crate-type = ["staticlib", "cdylib"]
name = "uniffi-bindgen"
path = "./uniffi-bindgen.rs"

[features]
default = ["aws-lc-rs"]
aws-lc-rs = ["quinn/rustls-aws-lc-rs", "rustls/aws-lc-rs", "web-transport-quinn/aws-lc-rs"]
ring = ["quinn/rustls-ring", "rustls/ring", "web-transport-quinn/ring"]

[dependencies]
bytes = "1"
http = "1"
Expand Down
11 changes: 11 additions & 0 deletions rs/web-transport-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ close both sockets, including pending connections. Call `close` before awaiting
```

Artifacts land in `dist/`.

## Crypto

The native Quinn backend uses rind through rind-rustls, with an installed process-wide
rustls provider taking precedence. Endpoint keys and Retry integrity always use rind.
Native builds support x86_64, aarch64 and 32-bit ARM; constructing a client or server
returns an error if the CPU lacks a required feature. This also applies with another
TLS provider installed. The native dependency graph no longer builds ring or aws-lc-rs.

The `ring` and `aws-lc-rs` Cargo features have been removed. Language API signatures
and generated bindings remain unchanged; CPU refusal is a `WebTransportError`.
51 changes: 9 additions & 42 deletions rs/web-transport-ffi/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//! WebTransport client wrapped for UniFFI.
//!
//! Mirrors `rs/web-transport-python/src/client.rs` with PyO3 replaced by
//! `#[uniffi::export]` and the `ring` crypto provider replaced by either
//! `aws-lc-rs` (default) or `ring` (feature-gated).

use std::sync::Arc;
use std::time::Duration;
Expand Down Expand Up @@ -68,7 +64,7 @@ impl Client {
));
}

let provider = Arc::new(default_crypto_provider());
let provider = default_crypto_provider()?;

let tls_builder = rustls::ClientConfig::builder_with_provider(provider.clone())
.with_protocol_versions(&[&rustls::version::TLS13])
Expand Down Expand Up @@ -136,7 +132,7 @@ impl Client {
}
}

let quic_config = quinn::crypto::rustls::QuicClientConfig::try_from(tls_config)
let quic_config = web_transport_quinn::crypto::QuicClientConfig::try_from(tls_config)
.map_err(|e| WebTransportError::invalid(format!("QUIC config: {e}")))?;
let mut client_config = quinn::ClientConfig::new(Arc::new(quic_config));
client_config.transport_config(transport.into());
Expand Down Expand Up @@ -192,22 +188,12 @@ impl Drop for Client {
}

// ---------------------------------------------------------------------------
// Crypto provider selection (matches feature gates in Cargo.toml).
// Crypto provider selection and CPU support.
// ---------------------------------------------------------------------------

fn default_crypto_provider() -> rustls::crypto::CryptoProvider {
#[cfg(feature = "aws-lc-rs")]
{
rustls::crypto::aws_lc_rs::default_provider()
}
#[cfg(all(feature = "ring", not(feature = "aws-lc-rs")))]
{
rustls::crypto::ring::default_provider()
}
#[cfg(not(any(feature = "aws-lc-rs", feature = "ring")))]
{
compile_error!("web-transport-ffi requires one of: aws-lc-rs, ring");
}
fn default_crypto_provider() -> Result<Arc<rustls::crypto::CryptoProvider>, WebTransportError> {
web_transport_quinn::crypto::default_provider()
.map_err(|e| WebTransportError::invalid(e.to_string()))
}

// ---------------------------------------------------------------------------
Expand All @@ -229,7 +215,7 @@ impl ServerCertVerifier for ServerFingerprints {
_ocsp_response: &[u8],
_now: rustls::pki_types::UnixTime,
) -> Result<rustls::client::danger::ServerCertVerified, rustls::Error> {
let cert_hash = sha256(&self.provider, end_entity)?;
let cert_hash = web_transport_quinn::crypto::sha256(&self.provider, end_entity)?;
if self.fingerprints.iter().any(|fp| fp == cert_hash.as_ref()) {
return Ok(rustls::client::danger::ServerCertVerified::assertion());
}
Expand Down Expand Up @@ -321,25 +307,6 @@ impl ServerCertVerifier for NoCertificateVerification {
}
}

fn sha256(
provider: &Arc<rustls::crypto::CryptoProvider>,
cert: &CertificateDer<'_>,
) -> Result<rustls::crypto::hash::Output, rustls::Error> {
let hash_provider = provider
.cipher_suites
.iter()
.find_map(|suite| {
let hp = suite.tls13()?.common.hash_provider;
if hp.algorithm() == rustls::crypto::hash::HashAlgorithm::SHA256 {
Some(hp)
} else {
None
}
})
.ok_or_else(|| rustls::Error::General("crypto provider missing SHA-256".into()))?;
Ok(hash_provider.hash(cert))
}

// ---------------------------------------------------------------------------
// Helper used by server.rs for TLS configuration.
// ---------------------------------------------------------------------------
Expand All @@ -355,8 +322,8 @@ pub(crate) fn build_server_tls(
let key = rustls::pki_types::PrivateKeyDer::try_from(private_key)
.map_err(|e| WebTransportError::invalid(format!("invalid private key: {e}")))?;

let provider = default_crypto_provider();
let mut tls = rustls::ServerConfig::builder_with_provider(Arc::new(provider))
let provider = default_crypto_provider()?;
let mut tls = rustls::ServerConfig::builder_with_provider(provider)
.with_protocol_versions(&[&rustls::version::TLS13])
.map_err(|e| WebTransportError::invalid(format!("TLS config: {e}")))?
.with_no_client_auth()
Expand Down
4 changes: 3 additions & 1 deletion rs/web-transport-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ pub fn map_server_error(err: web_transport_quinn::ServerError) -> WebTransportEr
| web_transport_quinn::ServerError::SettingsError(_)
| web_transport_quinn::ServerError::ConnectError(_)
| web_transport_quinn::ServerError::IoError(_)
| web_transport_quinn::ServerError::Rustls(_) => {
| web_transport_quinn::ServerError::Rustls(_)
| web_transport_quinn::ServerError::Crypto(_)
| web_transport_quinn::ServerError::UnsupportedCpu(_) => {
WebTransportError::protocol(err.to_string())
}
}
Expand Down
21 changes: 16 additions & 5 deletions rs/web-transport-ffi/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,24 @@ impl Server {
}
let transport_config = Arc::new(transport);

let quic = quinn::crypto::rustls::QuicServerConfig::try_from(tls)
let quic = web_transport_quinn::crypto::QuicServerConfig::try_from(tls)
.map_err(|e| WebTransportError::invalid(format!("QUIC config: {e}")))?;
let mut server_config = quinn::ServerConfig::with_crypto(Arc::new(quic));
let mut server_config = web_transport_quinn::crypto::server_config(Arc::new(quic))
.map_err(|e| WebTransportError::invalid(e.to_string()))?;
server_config.transport_config(transport_config.clone());

let _guard = RUNTIME.enter();
let endpoint = quinn::Endpoint::server(server_config, addr)
let endpoint_config = web_transport_quinn::crypto::endpoint_config()
.map_err(|e| WebTransportError::invalid(e.to_string()))?;
let socket = std::net::UdpSocket::bind(addr)
.map_err(|e| WebTransportError::Io(format!("failed to bind: {e}")))?;
let endpoint = quinn::Endpoint::new(
endpoint_config,
Some(server_config),
socket,
Arc::new(quinn::TokioRuntime),
)
.map_err(|e| WebTransportError::Io(format!("failed to bind: {e}")))?;

let local_addr = endpoint
.local_addr()
Expand Down Expand Up @@ -153,9 +163,10 @@ impl Server {
private_key: Vec<u8>,
) -> Result<(), WebTransportError> {
let tls = build_server_tls(certificate_chain, private_key)?;
let quic = quinn::crypto::rustls::QuicServerConfig::try_from(tls)
let quic = web_transport_quinn::crypto::QuicServerConfig::try_from(tls)
.map_err(|e| WebTransportError::invalid(format!("QUIC config: {e}")))?;
let mut server_config = quinn::ServerConfig::with_crypto(Arc::new(quic));
let mut server_config = web_transport_quinn::crypto::server_config(Arc::new(quic))
.map_err(|e| WebTransportError::invalid(e.to_string()))?;
server_config.transport_config(self.transport_config.clone());
self.endpoint.set_server_config(Some(server_config));
Ok(())
Expand Down
2 changes: 0 additions & 2 deletions rs/web-transport-ffi/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ fn client_config_for(cert_hash: Vec<u8>) -> ClientConfig {

#[tokio::test]
async fn echo_datagram() {
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();

let (chain, key) = self_signed_cert();
let cert_hash = sha256(&chain[0]);

Expand Down
18 changes: 4 additions & 14 deletions rs/web-transport-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,23 +272,13 @@ mod server_tests {
}

fn bind() -> NapiServer {
// Workspace all-features tests enable both TLS backends; choose one for this process.
static PROVIDER: std::sync::Once = std::sync::Once::new();
PROVIDER.call_once(|| {
web_transport_quinn::quinn::rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.expect("install test TLS provider");
});
let cert = rcgen::generate_simple_self_signed(vec!["localhost".into()]).unwrap();
let key = rustls_pemfile::private_key(&mut cert.signing_key.serialize_pem().as_bytes())
.unwrap()
.unwrap();
let server = web_transport_quinn::ServerBuilder::new()
.with_addr("127.0.0.1:0".parse().unwrap())
.with_certificate(
vec![cert.cert.der().clone()],
web_transport_quinn::quinn::rustls::pki_types::PrivatePkcs8KeyDer::from(
cert.signing_key.serialize_der(),
)
.into(),
)
.with_certificate(vec![cert.cert.der().clone()], key)
.unwrap();
NapiServer {
inner: Arc::new(ServerState {
Expand Down
8 changes: 5 additions & 3 deletions rs/web-transport-quinn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ categories = ["network-programming", "web-programming"]
all-features = true

[features]
default = ["aws-lc-rs"]
aws-lc-rs = ["quinn/rustls-aws-lc-rs", "rustls/aws-lc-rs"]
ring = ["quinn/rustls-ring", "rustls/ring"]
# Unlocks `quinn::TransportConfig::qlog_stream` and `quinn::QlogConfig`, which this
# crate re-exports but cannot enable on a caller's behalf.
qlog = ["quinn/qlog"]
Expand All @@ -34,6 +31,10 @@ quinn = { version = "0.11", default-features = false, features = [
"bloom",
] }

quinn-proto = { version = "0.11.19", default-features = false }
rind = "0.2.1"
rind-rustls = "0.23"

rustls = { version = "0.23", default-features = false, features = [
"logging",
"std",
Expand All @@ -54,6 +55,7 @@ web-transport-trait = { workspace = true }
[dev-dependencies]
anyhow = "1"
clap = { version = "4", features = ["derive"] }
quinn = { version = "0.11", default-features = false, features = ["rustls-aws-lc-rs"] }
rcgen = "0.14"
rustls-pemfile = "2"
tokio = { version = "1", features = ["full"] }
Expand Down
Loading
Loading