diff --git a/quiche/src/lib.rs b/quiche/src/lib.rs index 5ed2723de2..cf0693f43b 100644 --- a/quiche/src/lib.rs +++ b/quiche/src/lib.rs @@ -7438,6 +7438,13 @@ impl Connection { } } +#[cfg(feature = "boringssl-boring-crate")] +impl AsMut for Connection { + fn as_mut(&mut self) -> &mut boring::ssl::SslRef { + self.handshake.ssl_mut() + } +} + /// Maps an `Error` to `Error::Done`, or itself. /// /// When a received packet that hasn't yet been authenticated triggers a failure diff --git a/quiche/src/tls.rs b/quiche/src/tls.rs index 04bda715ea..2325dfcc80 100644 --- a/quiche/src/tls.rs +++ b/quiche/src/tls.rs @@ -898,6 +898,13 @@ impl Handshake { } } } + + #[cfg(feature = "boringssl-boring-crate")] + pub(crate) fn ssl_mut(&mut self) -> &mut boring::ssl::SslRef { + use foreign_types_shared::ForeignTypeRef; + + unsafe { boring::ssl::SslRef::from_ptr_mut(self.as_mut_ptr() as _ ) } + } } // NOTE: These traits are not automatically implemented for Handshake due to the