Add SslRef::curve_name()
This commit is contained in:
parent
4ce1308e1c
commit
b3521e5523
|
|
@ -2780,6 +2780,22 @@ impl SslRef {
|
||||||
Some(curve_id)
|
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`.
|
/// Returns an `ErrorCode` value for the most recent operation on this `SslRef`.
|
||||||
#[corresponds(SSL_get_error)]
|
#[corresponds(SSL_get_error)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
|
||||||
|
|
@ -958,6 +958,8 @@ fn get_curve() {
|
||||||
let client_stream = client.connect();
|
let client_stream = client.connect();
|
||||||
let curve = client_stream.ssl().curve();
|
let curve = client_stream.ssl().curve();
|
||||||
assert!(curve.is_some());
|
assert!(curve.is_some());
|
||||||
|
let curve_name = client_stream.ssl().curve_name();
|
||||||
|
assert!(curve_name.is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue