Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions boring/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,22 @@ impl SslRef {
Some(curve_id)
}

/// Returns the curve name used for this `SslRef`.
#[corresponds(SSL_get_curve_name)]
#[must_use]
pub fn curve_name(&self) -> Option<&'static str> {
let curve_id = self.curve()?;

unsafe {
let ptr = ffi::SSL_get_curve_name(curve_id);
if ptr.is_null() {
return None;
}

CStr::from_ptr(ptr).to_str().ok()
}
}

/// Returns an `ErrorCode` value for the most recent operation on this `SslRef`.
#[corresponds(SSL_get_error)]
#[must_use]
Expand Down
2 changes: 2 additions & 0 deletions boring/src/ssl/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ fn get_curve() {
let client_stream = client.connect();
let curve = client_stream.ssl().curve();
assert!(curve.is_some());
let curve_name = client_stream.ssl().curve_name();
assert!(curve_name.is_some());
}

#[test]
Expand Down
Loading