Skip to content

Commit

Permalink
Expose SSL_get_error
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Jan 8, 2024
1 parent 7a7de40 commit 5ec1062
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions boring/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2505,10 +2505,6 @@ impl SslRef {
unsafe { ffi::SSL_write(self.as_ptr(), buf.as_ptr() as *const c_void, len) }
}

fn get_error(&self, ret: c_int) -> ErrorCode {
unsafe { ErrorCode::from_raw(ffi::SSL_get_error(self.as_ptr(), ret)) }
}

#[cfg(feature = "kx-safe-default")]
fn set_curves_list(&mut self, curves: &str) -> Result<(), ErrorStack> {
let curves = CString::new(curves).unwrap();
Expand Down Expand Up @@ -2553,6 +2549,15 @@ impl SslRef {
.expect("invalid default server curves list");
}

/// Expose the underlying `Error` that interrupted the TLS handshake.
///
/// This corresponds to [`SSL_get_error`].
///
/// [`SSL_get_error`]: https://github.com/google/boringssl/blob/master/include/openssl/ssl.h#L475
pub fn get_error(&self, ret: c_int) -> ErrorCode {
unsafe { ErrorCode::from_raw(ffi::SSL_get_error(self.as_ptr(), ret)) }
}

/// Like [`SslContextBuilder::set_verify`].
///
/// This corresponds to [`SSL_set_verify`].
Expand Down

0 comments on commit 5ec1062

Please sign in to comment.