Skip to content

Commit

Permalink
Allow access to a Connection's boring::ssl::SslRef
Browse files Browse the repository at this point in the history
We would like to modify extension data in an SslRef to
support async callbacks. To do so we need access to a
Connection's `SslRef`.
  • Loading branch information
fisherdarling committed Nov 24, 2023
1 parent 098b252 commit 9b821cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7438,6 +7438,13 @@ impl Connection {
}
}

#[cfg(feature = "boringssl-boring-crate")]
impl AsMut<boring::ssl::SslRef> 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
Expand Down
7 changes: 7 additions & 0 deletions quiche/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b821cf

Please sign in to comment.