Skip to content

Commit

Permalink
add a feature to expose key share handshake data
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-gt committed Dec 2, 2024
1 parent 53e13f2 commit 9eb672a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quinn-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ log = ["tracing/log"]
# Enable rustls logging
rustls-log = ["rustls?/logging"]

# Internal (PRIVATE!) features used to aid testing.
# Don't rely on these whatsoever. They may disappear at any time.

__rustls-post-quantum-test = []

[dependencies]
arbitrary = { workspace = true, optional = true }
aws-lc-rs = { workspace = true, optional = true }
Expand Down
11 changes: 11 additions & 0 deletions quinn-proto/src/crypto/rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use bytes::BytesMut;
#[cfg(feature = "ring")]
use ring::aead;
pub use rustls::Error;
#[cfg(feature = "__rustls-post-quantum-test")]
use rustls::NamedGroup;
use rustls::{
self,
client::danger::ServerCertVerifier,
Expand Down Expand Up @@ -64,6 +66,12 @@ impl crypto::Session for TlsSession {
Connection::Client(_) => None,
Connection::Server(ref session) => session.server_name().map(|x| x.into()),
},
#[cfg(feature = "__rustls-post-quantum-test")]
negotiated_key_exchange_group: self
.inner
.negotiated_key_exchange_group()
.expect("key exchange group is negotiated")
.name(),
}))
}

Expand Down Expand Up @@ -256,6 +264,9 @@ pub struct HandshakeData {
///
/// Always `None` for outgoing connections
pub server_name: Option<String>,
/// The key exchange group negotiated with the peer
#[cfg(feature = "__rustls-post-quantum-test")]
pub negotiated_key_exchange_group: NamedGroup,
}

/// A QUIC-compatible TLS client configuration
Expand Down
5 changes: 5 additions & 0 deletions quinn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ log = ["tracing/log", "proto/log", "udp/log"]
# Enable rustls logging
rustls-log = ["rustls?/logging"]

# Internal (PRIVATE!) features used to aid testing.
# Don't rely on these whatsoever. They may disappear at any time.

__rustls-post-quantum-test = ["dep:rustls-post-quantum", "rustls-aws-lc-rs", "proto/__rustls-post-quantum-test"]

[dependencies]
async-io = { workspace = true, optional = true }
async-std = { workspace = true, optional = true }
Expand Down

0 comments on commit 9eb672a

Please sign in to comment.