From 03871d368e1fdffd74ffad57197d55c4d59bd77b Mon Sep 17 00:00:00 2001 From: Valerii Hiora Date: Fri, 12 Sep 2014 20:37:23 +0300 Subject: Enabling TLS1.2 support Unfortunately OS X comes with 0.9.8 bundled. There is a way to install a recent version through homebrew, however it is extremely hard to make it link agains brewed version without tricking link version --- src/ssl/ffi.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ssl/ffi.rs') diff --git a/src/ssl/ffi.rs b/src/ssl/ffi.rs index 2e21a24b..d284353a 100755 --- a/src/ssl/ffi.rs +++ b/src/ssl/ffi.rs @@ -103,8 +103,17 @@ pub static X509_FILETYPE_PEM: c_int = 1; pub static X509_FILETYPE_ASN1: c_int = 2; pub static X509_FILETYPE_DEFAULT: c_int = 3; +#[cfg(target_os = "macos")] +#[link(name="ssl.1.0.0")] +#[link(name="crypto.1.0.0")] +extern {} + + +#[cfg(not(target_os = "macos"))] #[link(name="ssl")] #[link(name="crypto")] +extern {} + extern "C" { pub fn CRYPTO_num_locks() -> c_int; pub fn CRYPTO_set_locking_callback(func: extern "C" fn(mode: c_int, @@ -120,6 +129,8 @@ extern "C" { pub fn SSLv2_method() -> *const SSL_METHOD; pub fn SSLv3_method() -> *const SSL_METHOD; pub fn TLSv1_method() -> *const SSL_METHOD; + pub fn TLSv1_1_method() -> *const SSL_METHOD; + pub fn TLSv1_2_method() -> *const SSL_METHOD; pub fn SSLv23_method() -> *const SSL_METHOD; pub fn SSL_CTX_new(method: *const SSL_METHOD) -> *mut SSL_CTX; -- cgit v1.2.3 From 4c1edcf4c8aa00ec3bb8ff0c0e8627a91a36792f Mon Sep 17 00:00:00 2001 From: Valerii Hiora Date: Tue, 23 Sep 2014 18:13:48 +0300 Subject: TLS 1_1, 1_2, Ssl 2 is enabled by features --- src/ssl/ffi.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ssl/ffi.rs') diff --git a/src/ssl/ffi.rs b/src/ssl/ffi.rs index d284353a..a40af35e 100755 --- a/src/ssl/ffi.rs +++ b/src/ssl/ffi.rs @@ -103,13 +103,14 @@ pub static X509_FILETYPE_PEM: c_int = 1; pub static X509_FILETYPE_ASN1: c_int = 2; pub static X509_FILETYPE_DEFAULT: c_int = 3; -#[cfg(target_os = "macos")] +#[cfg(target_os = "macos", feature = "tlsv1_1")] +#[cfg(target_os = "macos", feature = "tlsv1_2")] #[link(name="ssl.1.0.0")] #[link(name="crypto.1.0.0")] extern {} - #[cfg(not(target_os = "macos"))] +#[cfg(target_os = "macos", not(feature = "tlsv1_1"), not(feature = "tlsv1_2"))] #[link(name="ssl")] #[link(name="crypto")] extern {} @@ -125,11 +126,13 @@ extern "C" { pub fn SSL_library_init() -> c_int; - #[cfg(sslv2)] + #[cfg(feature = "sslv2")] pub fn SSLv2_method() -> *const SSL_METHOD; pub fn SSLv3_method() -> *const SSL_METHOD; pub fn TLSv1_method() -> *const SSL_METHOD; + #[cfg(feature = "tlsv1_1")] pub fn TLSv1_1_method() -> *const SSL_METHOD; + #[cfg(feature = "tlsv1_2")] pub fn TLSv1_2_method() -> *const SSL_METHOD; pub fn SSLv23_method() -> *const SSL_METHOD; -- cgit v1.2.3