aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-08-04 22:52:40 -0700
committerSteven Fackler <[email protected]>2016-08-04 22:52:40 -0700
commitc47be8b14b43afff4b99c771688accb3e47982ff (patch)
tree34e3c5e7197e7bf7861e13febf151899569c952e
parentMvoe SSL_CTX_add_extra_chain_cert to -sys (diff)
downloadrust-openssl-c47be8b14b43afff4b99c771688accb3e47982ff.tar.xz
rust-openssl-c47be8b14b43afff4b99c771688accb3e47982ff.zip
Move SSL_CTX_set_ecdh_auto to -sys
-rw-r--r--openssl-sys/Cargo.toml1
-rw-r--r--openssl-sys/src/lib.rs14
-rw-r--r--openssl/Cargo.toml2
-rw-r--r--openssl/src/ssl/mod.rs2
4 files changed, 13 insertions, 6 deletions
diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml
index c203b6d6..45424bbf 100644
--- a/openssl-sys/Cargo.toml
+++ b/openssl-sys/Cargo.toml
@@ -23,6 +23,7 @@ npn = []
alpn = []
rfc5114 = []
pkcs5_pbkdf2_hmac = []
+ecdh_auto = []
[dependencies]
libc = "0.2"
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index f13a3dd5..250bb054 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -294,15 +294,16 @@ pub const NID_key_usage: c_int = 83;
pub const PKCS5_SALT_LEN: c_int = 8;
pub const SSL_CTRL_SET_TMP_DH: c_int = 3;
+pub const SSL_CTRL_EXTRA_CHAIN_CERT: c_int = 14;
pub const SSL_CTRL_OPTIONS: c_int = 32;
pub const SSL_CTRL_MODE: c_int = 33;
-pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
-
+pub const SSL_CTRL_SET_READ_AHEAD: c_int = 41;
pub const SSL_CTRL_SET_TLSEXT_SERVERNAME_CB: c_int = 53;
pub const SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG: c_int = 54;
pub const SSL_CTRL_SET_TLSEXT_HOSTNAME: c_int = 55;
-pub const SSL_CTRL_EXTRA_CHAIN_CERT: c_int = 14;
-pub const SSL_CTRL_SET_READ_AHEAD: c_int = 41;
+pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
+#[cfg(feature = "ecdh_auto")]
+pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
pub const SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER: c_long = 2;
pub const SSL_MODE_AUTO_RETRY: c_long = 4;
@@ -544,6 +545,11 @@ pub unsafe fn SSL_CTX_add_extra_chain_cert(ctx: *mut SSL_CTX, x509: *mut X509) -
SSL_CTX_ctrl(ctx, SSL_CTRL_EXTRA_CHAIN_CERT, 0, x509 as *mut c_void)
}
+#[cfg(feature = "ecdh_auto")]
+pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_long) -> c_long {
+ SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff, ptr::null_mut())
+}
+
pub unsafe fn SSL_CTX_set_tlsext_servername_callback(ctx: *mut SSL_CTX,
cb: Option<extern "C" fn()>)
-> c_long {
diff --git a/openssl/Cargo.toml b/openssl/Cargo.toml
index 3d4b098c..4f7243b9 100644
--- a/openssl/Cargo.toml
+++ b/openssl/Cargo.toml
@@ -23,7 +23,7 @@ aes_ctr = ["openssl-sys/aes_ctr"]
npn = ["openssl-sys/npn"]
alpn = ["openssl-sys/alpn"]
rfc5114 = ["openssl-sys/rfc5114"]
-ecdh_auto = ["openssl-sys-extras/ecdh_auto"]
+ecdh_auto = ["openssl-sys/ecdh_auto"]
pkcs5_pbkdf2_hmac = ["openssl-sys/pkcs5_pbkdf2_hmac"]
[dependencies]
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 48e9f1c8..8cfc209a 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -625,7 +625,7 @@ impl SslContext {
/// This method requires OpenSSL >= 1.0.2 or LibreSSL and the `ecdh_auto` feature.
#[cfg(feature = "ecdh_auto")]
pub fn set_ecdh_auto(&mut self, onoff: bool) -> Result<(), ErrorStack> {
- wrap_ssl_result(unsafe { ::ffi_extras::SSL_CTX_set_ecdh_auto(self.ctx, onoff as c_int) })
+ wrap_ssl_result(unsafe { ffi::SSL_CTX_set_ecdh_auto(self.ctx, onoff as c_long) as c_int })
}
pub fn set_options(&mut self, option: SslContextOptions) -> SslContextOptions {