Skip to content

Commit 1f7ad23

Browse files
committed
proto: upgrade to rustls-platform-verifier 0.6
1 parent 113fa61 commit 1f7ad23

7 files changed

Lines changed: 40 additions & 12 deletions

File tree

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ring = "0.17"
3939
rustc-hash = "2"
4040
rustls = { version = "0.23.5", default-features = false, features = ["std"] }
4141
rustls-pemfile = "2"
42-
rustls-platform-verifier = "0.5"
42+
rustls-platform-verifier = "0.6"
4343
rustls-pki-types = "1.7"
4444
serde = { version = "1.0", features = ["derive"] }
4545
serde_json = "1"

deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ allow = [
33
"Apache-2.0",
44
"BSD-2-Clause",
55
"BSD-3-Clause",
6+
"CDLA-Permissive-2.0",
67
"ISC",
78
"MIT",
8-
"MPL-2.0",
99
"NCSA",
1010
"OpenSSL",
1111
"Unicode-3.0",

docs/book/src/bin/certificate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
let (self_signed_certs, self_signed_key) = generate_self_signed_cert().unwrap();
1919
let (certs, key) = read_certs_from_file().unwrap();
2020
let server_config = quinn::ServerConfig::with_single_cert(certs, key);
21-
let client_config = quinn::ClientConfig::with_platform_verifier();
21+
let client_config = quinn::ClientConfig::try_with_platform_verifier().unwrap();
2222
}
2323

2424
#[allow(dead_code)] // Included in `certificate.md`

quinn-proto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quinn-proto"
3-
version = "0.11.12"
3+
version = "0.11.13"
44
edition.workspace = true
55
rust-version.workspace = true
66
license.workspace = true

quinn-proto/src/config/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,18 @@ impl ClientConfig {
615615
#[cfg(any(feature = "rustls-aws-lc-rs", feature = "rustls-ring"))]
616616
impl ClientConfig {
617617
/// Create a client configuration that trusts the platform's native roots
618+
#[deprecated(since = "0.11.13", note = "use `try_with_platform_verifier()` instead")]
618619
#[cfg(feature = "platform-verifier")]
619620
pub fn with_platform_verifier() -> Self {
620-
Self::new(Arc::new(crypto::rustls::QuicClientConfig::new(Arc::new(
621-
rustls_platform_verifier::Verifier::new(),
622-
))))
621+
Self::try_with_platform_verifier().expect("use try_with_platform_verifier() instead")
622+
}
623+
624+
/// Create a client configuration that trusts the platform's native roots
625+
#[cfg(feature = "platform-verifier")]
626+
pub fn try_with_platform_verifier() -> Result<Self, rustls::Error> {
627+
Ok(Self::new(Arc::new(
628+
crypto::rustls::QuicClientConfig::with_platform_verifier()?,
629+
)))
623630
}
624631

625632
/// Create a client configuration that trusts specified trust anchors

quinn-proto/src/crypto/rustls.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use rustls::{
1212
pki_types::{CertificateDer, PrivateKeyDer, ServerName},
1313
quic::{Connection, HeaderProtectionKey, KeyChange, PacketKey, Secrets, Suite, Version},
1414
};
15+
#[cfg(feature = "platform-verifier")]
16+
use rustls_platform_verifier::BuilderVerifierExt;
1517

1618
use crate::{
1719
ConnectError, ConnectionId, Side, TransportError, TransportErrorCode,
@@ -281,6 +283,24 @@ pub struct QuicClientConfig {
281283
}
282284

283285
impl QuicClientConfig {
286+
#[cfg(feature = "platform-verifier")]
287+
pub(crate) fn with_platform_verifier() -> Result<Self, Error> {
288+
// Keep in sync with `inner()` below
289+
let mut inner = rustls::ClientConfig::builder_with_provider(configured_provider())
290+
.with_protocol_versions(&[&rustls::version::TLS13])
291+
.unwrap() // The default providers support TLS 1.3
292+
.with_platform_verifier()?
293+
.with_no_client_auth();
294+
295+
inner.enable_early_data = true;
296+
Ok(Self {
297+
// We're confident that the *ring* default provider contains TLS13_AES_128_GCM_SHA256
298+
initial: initial_suite_from_provider(inner.crypto_provider())
299+
.expect("no initial cipher suite found"),
300+
inner: Arc::new(inner),
301+
})
302+
}
303+
284304
/// Initialize a sane QUIC-compatible TLS client configuration
285305
///
286306
/// QUIC requires that TLS 1.3 be enabled. Advanced users can use any [`rustls::ClientConfig`] that
@@ -309,6 +329,7 @@ impl QuicClientConfig {
309329
}
310330

311331
pub(crate) fn inner(verifier: Arc<dyn ServerCertVerifier>) -> rustls::ClientConfig {
332+
// Keep in sync with `with_platform_verifier()` above
312333
let mut config = rustls::ClientConfig::builder_with_provider(configured_provider())
313334
.with_protocol_versions(&[&rustls::version::TLS13])
314335
.unwrap() // The default providers support TLS 1.3

0 commit comments

Comments
 (0)