diff options
Diffstat (limited to 'openssl-sys')
| -rw-r--r-- | openssl-sys/Cargo.toml | 4 | ||||
| -rw-r--r-- | openssl-sys/build.rs | 7 | ||||
| -rw-r--r-- | openssl-sys/src/lib.rs | 67 |
3 files changed, 70 insertions, 8 deletions
diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 1c4900ea..17e4647f 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "openssl-sys" -version = "0.7.0" +version = "0.7.1" authors = ["Alex Crichton <[email protected]>", "Steven Fackler <[email protected]>"] license = "MIT" description = "FFI bindings to OpenSSL" repository = "https://github.com/sfackler/rust-openssl" -documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.0/openssl_sys" +documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.1/openssl_sys" links = "openssl" build = "build.rs" diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index d8399c54..0e3a76d2 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -15,8 +15,11 @@ fn main() { // rustc doesn't seem to work with pkg-config's output in mingw64 if !target.contains("windows") { if let Ok(info) = pkg_config::find_library("openssl") { - let paths = env::join_paths(info.include_paths).unwrap(); - println!("cargo:include={}", paths.to_str().unwrap()); + // avoid empty include paths as they are not supported by GCC + if info.include_paths.len() > 0 { + let paths = env::join_paths(info.include_paths).unwrap(); + println!("cargo:include={}", paths.to_str().unwrap()); + } return; } } diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index b9b4e3e9..4221e808 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(dead_code)] -#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.0")] +#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.1")] extern crate libc; @@ -15,11 +15,8 @@ use std::sync::{Once, ONCE_INIT}; pub type ASN1_INTEGER = c_void; pub type ASN1_STRING = c_void; pub type ASN1_TIME = c_void; -pub type BIO = c_void; -pub type BIO_METHOD = c_void; pub type BN_CTX = c_void; pub type COMP_METHOD = c_void; -pub type CRYPTO_EX_DATA = c_void; pub type DH = c_void; pub type ENGINE = c_void; pub type EVP_CIPHER = c_void; @@ -39,6 +36,65 @@ pub type X509_NAME_ENTRY = c_void; pub type X509_REQ = c_void; pub type X509_STORE_CTX = c_void; pub type stack_st_X509_EXTENSION = c_void; +pub type stack_st_void = c_void; +pub type bio_st = c_void; + +pub type bio_info_cb = Option<unsafe extern "C" fn(*mut BIO, + c_int, + *const c_char, + c_int, + c_long, + c_long)>; + +#[repr(C)] +#[derive(Copy, Clone)] +#[allow(raw_pointer_derive)] +pub struct BIO_METHOD { + pub type_: c_int, + pub name: *const c_char, + pub bwrite: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>, + pub bread: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>, + pub bputs: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>, + pub bgets: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>, + pub ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>, + pub create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, + pub destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, + pub callback_ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, bio_info_cb) -> c_long>, +} + +// so we can create static BIO_METHODs +unsafe impl Sync for BIO_METHOD {} + +#[repr(C)] +pub struct BIO { + pub method: *mut BIO_METHOD, + pub callback: Option<unsafe extern "C" fn(*mut BIO, + c_int, + *const c_char, + c_int, + c_long, + c_long) + -> c_long>, + pub cb_arg: *mut c_char, + pub init: c_int, + pub shutdown: c_int, + pub flags: c_int, + pub retry_reason: c_int, + pub num: c_int, + pub ptr: *mut c_void, + pub next_bio: *mut BIO, + pub prev_bio: *mut BIO, + pub references: c_int, + pub num_read: c_ulong, + pub num_write: c_ulong, + pub ex_data: CRYPTO_EX_DATA, +} + +#[repr(C)] +pub struct CRYPTO_EX_DATA { + pub sk: *mut stack_st_void, + pub dummy: c_int, +} #[repr(C)] pub struct EVP_MD_CTX { @@ -116,7 +172,10 @@ pub type PasswordCallback = extern "C" fn(buf: *mut c_char, size: c_int, rwflag: c_int, user_data: *mut c_void) -> c_int; +pub const BIO_TYPE_NONE: c_int = 0; + pub const BIO_CTRL_EOF: c_int = 2; +pub const BIO_CTRL_FLUSH: c_int = 11; pub const BIO_C_SET_BUF_MEM_EOF_RETURN: c_int = 130; pub const CRYPTO_LOCK: c_int = 1; |