From c9220900753052a946abf6ac6de172d4a5e98b43 Mon Sep 17 00:00:00 2001 From: Valerii Hiora Date: Thu, 11 Dec 2014 13:44:37 +0200 Subject: Update to nightly: explicit Copy trait --- openssl-sys/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 1faf749e..8550ce33 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -39,6 +39,7 @@ pub type X509_NAME_ENTRY = c_void; pub type X509_REQ = c_void; pub type X509_STORE_CTX = c_void; +#[allow(missing_copy_implementations)] #[repr(C)] pub struct EVP_MD_CTX { digest: *mut EVP_MD, @@ -49,6 +50,7 @@ pub struct EVP_MD_CTX { update: *mut c_void } +#[allow(missing_copy_implementations)] #[repr(C)] pub struct HMAC_CTX { md: *mut EVP_MD, @@ -59,6 +61,7 @@ pub struct HMAC_CTX { key: [c_uchar, ..128] } +#[allow(missing_copy_implementations)] #[repr(C)] pub struct X509V3_CTX { flags: c_int, @@ -72,6 +75,7 @@ pub struct X509V3_CTX { // Maybe more here } +#[allow(missing_copy_implementations)] #[repr(C)] pub struct BIGNUM { pub d: *mut c_void, -- cgit v1.2.3 From c1e225563d1e8a339a07df9d30649bfd25bfe4ca Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 11 Dec 2014 09:04:27 -0800 Subject: Clean up Copy impls a bit --- openssl-sys/src/lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 8550ce33..2a99d710 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -39,7 +39,6 @@ pub type X509_NAME_ENTRY = c_void; pub type X509_REQ = c_void; pub type X509_STORE_CTX = c_void; -#[allow(missing_copy_implementations)] #[repr(C)] pub struct EVP_MD_CTX { digest: *mut EVP_MD, @@ -50,7 +49,8 @@ pub struct EVP_MD_CTX { update: *mut c_void } -#[allow(missing_copy_implementations)] +impl Copy for EVP_MD_CTX {} + #[repr(C)] pub struct HMAC_CTX { md: *mut EVP_MD, @@ -61,7 +61,8 @@ pub struct HMAC_CTX { key: [c_uchar, ..128] } -#[allow(missing_copy_implementations)] +impl Copy for HMAC_CTX {} + #[repr(C)] pub struct X509V3_CTX { flags: c_int, @@ -75,7 +76,8 @@ pub struct X509V3_CTX { // Maybe more here } -#[allow(missing_copy_implementations)] +impl Copy for X509V3_CTX {} + #[repr(C)] pub struct BIGNUM { pub d: *mut c_void, @@ -85,6 +87,8 @@ pub struct BIGNUM { pub flags: c_int, } +impl Copy for BIGNUM {} + pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, ad: *const CRYPTO_EX_DATA, idx: c_int, argl: c_long, argp: *const c_void) -> c_int; -- cgit v1.2.3 From 4d49abd102942c6374c83767949ef812a7806ea7 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Fri, 12 Dec 2014 08:05:42 +1000 Subject: Use static linking on android, which simplifies deployment since loading application specific shared libraries on android requires Java code or other hacks. --- openssl-sys/src/build.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/build.rs b/openssl-sys/src/build.rs index 53c047b2..ca71f791 100644 --- a/openssl-sys/src/build.rs +++ b/openssl-sys/src/build.rs @@ -9,9 +9,14 @@ fn main() { if pkg_config::find_library("openssl").is_err() { - let mut flags = " -l crypto -l ssl".to_string(); - let target = os::getenv("TARGET").unwrap(); + let is_android = target.find_str("android").is_some(); + + let mut flags = if is_android { + " -l crypto:static -l ssl:static" + } else { + " -l crypto -l ssl" + }.to_string(); let win_pos = target.find_str("windows") .or(target.find_str("win32")) @@ -23,7 +28,7 @@ fn main() { flags.push_str(" -l gdi32 -l wsock32"); } - if target.find_str("android").is_some() { + if is_android { let path = os::getenv("OPENSSL_PATH").expect("Android does not provide openssl libraries, please \ build them yourselves (instructions in the README) \ and provide their location through $OPENSSL_PATH."); -- cgit v1.2.3 From e2fa62e2ae7bce4bee4744aa8ea440d8777e6890 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Sun, 21 Dec 2014 08:52:12 -0500 Subject: Replaced now removed NativeMutex with StaticMutex, and fixed Neg implementation for BigNum. --- openssl-sys/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 2a99d710..104f71b5 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] extern crate libc; -extern crate rustrt; #[cfg(feature = "libressl-pnacl-sys")] extern crate "libressl-pnacl-sys" as _for_linkage; @@ -10,7 +9,7 @@ extern crate "libressl-pnacl-sys" as _for_linkage; use libc::{c_void, c_int, c_char, c_ulong, c_long, c_uint, c_uchar, size_t}; use std::mem; use std::ptr; -use rustrt::mutex::NativeMutex; +use std::sync::{StaticMutex, StaticMutexGuard, MUTEX_INIT}; use std::sync::{Once, ONCE_INIT}; pub type ASN1_INTEGER = c_void; @@ -192,7 +191,8 @@ 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; -static mut MUTEXES: *mut Vec = 0 as *mut Vec; +static mut MUTEXES: *mut Vec = 0 as *mut Vec; +static mut GUARDS: *mut Vec> = 0 as *mut Vec>; extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char, _line: c_int) { @@ -200,9 +200,9 @@ extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char, let mutex = &(*MUTEXES)[n as uint]; if mode & CRYPTO_LOCK != 0 { - mutex.lock_noguard(); + (*GUARDS)[n as uint] = Some(mutex.lock()); } else { - mutex.unlock_noguard(); + &(*GUARDS)[n as uint].take(); } } } @@ -216,8 +216,10 @@ pub fn init() { SSL_load_error_strings(); let num_locks = CRYPTO_num_locks(); - let mutexes = box Vec::from_fn(num_locks as uint, |_| NativeMutex::new()); + let mutexes = box Vec::from_fn(num_locks as uint, |_| MUTEX_INIT); MUTEXES = mem::transmute(mutexes); + let guards: Box>> = box Vec::from_fn(num_locks as uint, |_| None); + GUARDS = mem::transmute(guards); CRYPTO_set_locking_callback(locking_function); }) -- cgit v1.2.3