From f32940294d3addf3780e12782135115874bd7649 Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Sat, 8 Nov 2014 23:15:19 -0600 Subject: [PATCH 1/3] Add overrideable platform ssl. --- Cargo.toml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4c61dd7e..28300444 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,24 @@ path = "src/lib.rs" tlsv1_2 = [] tlsv1_1 = [] sslv2 = [] + +[target.i686-apple-darwin.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.x86_64-apple-darwin.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.i686-unknown-linux-gnu.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.x86_64-unknown-linux-gnu.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.i686-unknown-freebsd.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.x86_64-unknown-freebsd.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.le32-unknown-nacl.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.arm-unknown-nacl.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.i686-unknown-nacl.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" +[target.x86_64-unknown-nacl.dependencies.openssl-sys] + git = "https://github.com/alexcrichton/openssl-sys" From 019e47020a52c0e4409739837ef653f7837f2e1c Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Sun, 9 Nov 2014 23:07:59 -0600 Subject: [PATCH 2/3] Support PNaCl/NaCl. --- Cargo.toml | 17 +++++++++-------- src/ffi.rs | 30 ++++++++++++++++++------------ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 28300444..077c536d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,11 +26,12 @@ sslv2 = [] git = "https://github.com/alexcrichton/openssl-sys" [target.x86_64-unknown-freebsd.dependencies.openssl-sys] git = "https://github.com/alexcrichton/openssl-sys" -[target.le32-unknown-nacl.dependencies.openssl-sys] - git = "https://github.com/alexcrichton/openssl-sys" -[target.arm-unknown-nacl.dependencies.openssl-sys] - git = "https://github.com/alexcrichton/openssl-sys" -[target.i686-unknown-nacl.dependencies.openssl-sys] - git = "https://github.com/alexcrichton/openssl-sys" -[target.x86_64-unknown-nacl.dependencies.openssl-sys] - git = "https://github.com/alexcrichton/openssl-sys" + +[target.le32-unknown-nacl.dependencies.libressl-pnacl-sys] +git = "https://github.com/DiamondLovesYou/libressl-pnacl-sys.git" +[target.arm-unknown-nacl.dependencies.libressl-pnacl-sys] +git = "https://github.com/DiamondLovesYou/libressl-pnacl-sys.git" +[target.i686-unknown-nacl.dependencies.libressl-pnacl-sys] +git = "https://github.com/DiamondLovesYou/libressl-pnacl-sys.git" +[target.x86_64-unknown-nacl.dependencies.libressl-pnacl-sys] +git = "https://github.com/DiamondLovesYou/libressl-pnacl-sys.git" diff --git a/src/ffi.rs b/src/ffi.rs index e661d205..e67f444d 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -176,20 +176,26 @@ pub const X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: c_int = 45; pub const X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: c_int = 53; pub const X509_V_OK: c_int = 0; -#[cfg( any( all(target_os = "macos", feature = "tlsv1_1"),all(target_os = "macos", feature = "tlsv1_2")))] -#[link(name="ssl.1.0.0")] -#[link(name="crypto.1.0.0")] -extern {} +#[cfg(not(target_os = "nacl"))] +mod link { + #[cfg( any( all(target_os = "macos", feature = "tlsv1_1"), + all(target_os = "macos", feature = "tlsv1_2")))] + #[link(name="ssl.1.0.0")] + #[link(name="crypto.1.0.0")] + extern {} -#[cfg(any( not( target_os = "macos"), all(target_os = "macos", not(feature = "tlsv1_1"), not(feature = "tlsv1_2"))))] -#[link(name="ssl")] -#[link(name="crypto")] -extern {} + #[cfg(any( not( target_os = "macos"), + all(target_os = "macos", not(feature = "tlsv1_1"), + not(feature = "tlsv1_2"))))] + #[link(name="ssl")] + #[link(name="crypto")] + extern {} -#[cfg(target_os = "win32")] -#[link(name="gdi32")] -#[link(name="wsock32")] -extern { } + #[cfg(target_os = "win32")] + #[link(name="gdi32")] + #[link(name="wsock32")] + extern { } +} static mut MUTEXES: *mut Vec = 0 as *mut Vec; From c2717cd98c88c80e165b44d6ce1fdd7d2fad155e Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Sun, 9 Nov 2014 23:40:46 -0600 Subject: [PATCH 3/3] Force linkage of LibreSSL when targeting NaCl OSs. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8d81b70c..456c8c7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,9 @@ extern crate libc; extern crate serialize; extern crate sync; +#[cfg(target_os = "nacl")] +extern crate "openssl-sys" as _unused; + mod macros; pub mod asn1;