Loading src/ssl/ffi.rs +11 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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; Loading src/ssl/mod.rs +6 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ fn init() { /// Determines the SSL method supported #[deriving(Show, Hash, PartialEq, Eq)] #[allow(non_camel_case_types)] pub enum SslMethod { #[cfg(sslv2)] /// Only support the SSLv2 protocol Loading @@ -58,6 +59,8 @@ pub enum SslMethod { Tlsv1, /// Support the SSLv2, SSLv3 and TLSv1 protocols Sslv23, Tlsv1_1, Tlsv1_2, } impl SslMethod { Loading @@ -67,7 +70,9 @@ impl SslMethod { Sslv2 => ffi::SSLv2_method(), Sslv3 => ffi::SSLv3_method(), Tlsv1 => ffi::TLSv1_method(), Sslv23 => ffi::SSLv23_method() Sslv23 => ffi::SSLv23_method(), Tlsv1_1 => ffi::TLSv1_1_method(), Tlsv1_2 => ffi::TLSv1_2_method() } } } Loading Loading
src/ssl/ffi.rs +11 −0 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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; Loading
src/ssl/mod.rs +6 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ fn init() { /// Determines the SSL method supported #[deriving(Show, Hash, PartialEq, Eq)] #[allow(non_camel_case_types)] pub enum SslMethod { #[cfg(sslv2)] /// Only support the SSLv2 protocol Loading @@ -58,6 +59,8 @@ pub enum SslMethod { Tlsv1, /// Support the SSLv2, SSLv3 and TLSv1 protocols Sslv23, Tlsv1_1, Tlsv1_2, } impl SslMethod { Loading @@ -67,7 +70,9 @@ impl SslMethod { Sslv2 => ffi::SSLv2_method(), Sslv3 => ffi::SSLv3_method(), Tlsv1 => ffi::TLSv1_method(), Sslv23 => ffi::SSLv23_method() Sslv23 => ffi::SSLv23_method(), Tlsv1_1 => ffi::TLSv1_1_method(), Tlsv1_2 => ffi::TLSv1_2_method() } } } Loading