aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-11-12 13:45:54 +0000
committerSteven Fackler <[email protected]>2016-11-12 13:45:54 +0000
commit96d24c89575c4d2e193f31de67e1ba273f15d6b0 (patch)
tree88de1ad141cf8f27a92f07dac6246e14616d4b03 /openssl/src
parentPick different cipher lists on 1.0.1 and 1.0.2 (diff)
downloadrust-openssl-96d24c89575c4d2e193f31de67e1ba273f15d6b0.tar.xz
rust-openssl-96d24c89575c4d2e193f31de67e1ba273f15d6b0.zip
Add SslRef::set_{tmp_dh,tmp_ecdh,ecdh_auto}
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/ssl/mod.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index bcaa4c74..2c444400 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -1083,6 +1083,10 @@ impl SslRef {
}
}
+ pub fn set_tmp_dh(&mut self, dh: &DhRef) -> Result<(), ErrorStack> {
+ unsafe { cvt(ffi::SSL_set_tmp_dh(self.as_ptr(), dh.as_ptr()) as c_int).map(|_| ()) }
+ }
+
pub fn set_tmp_dh_callback<F>(&mut self, callback: F)
where F: Fn(&mut SslRef, bool, u32) -> Result<Dh, ErrorStack> + Any + 'static + Sync + Send
{
@@ -1096,6 +1100,10 @@ impl SslRef {
}
}
+ pub fn set_tmp_ecdh(&mut self, key: &EcKeyRef) -> Result<(), ErrorStack> {
+ unsafe { cvt(ffi::SSL_set_tmp_ecdh(self.as_ptr(), key.as_ptr()) as c_int).map(|_| ()) }
+ }
+
/// Requires the `v101` feature and OpenSSL 1.0.1, or the `v102` feature and OpenSSL 1.0.2.
#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
pub fn set_tmp_ecdh_callback<F>(&mut self, callback: F)
@@ -1111,6 +1119,16 @@ impl SslRef {
}
}
+ /// If `onoff` is set to `true`, enable ECDHE for key exchange with
+ /// compatible clients, and automatically select an appropriate elliptic
+ /// curve.
+ ///
+ /// Requires the `v102` feature and OpenSSL 1.0.2.
+ #[cfg(all(feature = "v102", ossl102))]
+ pub fn set_ecdh_auto(&mut self, onoff: bool) -> Result<(), ErrorStack> {
+ unsafe { cvt(ffi::SSL_set_ecdh_auto(self.as_ptr(), onoff as c_int)).map(|_| ()) }
+ }
+
pub fn current_cipher(&self) -> Option<&SslCipherRef> {
unsafe {
let ptr = ffi::SSL_get_current_cipher(self.as_ptr());