aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ssl/ffi.rs9
-rw-r--r--src/ssl/mod.rs8
2 files changed, 12 insertions, 5 deletions
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;
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs
index f0961ce9..fc775a32 100644
--- a/src/ssl/mod.rs
+++ b/src/ssl/mod.rs
@@ -50,7 +50,7 @@ fn init() {
#[deriving(Show, Hash, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum SslMethod {
- #[cfg(sslv2)]
+ #[cfg(feature = "sslv2")]
/// Only support the SSLv2 protocol
Sslv2,
/// Only support the SSLv3 protocol
@@ -59,19 +59,23 @@ pub enum SslMethod {
Tlsv1,
/// Support the SSLv2, SSLv3 and TLSv1 protocols
Sslv23,
+ #[cfg(feature = "tlsv1_1")]
Tlsv1_1,
+ #[cfg(feature = "tlsv1_2")]
Tlsv1_2,
}
impl SslMethod {
unsafe fn to_raw(&self) -> *const ffi::SSL_METHOD {
match *self {
- #[cfg(sslv2)]
+ #[cfg(feature = "sslv2")]
Sslv2 => ffi::SSLv2_method(),
Sslv3 => ffi::SSLv3_method(),
Tlsv1 => ffi::TLSv1_method(),
Sslv23 => ffi::SSLv23_method(),
+ #[cfg(feature = "tlsv1_1")]
Tlsv1_1 => ffi::TLSv1_1_method(),
+ #[cfg(feature = "tlsv1_2")]
Tlsv1_2 => ffi::TLSv1_2_method()
}
}