diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 7632c9d52..9acf6a8a1 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -335,7 +335,7 @@ protobuf = { version = "4.36.2-release", optional = true } grpc = { path = "../grpc", optional = true } grpc-rustls = { path = "../grpc-rustls", optional = true } grpc-tokio = { path = "../grpc-tokio", optional = true } -rustls = { version = "0.23", default-features = false, features = ["ring"], optional = true} +rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"], optional = true} protobuf-well-known-types = { version = "0.36.2-release", optional = true } [build-dependencies] diff --git a/examples/src/grpc-gcp/client.rs b/examples/src/grpc-gcp/client.rs index cdff1f771..49714aa47 100644 --- a/examples/src/grpc-gcp/client.rs +++ b/examples/src/grpc-gcp/client.rs @@ -44,7 +44,7 @@ const ENDPOINT: &str = "dns:///pubsub.googleapis.com"; #[tokio::main] async fn main() -> Result<(), Box> { - _ = rustls::crypto::ring::default_provider().install_default(); + _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); let project = std::env::args() .nth(1) .ok_or_else(|| "Expected a project name as the first argument.".to_string())?; diff --git a/grpc-rustls/Cargo.toml b/grpc-rustls/Cargo.toml index 5c3b0d976..3a8a08d31 100644 --- a/grpc-rustls/Cargo.toml +++ b/grpc-rustls/Cargo.toml @@ -44,7 +44,7 @@ bytes = "1.10.1" grpc = { version = "0.10.0", path = "../grpc", features = ["__unstable"] } grpc-tokio = { path = "../grpc-tokio" } prost = "0.14.0" -rustls = { version = "0.23", default-features = false, features = ["ring"] } +rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"] } tempfile = "3.26" tokio = { version = "1.37.0", features = ["macros", "net", "rt-multi-thread", "io-util"] } tokio-stream = { version = "0.1.17", default-features = false, features = ["net"] } @@ -52,7 +52,7 @@ tonic = { version = "0.14.9", path = "../tonic", default-features = false, featu "codegen", "server", "router", - "tls-ring", + "tls-aws-lc", ] } tonic-prost = { version = "0.14.9", path = "../tonic-prost" } diff --git a/grpc-rustls/src/client/test.rs b/grpc-rustls/src/client/test.rs index 921d397c2..f64c65e0e 100644 --- a/grpc-rustls/src/client/test.rs +++ b/grpc-rustls/src/client/test.rs @@ -29,7 +29,7 @@ use std::sync::Once; use rustls::HandshakeKind; use rustls::ServerConfig; -use rustls::crypto::ring; +use rustls::crypto::aws_lc_rs; use rustls_pki_types::CertificateDer; use rustls_pki_types::PrivateKeyDer; use tempfile::NamedTempFile; @@ -72,7 +72,7 @@ async fn connect_endpoint(addr: SocketAddr) -> BoxEndpoint { fn init_provider() { INIT.call_once(|| { - let _ = ring::default_provider().install_default(); + let _ = aws_lc_rs::default_provider().install_default(); }); } @@ -401,7 +401,7 @@ async fn check_client_resumption_disabled( // Server setup: Support resumption let certs = load_certs("server.pem"); let key = load_private_key("server.key"); - let provider = ring::default_provider(); + let provider = aws_lc_rs::default_provider(); let mut server_config = ServerConfig::builder_with_provider(Arc::new(provider)) .with_protocol_versions(&versions) .expect("invalid versions") diff --git a/grpc-rustls/src/server/test.rs b/grpc-rustls/src/server/test.rs index f7069b985..8c2e87c0a 100644 --- a/grpc-rustls/src/server/test.rs +++ b/grpc-rustls/src/server/test.rs @@ -27,7 +27,7 @@ use std::sync::Arc; use std::sync::Once; use rustls::HandshakeKind; -use rustls::crypto::ring; +use rustls::crypto::aws_lc_rs; use rustls_pki_types::ServerName; use tempfile::NamedTempFile; use tokio::io::AsyncReadExt; @@ -65,7 +65,7 @@ fn endpoint_from_tcp(stream: TcpStream) -> Result, Str fn init_provider() { INIT.call_once(|| { - let _ = ring::default_provider().install_default(); + let _ = aws_lc_rs::default_provider().install_default(); }); } diff --git a/grpc-rustls/tests/tls_e2e.rs b/grpc-rustls/tests/tls_e2e.rs index 1adc3adbb..90b5a88b7 100644 --- a/grpc-rustls/tests/tls_e2e.rs +++ b/grpc-rustls/tests/tls_e2e.rs @@ -81,7 +81,7 @@ static INIT: Once = Once::new(); fn init_provider() { INIT.call_once(|| { - let _ = rustls::crypto::ring::default_provider().install_default(); + let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); }); } diff --git a/grpc-xds/Cargo.toml b/grpc-xds/Cargo.toml index 1192e63c4..fc96e128e 100644 --- a/grpc-xds/Cargo.toml +++ b/grpc-xds/Cargo.toml @@ -32,7 +32,7 @@ rand = { version = "0.10", default-features = false, features = ["thread_rng"] } [dev-dependencies] grpc = { version = "0.10.0", path = "../grpc", features = ["__internal-test-utils"] } grpc-tokio = { path = "../grpc-tokio" } -rustls = { version = "0.23", default-features = false, features = ["ring"] } +rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"] } tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time"] } xds-client = { version = "0.1.0-alpha.6", path = "../xds-client", default-features = false, features = ["test-util"] } xds-test-util = { path = "../xds-test-util" } diff --git a/grpc-xds/src/bootstrap/json.rs b/grpc-xds/src/bootstrap/json.rs index 4d62bfa1e..9953ae19b 100644 --- a/grpc-xds/src/bootstrap/json.rs +++ b/grpc-xds/src/bootstrap/json.rs @@ -301,7 +301,7 @@ mod tests { fn init_tls_provider() { static INIT: Once = Once::new(); INIT.call_once(|| { - let _ = rustls::crypto::ring::default_provider().install_default(); + let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); }); } diff --git a/interop/Cargo.toml b/interop/Cargo.toml index ceb318bcf..dfe3f5ac2 100644 --- a/interop/Cargo.toml +++ b/interop/Cargo.toml @@ -23,7 +23,7 @@ http-body-util = "0.1" prost = "0.14" tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros"]} tokio-stream = "0.1" -tonic = {path = "../tonic", features = ["tls-ring", "tls-native-roots"]} +tonic = {path = "../tonic", features = ["tls-aws-lc", "tls-native-roots"]} tonic-prost = {path = "../tonic-prost"} tower = "0.5" tracing-subscriber = {version = "0.3"} @@ -35,7 +35,7 @@ grpc-tokio = {path = "../grpc-tokio"} # to `::protobuf`. protobuf = { version = "4.36.2-release" } grpc-protobuf = {path = "../grpc-protobuf"} -rustls = { version = "0.23", default-features = false, features = ["ring"] } +rustls = { version = "0.23", default-features = false, features = ["aws_lc_rs"] } [features] protoc-gen-grpc-rust = ["dep:protoc-gen-grpc-rust", "grpc-protobuf-build/protoc-gen-grpc-rust"] diff --git a/interop/src/bin/client.rs b/interop/src/bin/client.rs index 78b921437..8087df982 100644 --- a/interop/src/bin/client.rs +++ b/interop/src/bin/client.rs @@ -176,7 +176,7 @@ async fn main() -> Result<(), Box> { Codec::Protobuf => { let target = format!("dns:///{host_port}"); let channel = if matches.use_tls { - let _ = rustls::crypto::ring::default_provider().install_default(); + let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); let creds = if use_test_ca { let root_certs = RootCertificates::from_pem(std::fs::read_to_string(ca_file)?); diff --git a/interop/src/bin/server.rs b/interop/src/bin/server.rs index b83b0cf9c..e86f62f79 100644 --- a/interop/src/bin/server.rs +++ b/interop/src/bin/server.rs @@ -134,7 +134,7 @@ async fn main() -> std::result::Result<(), Box> { .build(); let creds: Arc = if matches.use_tls { - let _ = rustls::crypto::ring::default_provider().install_default(); + let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); let cert = std::fs::read("interop/data/server1.pem")?; let key = std::fs::read("interop/data/server1.key")?; let identity = GrpcIdentity::from_pem(cert, key); diff --git a/tests/integration_tests/Cargo.toml b/tests/integration_tests/Cargo.toml index 89b7d95a3..0fced81e0 100644 --- a/tests/integration_tests/Cargo.toml +++ b/tests/integration_tests/Cargo.toml @@ -19,7 +19,7 @@ h2 = "0.4" http = "1" http-body = "1" hyper-util = "0.1" -rustls = {version = "0.23", features = ["ring"]} +rustls = {version = "0.23", features = ["aws_lc_rs"]} tokio-stream = {version = "0.1.5", features = ["net"]} tower = "0.5" tower-http = { version = "0.6", features = ["set-header", "trace"] } diff --git a/tests/integration_tests/tests/connection.rs b/tests/integration_tests/tests/connection.rs index 4ccb4295c..e91e5d498 100644 --- a/tests/integration_tests/tests/connection.rs +++ b/tests/integration_tests/tests/connection.rs @@ -56,7 +56,7 @@ async fn connect_returns_err() { #[tokio::test] async fn connect_handles_tls() { - rustls::crypto::ring::default_provider() + rustls::crypto::aws_lc_rs::default_provider() .install_default() .unwrap(); TestClient::connect("https://github.com").await.unwrap(); diff --git a/tonic-xds/src/client/xds_e2e.rs b/tonic-xds/src/client/xds_e2e.rs index fdd9596a9..eb2b05701 100644 --- a/tonic-xds/src/client/xds_e2e.rs +++ b/tonic-xds/src/client/xds_e2e.rs @@ -1529,6 +1529,7 @@ mod a65_ads_tls { return; } #[cfg(feature = "tls-ring")] + #[allow(deprecated)] let _ = rustls::crypto::ring::default_provider().install_default(); #[cfg(all(not(feature = "tls-ring"), feature = "tls-aws-lc"))] let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); diff --git a/tonic-xds/src/xds/cert_provider/mod.rs b/tonic-xds/src/xds/cert_provider/mod.rs index 9c6d3070b..544c4906f 100644 --- a/tonic-xds/src/xds/cert_provider/mod.rs +++ b/tonic-xds/src/xds/cert_provider/mod.rs @@ -51,7 +51,10 @@ pub(crate) fn default_crypto_provider() -> Arc { if let Some(p) = rustls::crypto::CryptoProvider::get_default() { return p.clone(); } + // rustls 0.23.48 deprecated the ring provider (no post-quantum key + // exchange), but `tls-ring` still selects it. #[cfg(feature = "tls-ring")] + #[allow(deprecated)] return Arc::new(rustls::crypto::ring::default_provider()); #[cfg(all(not(feature = "tls-ring"), feature = "tls-aws-lc"))] return Arc::new(rustls::crypto::aws_lc_rs::default_provider()); diff --git a/tonic-xds/src/xds/happy_eyeballs.rs b/tonic-xds/src/xds/happy_eyeballs.rs index 83b1e25fb..9959221cd 100644 --- a/tonic-xds/src/xds/happy_eyeballs.rs +++ b/tonic-xds/src/xds/happy_eyeballs.rs @@ -684,6 +684,7 @@ mod tests { // With both TLS backends compiled in (`--all-features`), rustls // cannot pick a provider on its own. #[cfg(feature = "tls-ring")] + #[allow(deprecated)] let _ = rustls::crypto::ring::default_provider().install_default(); #[cfg(all(not(feature = "tls-ring"), feature = "tls-aws-lc"))] let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); diff --git a/tonic/src/transport/channel/service/tls.rs b/tonic/src/transport/channel/service/tls.rs index 9ee4319a5..44a8294e4 100644 --- a/tonic/src/transport/channel/service/tls.rs +++ b/tonic/src/transport/channel/service/tls.rs @@ -77,7 +77,10 @@ impl TlsConnector { #[allow(unreachable_patterns)] let builder = match crypto::CryptoProvider::get_default() { Some(provider) => with_provider(provider.clone()), + // rustls 0.23.48 deprecated the ring provider (no post-quantum key + // exchange), but `tls-ring` still selects it. #[cfg(feature = "tls-ring")] + #[allow(deprecated)] None => with_provider(Arc::new(crypto::ring::default_provider())), #[cfg(feature = "tls-aws-lc")] None => with_provider(Arc::new(crypto::aws_lc_rs::default_provider())), diff --git a/tonic/src/transport/channel/tls.rs b/tonic/src/transport/channel/tls.rs index 317f2d99f..de1bfca56 100644 --- a/tonic/src/transport/channel/tls.rs +++ b/tonic/src/transport/channel/tls.rs @@ -280,6 +280,7 @@ mod tests { Ok(HandshakeSignatureValid::assertion()) } + #[allow(deprecated)] fn supported_verify_schemes(&self) -> Vec { tokio_rustls::rustls::crypto::ring::default_provider() .signature_verification_algorithms