Merge pull request #638 from sfackler/110-sync-fix
Explicitly initialize OpenSSL 1.1.0
This commit is contained in:
commit
52e82faa47
|
|
@ -11,21 +11,19 @@ use std::panic::{self, AssertUnwindSafe};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
// The set of `OPENSSL_NO_<FOO>`s that we care about.
|
// The set of `OPENSSL_NO_<FOO>`s that we care about.
|
||||||
const DEFINES: &'static [&'static str] = &[
|
const DEFINES: &'static [&'static str] = &["OPENSSL_NO_BUF_FREELISTS",
|
||||||
"OPENSSL_NO_BUF_FREELISTS",
|
"OPENSSL_NO_COMP",
|
||||||
"OPENSSL_NO_COMP",
|
"OPENSSL_NO_EC",
|
||||||
"OPENSSL_NO_EC",
|
"OPENSSL_NO_EC2M",
|
||||||
"OPENSSL_NO_EC2M",
|
"OPENSSL_NO_ENGINE",
|
||||||
"OPENSSL_NO_ENGINE",
|
"OPENSSL_NO_KRB5",
|
||||||
"OPENSSL_NO_KRB5",
|
"OPENSSL_NO_NEXTPROTONEG",
|
||||||
"OPENSSL_NO_NEXTPROTONEG",
|
"OPENSSL_NO_PSK",
|
||||||
"OPENSSL_NO_PSK",
|
"OPENSSL_NO_RFC3779",
|
||||||
"OPENSSL_NO_RFC3779",
|
"OPENSSL_NO_SHA",
|
||||||
"OPENSSL_NO_SHA",
|
"OPENSSL_NO_SRP",
|
||||||
"OPENSSL_NO_SRP",
|
"OPENSSL_NO_SSL3_METHOD",
|
||||||
"OPENSSL_NO_SSL3_METHOD",
|
"OPENSSL_NO_TLSEXT"];
|
||||||
"OPENSSL_NO_TLSEXT",
|
|
||||||
];
|
|
||||||
|
|
||||||
enum Version {
|
enum Version {
|
||||||
Openssl110,
|
Openssl110,
|
||||||
|
|
@ -41,9 +39,7 @@ fn main() {
|
||||||
let include_dir = env::var_os("OPENSSL_INCLUDE_DIR").map(PathBuf::from);
|
let include_dir = env::var_os("OPENSSL_INCLUDE_DIR").map(PathBuf::from);
|
||||||
|
|
||||||
let (lib_dir, include_dir) = if lib_dir.is_none() || include_dir.is_none() {
|
let (lib_dir, include_dir) = if lib_dir.is_none() || include_dir.is_none() {
|
||||||
let openssl_dir = env::var_os("OPENSSL_DIR").unwrap_or_else(|| {
|
let openssl_dir = env::var_os("OPENSSL_DIR").unwrap_or_else(|| find_openssl_dir(&target));
|
||||||
find_openssl_dir(&target)
|
|
||||||
});
|
|
||||||
let openssl_dir = Path::new(&openssl_dir);
|
let openssl_dir = Path::new(&openssl_dir);
|
||||||
let lib_dir = lib_dir.unwrap_or_else(|| openssl_dir.join("lib"));
|
let lib_dir = lib_dir.unwrap_or_else(|| openssl_dir.join("lib"));
|
||||||
let include_dir = include_dir.unwrap_or_else(|| openssl_dir.join("include"));
|
let include_dir = include_dir.unwrap_or_else(|| openssl_dir.join("include"));
|
||||||
|
|
@ -61,7 +57,8 @@ fn main() {
|
||||||
include_dir.to_string_lossy());
|
include_dir.to_string_lossy());
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("cargo:rustc-link-search=native={}", lib_dir.to_string_lossy());
|
println!("cargo:rustc-link-search=native={}",
|
||||||
|
lib_dir.to_string_lossy());
|
||||||
println!("cargo:include={}", include_dir.to_string_lossy());
|
println!("cargo:include={}", include_dir.to_string_lossy());
|
||||||
|
|
||||||
let version = validate_headers(&[include_dir.clone().into()]);
|
let version = validate_headers(&[include_dir.clone().into()]);
|
||||||
|
|
@ -71,9 +68,8 @@ fn main() {
|
||||||
Some(ref v) => v.split(":").collect(),
|
Some(ref v) => v.split(":").collect(),
|
||||||
None => {
|
None => {
|
||||||
match version {
|
match version {
|
||||||
Version::Openssl101 | Version::Openssl102 if target.contains("windows") => {
|
Version::Openssl101 |
|
||||||
vec!["ssleay32", "libeay32"]
|
Version::Openssl102 if target.contains("windows") => vec!["ssleay32", "libeay32"],
|
||||||
}
|
|
||||||
Version::Openssl110 if target.contains("windows") => vec!["libssl", "libcrypto"],
|
Version::Openssl110 if target.contains("windows") => vec!["libssl", "libcrypto"],
|
||||||
_ => vec!["ssl", "crypto"],
|
_ => vec!["ssl", "crypto"],
|
||||||
}
|
}
|
||||||
|
|
@ -93,11 +89,11 @@ fn find_openssl_dir(target: &str) -> OsString {
|
||||||
if host.contains("apple-darwin") && target.contains("apple-darwin") {
|
if host.contains("apple-darwin") && target.contains("apple-darwin") {
|
||||||
let homebrew = Path::new("/usr/local/opt/openssl@1.1");
|
let homebrew = Path::new("/usr/local/opt/openssl@1.1");
|
||||||
if homebrew.exists() {
|
if homebrew.exists() {
|
||||||
return homebrew.to_path_buf().into()
|
return homebrew.to_path_buf().into();
|
||||||
}
|
}
|
||||||
let homebrew = Path::new("/usr/local/opt/openssl");
|
let homebrew = Path::new("/usr/local/opt/openssl");
|
||||||
if homebrew.exists() {
|
if homebrew.exists() {
|
||||||
return homebrew.to_path_buf().into()
|
return homebrew.to_path_buf().into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +115,9 @@ and include information about your system as well as this message.
|
||||||
openssl-sys = {}
|
openssl-sys = {}
|
||||||
|
|
||||||
",
|
",
|
||||||
host, target, env!("CARGO_PKG_VERSION"));
|
host,
|
||||||
|
target,
|
||||||
|
env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
if host.contains("apple-darwin") && target.contains("apple-darwin") {
|
if host.contains("apple-darwin") && target.contains("apple-darwin") {
|
||||||
let system = Path::new("/usr/lib/libssl.0.9.8.dylib");
|
let system = Path::new("/usr/lib/libssl.0.9.8.dylib");
|
||||||
|
|
@ -160,8 +158,7 @@ pkg-config installed. You can install these two dependencies with:
|
||||||
|
|
||||||
and try building this crate again.
|
and try building this crate again.
|
||||||
|
|
||||||
"
|
"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if host.contains("windows") && target.contains("windows-msvc") {
|
if host.contains("windows") && target.contains("windows-msvc") {
|
||||||
|
|
@ -173,8 +170,7 @@ OpenSSL:
|
||||||
|
|
||||||
https://github.com/sfackler/rust-openssl#windows
|
https://github.com/sfackler/rust-openssl#windows
|
||||||
|
|
||||||
"
|
"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!(msg);
|
panic!(msg);
|
||||||
|
|
@ -195,12 +191,12 @@ fn try_pkg_config() {
|
||||||
if target.contains("windows-gnu") && host.contains("windows") {
|
if target.contains("windows-gnu") && host.contains("windows") {
|
||||||
env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
|
env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
|
||||||
} else if target.contains("windows") {
|
} else if target.contains("windows") {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let lib = match pkg_config::Config::new()
|
let lib = match pkg_config::Config::new()
|
||||||
.print_system_libs(false)
|
.print_system_libs(false)
|
||||||
.find("openssl") {
|
.find("openssl") {
|
||||||
Ok(lib) => lib,
|
Ok(lib) => lib,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("run pkg_config fail: {:?}", e);
|
println!("run pkg_config fail: {:?}", e);
|
||||||
|
|
@ -236,7 +232,8 @@ fn validate_headers(include_dirs: &[PathBuf]) -> Version {
|
||||||
path.push("expando.c");
|
path.push("expando.c");
|
||||||
let mut file = BufWriter::new(File::create(&path).unwrap());
|
let mut file = BufWriter::new(File::create(&path).unwrap());
|
||||||
|
|
||||||
write!(file, "\
|
write!(file,
|
||||||
|
"\
|
||||||
#include <openssl/opensslv.h>
|
#include <openssl/opensslv.h>
|
||||||
#include <openssl/opensslconf.h>
|
#include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
|
@ -265,14 +262,18 @@ RUST_OPENSSL_101
|
||||||
#else
|
#else
|
||||||
RUST_OPENSSL_OLD
|
RUST_OPENSSL_OLD
|
||||||
#endif
|
#endif
|
||||||
").unwrap();
|
")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
for define in DEFINES {
|
for define in DEFINES {
|
||||||
write!(file, "\
|
write!(file,
|
||||||
|
"\
|
||||||
#ifdef {define}
|
#ifdef {define}
|
||||||
RUST_{define}
|
RUST_{define}
|
||||||
#endif
|
#endif
|
||||||
", define = define).unwrap();
|
",
|
||||||
|
define = define)
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
file.flush().unwrap();
|
file.flush().unwrap();
|
||||||
|
|
@ -384,20 +385,23 @@ fn determine_mode(libdir: &Path, libs: &[&str]) -> &'static str {
|
||||||
|
|
||||||
// Next, see what files we actually have to link against, and see what our
|
// Next, see what files we actually have to link against, and see what our
|
||||||
// possibilities even are.
|
// possibilities even are.
|
||||||
let files = libdir.read_dir().unwrap()
|
let files = libdir
|
||||||
.map(|e| e.unwrap())
|
.read_dir()
|
||||||
.map(|e| e.file_name())
|
.unwrap()
|
||||||
.filter_map(|e| e.into_string().ok())
|
.map(|e| e.unwrap())
|
||||||
.collect::<HashSet<_>>();
|
.map(|e| e.file_name())
|
||||||
let can_static = libs.iter().all(|l| {
|
.filter_map(|e| e.into_string().ok())
|
||||||
files.contains(&format!("lib{}.a", l)) ||
|
.collect::<HashSet<_>>();
|
||||||
files.contains(&format!("{}.lib", l))
|
let can_static =
|
||||||
});
|
libs.iter()
|
||||||
let can_dylib = libs.iter().all(|l| {
|
.all(|l| {
|
||||||
files.contains(&format!("lib{}.so", l)) ||
|
files.contains(&format!("lib{}.a", l)) || files.contains(&format!("{}.lib", l))
|
||||||
files.contains(&format!("{}.dll", l)) ||
|
});
|
||||||
files.contains(&format!("lib{}.dylib", l))
|
let can_dylib = libs.iter()
|
||||||
});
|
.all(|l| {
|
||||||
|
files.contains(&format!("lib{}.so", l)) || files.contains(&format!("{}.dll", l)) ||
|
||||||
|
files.contains(&format!("lib{}.dylib", l))
|
||||||
|
});
|
||||||
match (can_static, can_dylib) {
|
match (can_static, can_dylib) {
|
||||||
(true, false) => return "static",
|
(true, false) => return "static",
|
||||||
(false, true) => return "dylib",
|
(false, true) => return "dylib",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -66,21 +66,21 @@ pub struct _STACK {
|
||||||
pub data: *mut *mut c_char,
|
pub data: *mut *mut c_char,
|
||||||
pub sorted: c_int,
|
pub sorted: c_int,
|
||||||
pub num_alloc: c_int,
|
pub num_alloc: c_int,
|
||||||
pub comp: Option<unsafe extern fn(*const c_void, *const c_void) -> c_int>,
|
pub comp: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BIO_METHOD {
|
pub struct BIO_METHOD {
|
||||||
pub type_: c_int,
|
pub type_: c_int,
|
||||||
pub name: *const c_char,
|
pub name: *const c_char,
|
||||||
pub bwrite: Option<unsafe extern fn(*mut ::BIO, *const c_char, c_int) -> c_int>,
|
pub bwrite: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char, c_int) -> c_int>,
|
||||||
pub bread: Option<unsafe extern fn(*mut ::BIO, *mut 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 fn(*mut ::BIO, *const c_char) -> c_int>,
|
pub bputs: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char) -> c_int>,
|
||||||
pub bgets: Option<unsafe extern fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
|
pub bgets: Option<unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
|
||||||
pub ctrl: Option<unsafe extern fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long>,
|
pub ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long>,
|
||||||
pub create: Option<unsafe extern fn(*mut ::BIO) -> c_int>,
|
pub create: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
|
||||||
pub destroy: Option<unsafe extern fn(*mut ::BIO) -> c_int>,
|
pub destroy: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
|
||||||
pub callback_ctrl: Option<unsafe extern fn(*mut ::BIO, c_int, ::bio_info_cb) -> c_long>,
|
pub callback_ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, ::bio_info_cb) -> c_long>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -148,7 +148,7 @@ pub struct EVP_PKEY {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BIO {
|
pub struct BIO {
|
||||||
pub method: *mut ::BIO_METHOD,
|
pub method: *mut ::BIO_METHOD,
|
||||||
pub callback: Option<unsafe extern fn(*mut ::BIO,
|
pub callback: Option<unsafe extern "C" fn(*mut ::BIO,
|
||||||
c_int,
|
c_int,
|
||||||
*const c_char,
|
*const c_char,
|
||||||
c_int,
|
c_int,
|
||||||
|
|
@ -182,7 +182,7 @@ pub struct EVP_MD_CTX {
|
||||||
flags: c_ulong,
|
flags: c_ulong,
|
||||||
md_data: *mut c_void,
|
md_data: *mut c_void,
|
||||||
pctx: *mut ::EVP_PKEY_CTX,
|
pctx: *mut ::EVP_PKEY_CTX,
|
||||||
update: *mut c_void
|
update: *mut c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -192,24 +192,23 @@ pub struct EVP_CIPHER {
|
||||||
pub key_len: c_int,
|
pub key_len: c_int,
|
||||||
pub iv_len: c_int,
|
pub iv_len: c_int,
|
||||||
pub flags: c_ulong,
|
pub flags: c_ulong,
|
||||||
pub init: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub init: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX,
|
||||||
*const c_uchar,
|
*const c_uchar,
|
||||||
*const c_uchar,
|
*const c_uchar,
|
||||||
c_int) -> c_int>,
|
c_int)
|
||||||
pub do_cipher: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
-> c_int>,
|
||||||
*mut c_uchar,
|
pub do_cipher: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX,
|
||||||
*const c_uchar,
|
*mut c_uchar,
|
||||||
size_t) -> c_int>,
|
*const c_uchar,
|
||||||
pub cleanup: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX) -> c_int>,
|
size_t)
|
||||||
|
-> c_int>,
|
||||||
|
pub cleanup: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX) -> c_int>,
|
||||||
pub ctx_size: c_int,
|
pub ctx_size: c_int,
|
||||||
pub set_asn1_parameters: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub set_asn1_parameters:
|
||||||
*mut ::ASN1_TYPE) -> c_int>,
|
Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, *mut ::ASN1_TYPE) -> c_int>,
|
||||||
pub get_asn1_parameters: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub get_asn1_parameters:
|
||||||
*mut ::ASN1_TYPE) -> c_int>,
|
Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, *mut ::ASN1_TYPE) -> c_int>,
|
||||||
pub ctrl: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub ctrl: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, c_int, c_int, *mut c_void) -> c_int>,
|
||||||
c_int,
|
|
||||||
c_int,
|
|
||||||
*mut c_void) -> c_int>,
|
|
||||||
pub app_data: *mut c_void,
|
pub app_data: *mut c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +219,7 @@ pub struct HMAC_CTX {
|
||||||
i_ctx: ::EVP_MD_CTX,
|
i_ctx: ::EVP_MD_CTX,
|
||||||
o_ctx: ::EVP_MD_CTX,
|
o_ctx: ::EVP_MD_CTX,
|
||||||
key_length: c_uint,
|
key_length: c_uint,
|
||||||
key: [c_uchar; 128]
|
key: [c_uchar; 128],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -320,7 +319,7 @@ pub struct X509_REQ_INFO {
|
||||||
pub version: *mut ::ASN1_INTEGER,
|
pub version: *mut ::ASN1_INTEGER,
|
||||||
pub subject: *mut ::X509_NAME,
|
pub subject: *mut ::X509_NAME,
|
||||||
pubkey: *mut c_void,
|
pubkey: *mut c_void,
|
||||||
pub attributes: *mut stack_st_X509_ATTRIBUTE
|
pub attributes: *mut stack_st_X509_ATTRIBUTE,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -328,7 +327,7 @@ pub struct X509_REQ {
|
||||||
pub req_info: *mut X509_REQ_INFO,
|
pub req_info: *mut X509_REQ_INFO,
|
||||||
sig_alg: *mut c_void,
|
sig_alg: *mut c_void,
|
||||||
signature: *mut c_void,
|
signature: *mut c_void,
|
||||||
references: c_int
|
references: c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum X509_VERIFY_PARAM_ID {}
|
pub enum X509_VERIFY_PARAM_ID {}
|
||||||
|
|
@ -339,78 +338,78 @@ pub const SSL_CTRL_OPTIONS: c_int = 32;
|
||||||
pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
|
pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
|
||||||
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
|
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
|
||||||
|
|
||||||
pub const SSL_OP_ALL: c_ulong = 0x80000014;
|
pub const SSL_OP_ALL: c_ulong = 0x80000014;
|
||||||
pub const SSL_OP_CISCO_ANYCONNECT: c_ulong = 0x0;
|
pub const SSL_OP_CISCO_ANYCONNECT: c_ulong = 0x0;
|
||||||
pub const SSL_OP_NO_COMPRESSION: c_ulong = 0x0;
|
pub const SSL_OP_NO_COMPRESSION: c_ulong = 0x0;
|
||||||
pub const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: c_ulong = 0x0;
|
pub const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: c_ulong = 0x0;
|
||||||
pub const SSL_OP_NO_SSLv3: c_ulong = 0x0;
|
pub const SSL_OP_NO_SSLv3: c_ulong = 0x0;
|
||||||
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x0;
|
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x0;
|
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x0;
|
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x0;
|
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x0;
|
||||||
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x0;
|
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x0;
|
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x0;
|
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x0;
|
||||||
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
|
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
|
||||||
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
|
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
|
||||||
pub const SSL_OP_NO_SSLv2: c_ulong = 0x0;
|
pub const SSL_OP_NO_SSLv2: c_ulong = 0x0;
|
||||||
|
|
||||||
pub const SSL_MAX_SSL_SESSION_ID_LENGTH: c_int = 32;
|
pub const SSL_MAX_SSL_SESSION_ID_LENGTH: c_int = 32;
|
||||||
pub const SSL_MAX_SID_CTX_LENGTH: c_int = 32;
|
pub const SSL_MAX_SID_CTX_LENGTH: c_int = 32;
|
||||||
pub const SSL_MAX_MASTER_KEY_LENGTH: c_int = 48;
|
pub const SSL_MAX_MASTER_KEY_LENGTH: c_int = 48;
|
||||||
|
|
||||||
pub const SSLEAY_VERSION : c_int = 0;
|
pub const SSLEAY_VERSION: c_int = 0;
|
||||||
pub const SSLEAY_CFLAGS : c_int = 2;
|
pub const SSLEAY_CFLAGS: c_int = 2;
|
||||||
pub const SSLEAY_BUILT_ON : c_int = 3;
|
pub const SSLEAY_BUILT_ON: c_int = 3;
|
||||||
pub const SSLEAY_PLATFORM : c_int = 4;
|
pub const SSLEAY_PLATFORM: c_int = 4;
|
||||||
pub const SSLEAY_DIR : c_int = 5;
|
pub const SSLEAY_DIR: c_int = 5;
|
||||||
|
|
||||||
pub const CRYPTO_LOCK_X509: c_int = 3;
|
pub const CRYPTO_LOCK_X509: c_int = 3;
|
||||||
pub const CRYPTO_LOCK_SSL_CTX: c_int = 12;
|
pub const CRYPTO_LOCK_SSL_CTX: c_int = 12;
|
||||||
pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
|
pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
|
||||||
|
|
||||||
static mut MUTEXES: *mut Vec<Mutex<()>> = 0 as *mut Vec<Mutex<()>>;
|
static mut MUTEXES: *mut Vec<Mutex<()>> = 0 as *mut Vec<Mutex<()>>;
|
||||||
static mut GUARDS: *mut Vec<Option<MutexGuard<'static, ()>>> = 0 as *mut Vec<Option<MutexGuard<'static, ()>>>;
|
static mut GUARDS: *mut Vec<Option<MutexGuard<'static, ()>>> =
|
||||||
|
0 as *mut Vec<Option<MutexGuard<'static, ()>>>;
|
||||||
|
|
||||||
unsafe extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
|
unsafe extern "C" fn locking_function(mode: c_int, n: c_int, _file: *const c_char, _line: c_int) {
|
||||||
_line: c_int) {
|
|
||||||
let mutex = &(*MUTEXES)[n as usize];
|
let mutex = &(*MUTEXES)[n as usize];
|
||||||
|
|
||||||
if mode & ::CRYPTO_LOCK != 0 {
|
if mode & ::CRYPTO_LOCK != 0 {
|
||||||
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
||||||
} else {
|
} else {
|
||||||
&(*GUARDS)[n as usize].take().expect("lock already unlocked");
|
&(*GUARDS)[n as usize]
|
||||||
|
.take()
|
||||||
|
.expect("lock already unlocked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
static INIT: Once = ONCE_INIT;
|
static INIT: Once = ONCE_INIT;
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| unsafe {
|
||||||
unsafe {
|
SSL_library_init();
|
||||||
SSL_library_init();
|
SSL_load_error_strings();
|
||||||
SSL_load_error_strings();
|
OPENSSL_add_all_algorithms_noconf();
|
||||||
OPENSSL_add_all_algorithms_noconf();
|
|
||||||
|
|
||||||
let num_locks = ::CRYPTO_num_locks();
|
let num_locks = ::CRYPTO_num_locks();
|
||||||
let mut mutexes = Box::new(Vec::new());
|
let mut mutexes = Box::new(Vec::new());
|
||||||
for _ in 0..num_locks {
|
for _ in 0..num_locks {
|
||||||
mutexes.push(Mutex::new(()));
|
mutexes.push(Mutex::new(()));
|
||||||
}
|
}
|
||||||
MUTEXES = mem::transmute(mutexes);
|
MUTEXES = mem::transmute(mutexes);
|
||||||
let guards: Box<Vec<Option<MutexGuard<()>>>> =
|
let guards: Box<Vec<Option<MutexGuard<()>>>> =
|
||||||
Box::new((0..num_locks).map(|_| None).collect());
|
Box::new((0..num_locks).map(|_| None).collect());
|
||||||
GUARDS = mem::transmute(guards);
|
GUARDS = mem::transmute(guards);
|
||||||
|
|
||||||
CRYPTO_set_locking_callback(locking_function);
|
CRYPTO_set_locking_callback(locking_function);
|
||||||
set_id_callback();
|
set_id_callback();
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn set_id_callback() {
|
fn set_id_callback() {
|
||||||
unsafe extern fn thread_id() -> c_ulong {
|
unsafe extern "C" fn thread_id() -> c_ulong {
|
||||||
::libc::pthread_self() as c_ulong
|
::libc::pthread_self() as c_ulong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -425,18 +424,24 @@ fn set_id_callback() {}
|
||||||
// macros
|
// macros
|
||||||
|
|
||||||
pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_int) -> c_int {
|
pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_int) -> c_int {
|
||||||
::SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ptr::null_mut()) as c_int
|
::SSL_CTX_ctrl(ctx,
|
||||||
|
SSL_CTRL_SET_ECDH_AUTO,
|
||||||
|
onoff as c_long,
|
||||||
|
ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn SSL_set_ecdh_auto(ssl: *mut ::SSL, onoff: c_int) -> c_int {
|
pub unsafe fn SSL_set_ecdh_auto(ssl: *mut ::SSL, onoff: c_int) -> c_int {
|
||||||
::SSL_ctrl(ssl, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ptr::null_mut()) as c_int
|
::SSL_ctrl(ssl,
|
||||||
|
SSL_CTRL_SET_ECDH_AUTO,
|
||||||
|
onoff as c_long,
|
||||||
|
ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn SSL_session_reused(ssl: *mut ::SSL) -> c_int {
|
pub unsafe fn SSL_session_reused(ssl: *mut ::SSL) -> c_int {
|
||||||
::SSL_ctrl(ssl, SSL_CTRL_GET_SESSION_REUSED, 0, ptr::null_mut()) as c_int
|
::SSL_ctrl(ssl, SSL_CTRL_GET_SESSION_REUSED, 0, ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
extern {
|
extern "C" {
|
||||||
pub fn BIO_new(type_: *mut BIO_METHOD) -> *mut BIO;
|
pub fn BIO_new(type_: *mut BIO_METHOD) -> *mut BIO;
|
||||||
pub fn BIO_s_file() -> *mut BIO_METHOD;
|
pub fn BIO_s_file() -> *mut BIO_METHOD;
|
||||||
pub fn BIO_s_mem() -> *mut BIO_METHOD;
|
pub fn BIO_s_mem() -> *mut BIO_METHOD;
|
||||||
|
|
@ -463,10 +468,14 @@ extern {
|
||||||
|
|
||||||
pub fn RSA_generate_key(modsz: c_int,
|
pub fn RSA_generate_key(modsz: c_int,
|
||||||
e: c_ulong,
|
e: c_ulong,
|
||||||
cb: Option<extern fn(c_int, c_int, *mut c_void)>,
|
cb: Option<extern "C" fn(c_int, c_int, *mut c_void)>,
|
||||||
cbarg: *mut c_void) -> *mut RSA;
|
cbarg: *mut c_void)
|
||||||
|
-> *mut RSA;
|
||||||
|
|
||||||
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD, subject: *mut ::X509, issuer: *mut ::X509) -> *mut ::OCSP_CERTID;
|
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD,
|
||||||
|
subject: *mut ::X509,
|
||||||
|
issuer: *mut ::X509)
|
||||||
|
-> *mut ::OCSP_CERTID;
|
||||||
|
|
||||||
pub fn PKCS12_create(pass: *mut c_char,
|
pub fn PKCS12_create(pass: *mut c_char,
|
||||||
friendly_name: *mut c_char,
|
friendly_name: *mut c_char,
|
||||||
|
|
@ -477,7 +486,8 @@ extern {
|
||||||
nid_cert: c_int,
|
nid_cert: c_int,
|
||||||
iter: c_int,
|
iter: c_int,
|
||||||
mac_iter: c_int,
|
mac_iter: c_int,
|
||||||
keytype: c_int) -> *mut PKCS12;
|
keytype: c_int)
|
||||||
|
-> *mut PKCS12;
|
||||||
|
|
||||||
pub fn SSL_library_init() -> c_int;
|
pub fn SSL_library_init() -> c_int;
|
||||||
pub fn SSL_load_error_strings();
|
pub fn SSL_load_error_strings();
|
||||||
|
|
@ -489,44 +499,66 @@ extern {
|
||||||
pub fn TLSv1_1_method() -> *const ::SSL_METHOD;
|
pub fn TLSv1_1_method() -> *const ::SSL_METHOD;
|
||||||
pub fn TLSv1_2_method() -> *const ::SSL_METHOD;
|
pub fn TLSv1_2_method() -> *const ::SSL_METHOD;
|
||||||
pub fn DTLSv1_method() -> *const ::SSL_METHOD;
|
pub fn DTLSv1_method() -> *const ::SSL_METHOD;
|
||||||
pub fn SSL_get_ex_new_index(argl: c_long, argp: *mut c_void,
|
pub fn SSL_get_ex_new_index(argl: c_long,
|
||||||
|
argp: *mut c_void,
|
||||||
new_func: Option<::CRYPTO_EX_new>,
|
new_func: Option<::CRYPTO_EX_new>,
|
||||||
dup_func: Option<::CRYPTO_EX_dup>,
|
dup_func: Option<::CRYPTO_EX_dup>,
|
||||||
free_func: Option<::CRYPTO_EX_free>)
|
free_func: Option<::CRYPTO_EX_free>)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn SSL_set_tmp_ecdh_callback(ssl: *mut ::SSL,
|
pub fn SSL_set_tmp_ecdh_callback(ssl: *mut ::SSL,
|
||||||
ecdh: unsafe extern fn(ssl: *mut ::SSL,
|
ecdh: unsafe extern "C" fn(ssl: *mut ::SSL,
|
||||||
is_export: c_int,
|
is_export: c_int,
|
||||||
keylength: c_int)
|
keylength: c_int)
|
||||||
-> *mut ::EC_KEY);
|
-> *mut ::EC_KEY);
|
||||||
pub fn SSL_CIPHER_get_version(cipher: *const ::SSL_CIPHER) -> *mut c_char;
|
pub fn SSL_CIPHER_get_version(cipher: *const ::SSL_CIPHER) -> *mut c_char;
|
||||||
pub fn SSL_CTX_get_ex_new_index(argl: c_long, argp: *mut c_void,
|
pub fn SSL_CTX_get_ex_new_index(argl: c_long,
|
||||||
|
argp: *mut c_void,
|
||||||
new_func: Option<::CRYPTO_EX_new>,
|
new_func: Option<::CRYPTO_EX_new>,
|
||||||
dup_func: Option<::CRYPTO_EX_dup>,
|
dup_func: Option<::CRYPTO_EX_dup>,
|
||||||
free_func: Option<::CRYPTO_EX_free>)
|
free_func: Option<::CRYPTO_EX_free>)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn SSL_CTX_set_tmp_ecdh_callback(ctx: *mut ::SSL_CTX,
|
pub fn SSL_CTX_set_tmp_ecdh_callback(ctx: *mut ::SSL_CTX,
|
||||||
ecdh: unsafe extern fn(ssl: *mut ::SSL,
|
ecdh: unsafe extern "C" fn(ssl: *mut ::SSL,
|
||||||
is_export: c_int,
|
is_export: c_int,
|
||||||
keylength: c_int)
|
keylength: c_int)
|
||||||
-> *mut ::EC_KEY);
|
-> *mut ::EC_KEY);
|
||||||
pub fn X509_get_subject_name(x: *mut ::X509) -> *mut ::X509_NAME;
|
pub fn X509_get_subject_name(x: *mut ::X509) -> *mut ::X509_NAME;
|
||||||
pub fn X509_set_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_set_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_get_ext_d2i(x: *mut ::X509, nid: c_int, crit: *mut c_int, idx: *mut c_int) -> *mut c_void;
|
pub fn X509_get_ext_d2i(x: *mut ::X509,
|
||||||
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME, field: c_int, ty: c_int, bytes: *mut c_uchar, len: c_int, loc: c_int, set: c_int) -> c_int;
|
nid: c_int,
|
||||||
|
crit: *mut c_int,
|
||||||
|
idx: *mut c_int)
|
||||||
|
-> *mut c_void;
|
||||||
|
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME,
|
||||||
|
field: c_int,
|
||||||
|
ty: c_int,
|
||||||
|
bytes: *mut c_uchar,
|
||||||
|
len: c_int,
|
||||||
|
loc: c_int,
|
||||||
|
set: c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn X509_NAME_get_entry(n: *mut ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
pub fn X509_NAME_get_entry(n: *mut ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
||||||
pub fn X509_NAME_ENTRY_get_data(ne: *mut ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
pub fn X509_NAME_ENTRY_get_data(ne: *mut ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
||||||
pub fn X509_STORE_CTX_get_chain(ctx: *mut ::X509_STORE_CTX) -> *mut stack_st_X509;
|
pub fn X509_STORE_CTX_get_chain(ctx: *mut ::X509_STORE_CTX) -> *mut stack_st_X509;
|
||||||
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, ext_nid: c_int, value: *mut c_char) -> *mut ::X509_EXTENSION;
|
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF,
|
||||||
pub fn X509V3_EXT_nconf(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, name: *mut c_char, value: *mut c_char) -> *mut ::X509_EXTENSION;
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
ext_nid: c_int,
|
||||||
|
value: *mut c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
|
pub fn X509V3_EXT_nconf(conf: *mut ::CONF,
|
||||||
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
name: *mut c_char,
|
||||||
|
value: *mut c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ::ASN1_STRING) -> c_int;
|
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ::ASN1_STRING) -> c_int;
|
||||||
pub fn ASN1_STRING_data(x: *mut ::ASN1_STRING) -> *mut c_uchar;
|
pub fn ASN1_STRING_data(x: *mut ::ASN1_STRING) -> *mut c_uchar;
|
||||||
pub fn CRYPTO_add_lock(pointer: *mut c_int,
|
pub fn CRYPTO_add_lock(pointer: *mut c_int,
|
||||||
amount: c_int,
|
amount: c_int,
|
||||||
type_: c_int,
|
type_: c_int,
|
||||||
file: *const c_char,
|
file: *const c_char,
|
||||||
line: c_int) -> c_int;
|
line: c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
|
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
|
||||||
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
|
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
|
||||||
pub fn EVP_PKEY_bits(key: *mut EVP_PKEY) -> c_int;
|
pub fn EVP_PKEY_bits(key: *mut EVP_PKEY) -> c_int;
|
||||||
|
|
@ -536,7 +568,7 @@ extern {
|
||||||
pub fn sk_value(st: *const _STACK, n: c_int) -> *mut c_void;
|
pub fn sk_value(st: *const _STACK, n: c_int) -> *mut c_void;
|
||||||
pub fn sk_free(st: *mut _STACK);
|
pub fn sk_free(st: *mut _STACK);
|
||||||
pub fn sk_push(st: *mut _STACK, data: *mut c_void) -> c_int;
|
pub fn sk_push(st: *mut _STACK, data: *mut c_void) -> c_int;
|
||||||
pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn (*mut c_void)>);
|
pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn(*mut c_void)>);
|
||||||
pub fn sk_pop(st: *mut _STACK) -> *mut c_void;
|
pub fn sk_pop(st: *mut _STACK) -> *mut c_void;
|
||||||
|
|
||||||
pub fn SSLeay() -> c_ulong;
|
pub fn SSLeay() -> c_ulong;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ pub struct SSL {
|
||||||
bbio: *mut c_void,
|
bbio: *mut c_void,
|
||||||
rwstate: c_int,
|
rwstate: c_int,
|
||||||
in_handshake: c_int,
|
in_handshake: c_int,
|
||||||
handshake_func: Option<unsafe extern fn(*mut SSL) -> c_int>,
|
handshake_func: Option<unsafe extern "C" fn(*mut SSL) -> c_int>,
|
||||||
pub server: c_int,
|
pub server: c_int,
|
||||||
new_session: c_int,
|
new_session: c_int,
|
||||||
quiet_shutdown: c_int,
|
quiet_shutdown: c_int,
|
||||||
|
|
@ -28,7 +28,13 @@ pub struct SSL {
|
||||||
s3: *mut c_void,
|
s3: *mut c_void,
|
||||||
d1: *mut c_void,
|
d1: *mut c_void,
|
||||||
read_ahead: c_int,
|
read_ahead: c_int,
|
||||||
msg_callback: Option<unsafe extern fn(c_int, c_int, c_int, *const c_void, size_t, *mut SSL, *mut c_void)>,
|
msg_callback: Option<unsafe extern "C" fn(c_int,
|
||||||
|
c_int,
|
||||||
|
c_int,
|
||||||
|
*const c_void,
|
||||||
|
size_t,
|
||||||
|
*mut SSL,
|
||||||
|
*mut c_void)>,
|
||||||
msg_callback_arg: *mut c_void,
|
msg_callback_arg: *mut c_void,
|
||||||
hit: c_int,
|
hit: c_int,
|
||||||
param: *mut c_void,
|
param: *mut c_void,
|
||||||
|
|
@ -47,8 +53,8 @@ pub struct SSL {
|
||||||
session: *mut ::SSL_SESSION,
|
session: *mut ::SSL_SESSION,
|
||||||
generate_session_id: ::GEN_SESSION_CB,
|
generate_session_id: ::GEN_SESSION_CB,
|
||||||
verify_mode: c_int,
|
verify_mode: c_int,
|
||||||
verify_callback: Option<unsafe extern fn(c_int, *mut ::X509_STORE_CTX) -> c_int>,
|
verify_callback: Option<unsafe extern "C" fn(c_int, *mut ::X509_STORE_CTX) -> c_int>,
|
||||||
info_callback: Option<unsafe extern fn(*mut SSL, c_int, c_int)>,
|
info_callback: Option<unsafe extern "C" fn(*mut SSL, c_int, c_int)>,
|
||||||
error: c_int,
|
error: c_int,
|
||||||
error_code: c_int,
|
error_code: c_int,
|
||||||
ctx: *mut ::SSL_CTX,
|
ctx: *mut ::SSL_CTX,
|
||||||
|
|
@ -63,7 +69,8 @@ pub struct SSL {
|
||||||
first_packet: c_int,
|
first_packet: c_int,
|
||||||
client_version: c_int,
|
client_version: c_int,
|
||||||
max_send_fragment: c_uint,
|
max_send_fragment: c_uint,
|
||||||
tlsext_debug_cb: Option<unsafe extern fn(*mut SSL, c_int, c_int, *mut c_uchar, c_int, *mut c_void)>,
|
tlsext_debug_cb:
|
||||||
|
Option<unsafe extern "C" fn(*mut SSL, c_int, c_int, *mut c_uchar, c_int, *mut c_void)>,
|
||||||
tlsext_debug_arg: *mut c_void,
|
tlsext_debug_arg: *mut c_void,
|
||||||
tlsext_hostname: *mut c_char,
|
tlsext_hostname: *mut c_char,
|
||||||
servername_done: c_int,
|
servername_done: c_int,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ pub struct SSL_CTX {
|
||||||
pub struct SSL_SESSION {
|
pub struct SSL_SESSION {
|
||||||
ssl_version: c_int,
|
ssl_version: c_int,
|
||||||
pub master_key_length: c_int,
|
pub master_key_length: c_int,
|
||||||
pub master_key: [c_uchar; 48 /*::SSL_MAX_MASTER_KEY_LENGTH as usize */],
|
pub master_key: [c_uchar; 48],
|
||||||
session_id_length: c_uint,
|
session_id_length: c_uint,
|
||||||
session_id: [c_uchar; ::SSL_MAX_SSL_SESSION_ID_LENGTH as usize],
|
session_id: [c_uchar; ::SSL_MAX_SSL_SESSION_ID_LENGTH as usize],
|
||||||
sid_ctx_length: c_uint,
|
sid_ctx_length: c_uint,
|
||||||
|
|
|
||||||
|
|
@ -58,21 +58,21 @@ pub struct _STACK {
|
||||||
pub data: *mut *mut c_char,
|
pub data: *mut *mut c_char,
|
||||||
pub sorted: c_int,
|
pub sorted: c_int,
|
||||||
pub num_alloc: c_int,
|
pub num_alloc: c_int,
|
||||||
pub comp: Option<unsafe extern fn(*const c_void, *const c_void) -> c_int>,
|
pub comp: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BIO_METHOD {
|
pub struct BIO_METHOD {
|
||||||
pub type_: c_int,
|
pub type_: c_int,
|
||||||
pub name: *const c_char,
|
pub name: *const c_char,
|
||||||
pub bwrite: Option<unsafe extern fn(*mut ::BIO, *const c_char, c_int) -> c_int>,
|
pub bwrite: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char, c_int) -> c_int>,
|
||||||
pub bread: Option<unsafe extern fn(*mut ::BIO, *mut 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 fn(*mut ::BIO, *const c_char) -> c_int>,
|
pub bputs: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char) -> c_int>,
|
||||||
pub bgets: Option<unsafe extern fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
|
pub bgets: Option<unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
|
||||||
pub ctrl: Option<unsafe extern fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long>,
|
pub ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long>,
|
||||||
pub create: Option<unsafe extern fn(*mut ::BIO) -> c_int>,
|
pub create: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
|
||||||
pub destroy: Option<unsafe extern fn(*mut ::BIO) -> c_int>,
|
pub destroy: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
|
||||||
pub callback_ctrl: Option<unsafe extern fn(*mut ::BIO, c_int, ::bio_info_cb) -> c_long>,
|
pub callback_ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, ::bio_info_cb) -> c_long>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -141,7 +141,7 @@ pub struct EVP_PKEY {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BIO {
|
pub struct BIO {
|
||||||
pub method: *mut ::BIO_METHOD,
|
pub method: *mut ::BIO_METHOD,
|
||||||
pub callback: Option<unsafe extern fn(*mut ::BIO,
|
pub callback: Option<unsafe extern "C" fn(*mut ::BIO,
|
||||||
c_int,
|
c_int,
|
||||||
*const c_char,
|
*const c_char,
|
||||||
c_int,
|
c_int,
|
||||||
|
|
@ -176,7 +176,7 @@ pub struct EVP_MD_CTX {
|
||||||
flags: c_ulong,
|
flags: c_ulong,
|
||||||
md_data: *mut c_void,
|
md_data: *mut c_void,
|
||||||
pctx: *mut ::EVP_PKEY_CTX,
|
pctx: *mut ::EVP_PKEY_CTX,
|
||||||
update: *mut c_void
|
update: *mut c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -186,24 +186,23 @@ pub struct EVP_CIPHER {
|
||||||
pub key_len: c_int,
|
pub key_len: c_int,
|
||||||
pub iv_len: c_int,
|
pub iv_len: c_int,
|
||||||
pub flags: c_ulong,
|
pub flags: c_ulong,
|
||||||
pub init: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub init: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX,
|
||||||
*const c_uchar,
|
*const c_uchar,
|
||||||
*const c_uchar,
|
*const c_uchar,
|
||||||
c_int) -> c_int>,
|
c_int)
|
||||||
pub do_cipher: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
-> c_int>,
|
||||||
*mut c_uchar,
|
pub do_cipher: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX,
|
||||||
*const c_uchar,
|
*mut c_uchar,
|
||||||
size_t) -> c_int>,
|
*const c_uchar,
|
||||||
pub cleanup: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX) -> c_int>,
|
size_t)
|
||||||
|
-> c_int>,
|
||||||
|
pub cleanup: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX) -> c_int>,
|
||||||
pub ctx_size: c_int,
|
pub ctx_size: c_int,
|
||||||
pub set_asn1_parameters: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub set_asn1_parameters:
|
||||||
*mut ::ASN1_TYPE) -> c_int>,
|
Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, *mut ::ASN1_TYPE) -> c_int>,
|
||||||
pub get_asn1_parameters: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub get_asn1_parameters:
|
||||||
*mut ::ASN1_TYPE) -> c_int>,
|
Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, *mut ::ASN1_TYPE) -> c_int>,
|
||||||
pub ctrl: Option<unsafe extern fn(*mut ::EVP_CIPHER_CTX,
|
pub ctrl: Option<unsafe extern "C" fn(*mut ::EVP_CIPHER_CTX, c_int, c_int, *mut c_void) -> c_int>,
|
||||||
c_int,
|
|
||||||
c_int,
|
|
||||||
*mut c_void) -> c_int>,
|
|
||||||
pub app_data: *mut c_void,
|
pub app_data: *mut c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,7 +213,7 @@ pub struct HMAC_CTX {
|
||||||
i_ctx: ::EVP_MD_CTX,
|
i_ctx: ::EVP_MD_CTX,
|
||||||
o_ctx: ::EVP_MD_CTX,
|
o_ctx: ::EVP_MD_CTX,
|
||||||
key_length: c_uint,
|
key_length: c_uint,
|
||||||
key: [c_uchar; 128]
|
key: [c_uchar; 128],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -318,7 +317,7 @@ pub struct X509_REQ_INFO {
|
||||||
pub version: *mut ::ASN1_INTEGER,
|
pub version: *mut ::ASN1_INTEGER,
|
||||||
pub subject: *mut ::X509_NAME,
|
pub subject: *mut ::X509_NAME,
|
||||||
pubkey: *mut c_void,
|
pubkey: *mut c_void,
|
||||||
pub attributes: *mut stack_st_X509_ATTRIBUTE
|
pub attributes: *mut stack_st_X509_ATTRIBUTE,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -326,7 +325,7 @@ pub struct X509_REQ {
|
||||||
pub req_info: *mut X509_REQ_INFO,
|
pub req_info: *mut X509_REQ_INFO,
|
||||||
sig_alg: *mut c_void,
|
sig_alg: *mut c_void,
|
||||||
signature: *mut c_void,
|
signature: *mut c_void,
|
||||||
references: c_int
|
references: c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -339,7 +338,7 @@ pub struct SSL {
|
||||||
bbio: *mut c_void,
|
bbio: *mut c_void,
|
||||||
rwstate: c_int,
|
rwstate: c_int,
|
||||||
in_handshake: c_int,
|
in_handshake: c_int,
|
||||||
handshake_func: Option<unsafe extern fn(*mut SSL) -> c_int>,
|
handshake_func: Option<unsafe extern "C" fn(*mut SSL) -> c_int>,
|
||||||
pub server: c_int,
|
pub server: c_int,
|
||||||
new_session: c_int,
|
new_session: c_int,
|
||||||
quiet_session: c_int,
|
quiet_session: c_int,
|
||||||
|
|
@ -356,7 +355,13 @@ pub struct SSL {
|
||||||
s3: *mut c_void,
|
s3: *mut c_void,
|
||||||
d1: *mut c_void,
|
d1: *mut c_void,
|
||||||
read_ahead: c_int,
|
read_ahead: c_int,
|
||||||
msg_callback: Option<unsafe extern fn(c_int, c_int, c_int, *const c_void, size_t, *mut SSL, *mut c_void)>,
|
msg_callback: Option<unsafe extern "C" fn(c_int,
|
||||||
|
c_int,
|
||||||
|
c_int,
|
||||||
|
*const c_void,
|
||||||
|
size_t,
|
||||||
|
*mut SSL,
|
||||||
|
*mut c_void)>,
|
||||||
msg_callback_arg: *mut c_void,
|
msg_callback_arg: *mut c_void,
|
||||||
hit: c_int,
|
hit: c_int,
|
||||||
param: *mut c_void,
|
param: *mut c_void,
|
||||||
|
|
@ -375,16 +380,23 @@ pub struct SSL {
|
||||||
session: *mut ::SSL_SESSION,
|
session: *mut ::SSL_SESSION,
|
||||||
generate_session_id: ::GEN_SESSION_CB,
|
generate_session_id: ::GEN_SESSION_CB,
|
||||||
verify_mode: c_int,
|
verify_mode: c_int,
|
||||||
verify_callback: Option<unsafe extern fn(c_int, *mut ::X509_STORE_CTX) -> c_int>,
|
verify_callback: Option<unsafe extern "C" fn(c_int, *mut ::X509_STORE_CTX) -> c_int>,
|
||||||
info_callback: Option<unsafe extern fn(*mut SSL, c_int, c_int)>,
|
info_callback: Option<unsafe extern "C" fn(*mut SSL, c_int, c_int)>,
|
||||||
error: c_int,
|
error: c_int,
|
||||||
error_code: c_int,
|
error_code: c_int,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_KRB5"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_KRB5"))]
|
||||||
kssl_ctx: *mut c_void,
|
kssl_ctx: *mut c_void,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
|
||||||
psk_client_callback: Option<unsafe extern fn(*mut SSL, *const c_char, *mut c_char, c_uint, *mut c_uchar, c_uint) -> c_uint>,
|
psk_client_callback: Option<unsafe extern "C" fn(*mut SSL,
|
||||||
|
*const c_char,
|
||||||
|
*mut c_char,
|
||||||
|
c_uint,
|
||||||
|
*mut c_uchar,
|
||||||
|
c_uint)
|
||||||
|
-> c_uint>,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
|
||||||
psk_server_callback: Option<unsafe extern fn(*mut SSL, *const c_char, *mut c_uchar, c_uint) -> c_uint>,
|
psk_server_callback:
|
||||||
|
Option<unsafe extern "C" fn(*mut SSL, *const c_char, *mut c_uchar, c_uint) -> c_uint>,
|
||||||
ctx: *mut ::SSL_CTX,
|
ctx: *mut ::SSL_CTX,
|
||||||
debug: c_int,
|
debug: c_int,
|
||||||
verify_result: c_long,
|
verify_result: c_long,
|
||||||
|
|
@ -398,7 +410,8 @@ pub struct SSL {
|
||||||
client_version: c_int,
|
client_version: c_int,
|
||||||
max_send_fragment: c_uint,
|
max_send_fragment: c_uint,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
||||||
tlsext_debug_cb: Option<unsafe extern fn(*mut SSL, c_int, c_int, *mut c_uchar, c_int, *mut c_void)>,
|
tlsext_debug_cb:
|
||||||
|
Option<unsafe extern "C" fn(*mut SSL, c_int, c_int, *mut c_uchar, c_int, *mut c_void)>,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
||||||
tlsext_debug_arg: *mut c_void,
|
tlsext_debug_arg: *mut c_void,
|
||||||
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
#[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
|
||||||
|
|
@ -685,16 +698,16 @@ pub const SSL_CTRL_CLEAR_OPTIONS: c_int = 77;
|
||||||
#[cfg(ossl102)]
|
#[cfg(ossl102)]
|
||||||
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
|
pub const SSL_CTRL_SET_ECDH_AUTO: c_int = 94;
|
||||||
|
|
||||||
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x00000001;
|
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x00000001;
|
||||||
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x00000002;
|
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x00000002;
|
||||||
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x00000008;
|
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x00000008;
|
||||||
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x00000020;
|
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x00000020;
|
||||||
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x00000080;
|
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x00000080;
|
||||||
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x00000100;
|
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x00000100;
|
||||||
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x00000200;
|
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x00000200;
|
||||||
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
|
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00080000;
|
||||||
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
|
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00100000;
|
||||||
pub const SSL_OP_NO_SSLv2: c_ulong = 0x01000000;
|
pub const SSL_OP_NO_SSLv2: c_ulong = 0x01000000;
|
||||||
|
|
||||||
pub const SSL_MAX_SSL_SESSION_ID_LENGTH: c_int = 32;
|
pub const SSL_MAX_SSL_SESSION_ID_LENGTH: c_int = 32;
|
||||||
pub const SSL_MAX_SID_CTX_LENGTH: c_int = 32;
|
pub const SSL_MAX_SID_CTX_LENGTH: c_int = 32;
|
||||||
|
|
@ -702,58 +715,58 @@ pub const SSL_MAX_KEY_ARG_LENGTH: c_int = 8;
|
||||||
pub const SSL_MAX_MASTER_KEY_LENGTH: c_int = 48;
|
pub const SSL_MAX_MASTER_KEY_LENGTH: c_int = 48;
|
||||||
pub const SSL_MAX_KRB5_PRINCIPAL_LENGTH: c_int = 256;
|
pub const SSL_MAX_KRB5_PRINCIPAL_LENGTH: c_int = 256;
|
||||||
|
|
||||||
pub const SSLEAY_VERSION : c_int = 0;
|
pub const SSLEAY_VERSION: c_int = 0;
|
||||||
pub const SSLEAY_CFLAGS : c_int = 2;
|
pub const SSLEAY_CFLAGS: c_int = 2;
|
||||||
pub const SSLEAY_BUILT_ON : c_int = 3;
|
pub const SSLEAY_BUILT_ON: c_int = 3;
|
||||||
pub const SSLEAY_PLATFORM : c_int = 4;
|
pub const SSLEAY_PLATFORM: c_int = 4;
|
||||||
pub const SSLEAY_DIR : c_int = 5;
|
pub const SSLEAY_DIR: c_int = 5;
|
||||||
|
|
||||||
pub const CRYPTO_LOCK_X509: c_int = 3;
|
pub const CRYPTO_LOCK_X509: c_int = 3;
|
||||||
pub const CRYPTO_LOCK_SSL_CTX: c_int = 12;
|
pub const CRYPTO_LOCK_SSL_CTX: c_int = 12;
|
||||||
pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
|
pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
|
||||||
|
|
||||||
static mut MUTEXES: *mut Vec<Mutex<()>> = 0 as *mut Vec<Mutex<()>>;
|
static mut MUTEXES: *mut Vec<Mutex<()>> = 0 as *mut Vec<Mutex<()>>;
|
||||||
static mut GUARDS: *mut Vec<Option<MutexGuard<'static, ()>>> = 0 as *mut Vec<Option<MutexGuard<'static, ()>>>;
|
static mut GUARDS: *mut Vec<Option<MutexGuard<'static, ()>>> =
|
||||||
|
0 as *mut Vec<Option<MutexGuard<'static, ()>>>;
|
||||||
|
|
||||||
unsafe extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
|
unsafe extern "C" fn locking_function(mode: c_int, n: c_int, _file: *const c_char, _line: c_int) {
|
||||||
_line: c_int) {
|
|
||||||
let mutex = &(*MUTEXES)[n as usize];
|
let mutex = &(*MUTEXES)[n as usize];
|
||||||
|
|
||||||
if mode & ::CRYPTO_LOCK != 0 {
|
if mode & ::CRYPTO_LOCK != 0 {
|
||||||
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
||||||
} else {
|
} else {
|
||||||
&(*GUARDS)[n as usize].take().expect("lock already unlocked");
|
&(*GUARDS)[n as usize]
|
||||||
|
.take()
|
||||||
|
.expect("lock already unlocked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
static INIT: Once = ONCE_INIT;
|
static INIT: Once = ONCE_INIT;
|
||||||
|
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| unsafe {
|
||||||
unsafe {
|
SSL_library_init();
|
||||||
SSL_library_init();
|
SSL_load_error_strings();
|
||||||
SSL_load_error_strings();
|
OPENSSL_add_all_algorithms_noconf();
|
||||||
OPENSSL_add_all_algorithms_noconf();
|
|
||||||
|
|
||||||
let num_locks = ::CRYPTO_num_locks();
|
let num_locks = ::CRYPTO_num_locks();
|
||||||
let mut mutexes = Box::new(Vec::new());
|
let mut mutexes = Box::new(Vec::new());
|
||||||
for _ in 0..num_locks {
|
for _ in 0..num_locks {
|
||||||
mutexes.push(Mutex::new(()));
|
mutexes.push(Mutex::new(()));
|
||||||
}
|
}
|
||||||
MUTEXES = mem::transmute(mutexes);
|
MUTEXES = mem::transmute(mutexes);
|
||||||
let guards: Box<Vec<Option<MutexGuard<()>>>> =
|
let guards: Box<Vec<Option<MutexGuard<()>>>> =
|
||||||
Box::new((0..num_locks).map(|_| None).collect());
|
Box::new((0..num_locks).map(|_| None).collect());
|
||||||
GUARDS = mem::transmute(guards);
|
GUARDS = mem::transmute(guards);
|
||||||
|
|
||||||
CRYPTO_set_locking_callback(locking_function);
|
CRYPTO_set_locking_callback(locking_function);
|
||||||
set_id_callback();
|
set_id_callback();
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn set_id_callback() {
|
fn set_id_callback() {
|
||||||
unsafe extern fn thread_id() -> c_ulong {
|
unsafe extern "C" fn thread_id() -> c_ulong {
|
||||||
::libc::pthread_self() as c_ulong
|
::libc::pthread_self() as c_ulong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -769,19 +782,25 @@ fn set_id_callback() {}
|
||||||
|
|
||||||
#[cfg(ossl102)]
|
#[cfg(ossl102)]
|
||||||
pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_int) -> c_int {
|
pub unsafe fn SSL_CTX_set_ecdh_auto(ctx: *mut SSL_CTX, onoff: c_int) -> c_int {
|
||||||
::SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ptr::null_mut()) as c_int
|
::SSL_CTX_ctrl(ctx,
|
||||||
|
SSL_CTRL_SET_ECDH_AUTO,
|
||||||
|
onoff as c_long,
|
||||||
|
ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(ossl102)]
|
#[cfg(ossl102)]
|
||||||
pub unsafe fn SSL_set_ecdh_auto(ssl: *mut ::SSL, onoff: c_int) -> c_int {
|
pub unsafe fn SSL_set_ecdh_auto(ssl: *mut ::SSL, onoff: c_int) -> c_int {
|
||||||
::SSL_ctrl(ssl, SSL_CTRL_SET_ECDH_AUTO, onoff as c_long, ptr::null_mut()) as c_int
|
::SSL_ctrl(ssl,
|
||||||
|
SSL_CTRL_SET_ECDH_AUTO,
|
||||||
|
onoff as c_long,
|
||||||
|
ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn SSL_session_reused(ssl: *mut ::SSL) -> c_int {
|
pub unsafe fn SSL_session_reused(ssl: *mut ::SSL) -> c_int {
|
||||||
::SSL_ctrl(ssl, SSL_CTRL_GET_SESSION_REUSED, 0, ptr::null_mut()) as c_int
|
::SSL_ctrl(ssl, SSL_CTRL_GET_SESSION_REUSED, 0, ptr::null_mut()) as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
extern {
|
extern "C" {
|
||||||
pub fn BIO_new(type_: *mut BIO_METHOD) -> *mut BIO;
|
pub fn BIO_new(type_: *mut BIO_METHOD) -> *mut BIO;
|
||||||
pub fn BIO_s_file() -> *mut BIO_METHOD;
|
pub fn BIO_s_file() -> *mut BIO_METHOD;
|
||||||
pub fn BIO_s_mem() -> *mut BIO_METHOD;
|
pub fn BIO_s_mem() -> *mut BIO_METHOD;
|
||||||
|
|
@ -808,10 +827,14 @@ extern {
|
||||||
|
|
||||||
pub fn RSA_generate_key(modsz: c_int,
|
pub fn RSA_generate_key(modsz: c_int,
|
||||||
e: c_ulong,
|
e: c_ulong,
|
||||||
cb: Option<extern fn(c_int, c_int, *mut c_void)>,
|
cb: Option<extern "C" fn(c_int, c_int, *mut c_void)>,
|
||||||
cbarg: *mut c_void) -> *mut RSA;
|
cbarg: *mut c_void)
|
||||||
|
-> *mut RSA;
|
||||||
|
|
||||||
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD, subject: *mut ::X509, issuer: *mut ::X509) -> *mut ::OCSP_CERTID;
|
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD,
|
||||||
|
subject: *mut ::X509,
|
||||||
|
issuer: *mut ::X509)
|
||||||
|
-> *mut ::OCSP_CERTID;
|
||||||
|
|
||||||
pub fn PKCS12_create(pass: *mut c_char,
|
pub fn PKCS12_create(pass: *mut c_char,
|
||||||
friendly_name: *mut c_char,
|
friendly_name: *mut c_char,
|
||||||
|
|
@ -822,7 +845,8 @@ extern {
|
||||||
nid_cert: c_int,
|
nid_cert: c_int,
|
||||||
iter: c_int,
|
iter: c_int,
|
||||||
mac_iter: c_int,
|
mac_iter: c_int,
|
||||||
keytype: c_int) -> *mut PKCS12;
|
keytype: c_int)
|
||||||
|
-> *mut PKCS12;
|
||||||
|
|
||||||
pub fn SSL_library_init() -> c_int;
|
pub fn SSL_library_init() -> c_int;
|
||||||
pub fn SSL_load_error_strings();
|
pub fn SSL_load_error_strings();
|
||||||
|
|
@ -838,50 +862,77 @@ extern {
|
||||||
pub fn DTLSv1_method() -> *const ::SSL_METHOD;
|
pub fn DTLSv1_method() -> *const ::SSL_METHOD;
|
||||||
#[cfg(ossl102)]
|
#[cfg(ossl102)]
|
||||||
pub fn DTLSv1_2_method() -> *const ::SSL_METHOD;
|
pub fn DTLSv1_2_method() -> *const ::SSL_METHOD;
|
||||||
pub fn SSL_get_ex_new_index(argl: c_long, argp: *mut c_void,
|
pub fn SSL_get_ex_new_index(argl: c_long,
|
||||||
|
argp: *mut c_void,
|
||||||
new_func: Option<::CRYPTO_EX_new>,
|
new_func: Option<::CRYPTO_EX_new>,
|
||||||
dup_func: Option<::CRYPTO_EX_dup>,
|
dup_func: Option<::CRYPTO_EX_dup>,
|
||||||
free_func: Option<::CRYPTO_EX_free>)
|
free_func: Option<::CRYPTO_EX_free>)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn SSL_set_tmp_ecdh_callback(ssl: *mut ::SSL,
|
pub fn SSL_set_tmp_ecdh_callback(ssl: *mut ::SSL,
|
||||||
ecdh: unsafe extern fn(ssl: *mut ::SSL,
|
ecdh: unsafe extern "C" fn(ssl: *mut ::SSL,
|
||||||
is_export: c_int,
|
is_export: c_int,
|
||||||
keylength: c_int)
|
keylength: c_int)
|
||||||
-> *mut ::EC_KEY);
|
-> *mut ::EC_KEY);
|
||||||
pub fn SSL_CIPHER_get_version(cipher: *const ::SSL_CIPHER) -> *mut c_char;
|
pub fn SSL_CIPHER_get_version(cipher: *const ::SSL_CIPHER) -> *mut c_char;
|
||||||
pub fn SSL_CTX_get_ex_new_index(argl: c_long, argp: *mut c_void,
|
pub fn SSL_CTX_get_ex_new_index(argl: c_long,
|
||||||
|
argp: *mut c_void,
|
||||||
new_func: Option<::CRYPTO_EX_new>,
|
new_func: Option<::CRYPTO_EX_new>,
|
||||||
dup_func: Option<::CRYPTO_EX_dup>,
|
dup_func: Option<::CRYPTO_EX_dup>,
|
||||||
free_func: Option<::CRYPTO_EX_free>)
|
free_func: Option<::CRYPTO_EX_free>)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn SSL_CTX_set_tmp_ecdh_callback(ctx: *mut ::SSL_CTX,
|
pub fn SSL_CTX_set_tmp_ecdh_callback(ctx: *mut ::SSL_CTX,
|
||||||
ecdh: unsafe extern fn(ssl: *mut ::SSL,
|
ecdh: unsafe extern "C" fn(ssl: *mut ::SSL,
|
||||||
is_export: c_int,
|
is_export: c_int,
|
||||||
keylength: c_int)
|
keylength: c_int)
|
||||||
-> *mut ::EC_KEY);
|
-> *mut ::EC_KEY);
|
||||||
pub fn X509_get_subject_name(x: *mut ::X509) -> *mut ::X509_NAME;
|
pub fn X509_get_subject_name(x: *mut ::X509) -> *mut ::X509_NAME;
|
||||||
pub fn X509_set_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_set_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_get_ext_d2i(x: *mut ::X509, nid: c_int, crit: *mut c_int, idx: *mut c_int) -> *mut c_void;
|
pub fn X509_get_ext_d2i(x: *mut ::X509,
|
||||||
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME, field: c_int, ty: c_int, bytes: *mut c_uchar, len: c_int, loc: c_int, set: c_int) -> c_int;
|
nid: c_int,
|
||||||
|
crit: *mut c_int,
|
||||||
|
idx: *mut c_int)
|
||||||
|
-> *mut c_void;
|
||||||
|
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME,
|
||||||
|
field: c_int,
|
||||||
|
ty: c_int,
|
||||||
|
bytes: *mut c_uchar,
|
||||||
|
len: c_int,
|
||||||
|
loc: c_int,
|
||||||
|
set: c_int)
|
||||||
|
-> c_int;
|
||||||
#[cfg(not(ossl101))]
|
#[cfg(not(ossl101))]
|
||||||
pub fn X509_get0_signature(psig: *mut *mut ::ASN1_BIT_STRING, palg: *mut *mut ::X509_ALGOR, x: *const ::X509);
|
pub fn X509_get0_signature(psig: *mut *mut ::ASN1_BIT_STRING,
|
||||||
|
palg: *mut *mut ::X509_ALGOR,
|
||||||
|
x: *const ::X509);
|
||||||
#[cfg(not(ossl101))]
|
#[cfg(not(ossl101))]
|
||||||
pub fn X509_get_signature_nid(x: *const X509) -> c_int;
|
pub fn X509_get_signature_nid(x: *const X509) -> c_int;
|
||||||
#[cfg(not(ossl101))]
|
#[cfg(not(ossl101))]
|
||||||
pub fn X509_ALGOR_get0(paobj: *mut *mut ::ASN1_OBJECT, pptype: *mut c_int, ppval: *mut *mut c_void, alg: *mut ::X509_ALGOR);
|
pub fn X509_ALGOR_get0(paobj: *mut *mut ::ASN1_OBJECT,
|
||||||
|
pptype: *mut c_int,
|
||||||
|
ppval: *mut *mut c_void,
|
||||||
|
alg: *mut ::X509_ALGOR);
|
||||||
pub fn X509_NAME_get_entry(n: *mut ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
pub fn X509_NAME_get_entry(n: *mut ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
||||||
pub fn X509_NAME_ENTRY_get_data(ne: *mut ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
pub fn X509_NAME_ENTRY_get_data(ne: *mut ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
||||||
pub fn X509_STORE_CTX_get_chain(ctx: *mut ::X509_STORE_CTX) -> *mut stack_st_X509;
|
pub fn X509_STORE_CTX_get_chain(ctx: *mut ::X509_STORE_CTX) -> *mut stack_st_X509;
|
||||||
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, ext_nid: c_int, value: *mut c_char) -> *mut ::X509_EXTENSION;
|
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF,
|
||||||
pub fn X509V3_EXT_nconf(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, name: *mut c_char, value: *mut c_char) -> *mut ::X509_EXTENSION;
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
ext_nid: c_int,
|
||||||
|
value: *mut c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
|
pub fn X509V3_EXT_nconf(conf: *mut ::CONF,
|
||||||
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
name: *mut c_char,
|
||||||
|
value: *mut c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ::ASN1_STRING) -> c_int;
|
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ::ASN1_STRING) -> c_int;
|
||||||
pub fn ASN1_STRING_data(x: *mut ::ASN1_STRING) -> *mut c_uchar;
|
pub fn ASN1_STRING_data(x: *mut ::ASN1_STRING) -> *mut c_uchar;
|
||||||
pub fn CRYPTO_add_lock(pointer: *mut c_int,
|
pub fn CRYPTO_add_lock(pointer: *mut c_int,
|
||||||
amount: c_int,
|
amount: c_int,
|
||||||
type_: c_int,
|
type_: c_int,
|
||||||
file: *const c_char,
|
file: *const c_char,
|
||||||
line: c_int) -> c_int;
|
line: c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
|
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
|
||||||
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
|
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
|
||||||
pub fn EVP_PKEY_bits(key: *mut EVP_PKEY) -> c_int;
|
pub fn EVP_PKEY_bits(key: *mut EVP_PKEY) -> c_int;
|
||||||
|
|
@ -891,7 +942,7 @@ extern {
|
||||||
pub fn sk_value(st: *const _STACK, n: c_int) -> *mut c_void;
|
pub fn sk_value(st: *const _STACK, n: c_int) -> *mut c_void;
|
||||||
pub fn sk_free(st: *mut _STACK);
|
pub fn sk_free(st: *mut _STACK);
|
||||||
pub fn sk_push(st: *mut _STACK, data: *mut c_void) -> c_int;
|
pub fn sk_push(st: *mut _STACK, data: *mut c_void) -> c_int;
|
||||||
pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn (*mut c_void)>);
|
pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn(*mut c_void)>);
|
||||||
pub fn sk_pop(st: *mut _STACK) -> *mut c_void;
|
pub fn sk_pop(st: *mut _STACK) -> *mut c_void;
|
||||||
|
|
||||||
pub fn SSLeay() -> c_ulong;
|
pub fn SSLeay() -> c_ulong;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
use libc::{c_int, c_void, c_char, c_uchar, c_ulong, c_long, c_uint, size_t};
|
use libc::{c_int, c_void, c_char, c_uchar, c_ulong, c_long, c_uint, size_t};
|
||||||
|
use std::sync::{Once, ONCE_INIT};
|
||||||
|
use std::ptr;
|
||||||
|
|
||||||
pub enum BIGNUM {}
|
pub enum BIGNUM {}
|
||||||
pub enum BIO {}
|
pub enum BIO {}
|
||||||
|
|
@ -25,21 +27,22 @@ pub enum stack_st_X509_NAME {}
|
||||||
pub enum stack_st_X509_ATTRIBUTE {}
|
pub enum stack_st_X509_ATTRIBUTE {}
|
||||||
pub enum stack_st_X509_EXTENSION {}
|
pub enum stack_st_X509_EXTENSION {}
|
||||||
pub enum stack_st_SSL_CIPHER {}
|
pub enum stack_st_SSL_CIPHER {}
|
||||||
|
pub enum OPENSSL_INIT_SETTINGS {}
|
||||||
pub enum X509 {}
|
pub enum X509 {}
|
||||||
pub enum X509_ALGOR {}
|
pub enum X509_ALGOR {}
|
||||||
pub enum X509_VERIFY_PARAM {}
|
pub enum X509_VERIFY_PARAM {}
|
||||||
pub enum X509_REQ {}
|
pub enum X509_REQ {}
|
||||||
|
|
||||||
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_MICROSOFT_SESS_ID_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_NETSCAPE_CHALLENGE_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x00000000;
|
pub const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_TLS_D5_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x00000000;
|
pub const SSL_OP_TLS_BLOCK_PADDING_BUG: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00000000;
|
pub const SSL_OP_SINGLE_ECDH_USE: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00000000;
|
pub const SSL_OP_SINGLE_DH_USE: c_ulong = 0x00000000;
|
||||||
pub const SSL_OP_NO_SSLv2: c_ulong = 0x00000000;
|
pub const SSL_OP_NO_SSLv2: c_ulong = 0x00000000;
|
||||||
|
|
||||||
pub const OPENSSL_VERSION: c_int = 0;
|
pub const OPENSSL_VERSION: c_int = 0;
|
||||||
pub const OPENSSL_CFLAGS: c_int = 1;
|
pub const OPENSSL_CFLAGS: c_int = 1;
|
||||||
|
|
@ -50,11 +53,20 @@ pub const OPENSSL_DIR: c_int = 4;
|
||||||
pub const CRYPTO_EX_INDEX_SSL: c_int = 0;
|
pub const CRYPTO_EX_INDEX_SSL: c_int = 0;
|
||||||
pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1;
|
pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1;
|
||||||
|
|
||||||
|
pub const OPENSSL_INIT_LOAD_SSL_STRINGS: u64 = 0x00200000;
|
||||||
|
|
||||||
pub const X509_CHECK_FLAG_NEVER_CHECK_SUBJECT: c_uint = 0x20;
|
pub const X509_CHECK_FLAG_NEVER_CHECK_SUBJECT: c_uint = 0x20;
|
||||||
|
|
||||||
pub fn init() {}
|
pub fn init() {
|
||||||
|
// explicitly initialize to work around https://github.com/openssl/openssl/issues/3505
|
||||||
|
static INIT: Once = ONCE_INIT;
|
||||||
|
|
||||||
extern {
|
INIT.call_once(|| unsafe {
|
||||||
|
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, ptr::null_mut());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
pub fn BIO_new(type_: *const BIO_METHOD) -> *mut BIO;
|
pub fn BIO_new(type_: *const BIO_METHOD) -> *mut BIO;
|
||||||
pub fn BIO_s_file() -> *const BIO_METHOD;
|
pub fn BIO_s_file() -> *const BIO_METHOD;
|
||||||
pub fn BIO_s_mem() -> *const BIO_METHOD;
|
pub fn BIO_s_mem() -> *const BIO_METHOD;
|
||||||
|
|
@ -77,7 +89,10 @@ extern {
|
||||||
pub fn HMAC_CTX_new() -> *mut HMAC_CTX;
|
pub fn HMAC_CTX_new() -> *mut HMAC_CTX;
|
||||||
pub fn HMAC_CTX_free(ctx: *mut HMAC_CTX);
|
pub fn HMAC_CTX_free(ctx: *mut HMAC_CTX);
|
||||||
|
|
||||||
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD, subject: *const ::X509, issuer: *const ::X509) -> *mut ::OCSP_CERTID;
|
pub fn OCSP_cert_to_id(dgst: *const ::EVP_MD,
|
||||||
|
subject: *const ::X509,
|
||||||
|
issuer: *const ::X509)
|
||||||
|
-> *mut ::OCSP_CERTID;
|
||||||
|
|
||||||
pub fn TLS_method() -> *const ::SSL_METHOD;
|
pub fn TLS_method() -> *const ::SSL_METHOD;
|
||||||
pub fn DTLS_method() -> *const ::SSL_METHOD;
|
pub fn DTLS_method() -> *const ::SSL_METHOD;
|
||||||
|
|
@ -85,20 +100,52 @@ extern {
|
||||||
pub fn X509_get_subject_name(x: *const ::X509) -> *mut ::X509_NAME;
|
pub fn X509_get_subject_name(x: *const ::X509) -> *mut ::X509_NAME;
|
||||||
pub fn X509_set1_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set1_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_set1_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
pub fn X509_set1_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int;
|
||||||
pub fn X509_get_ext_d2i(x: *const ::X509, nid: c_int, crit: *mut c_int, idx: *mut c_int) -> *mut c_void;
|
pub fn X509_get_ext_d2i(x: *const ::X509,
|
||||||
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME, field: c_int, ty: c_int, bytes: *const c_uchar, len: c_int, loc: c_int, set: c_int) -> c_int;
|
nid: c_int,
|
||||||
|
crit: *mut c_int,
|
||||||
|
idx: *mut c_int)
|
||||||
|
-> *mut c_void;
|
||||||
|
pub fn X509_NAME_add_entry_by_NID(x: *mut ::X509_NAME,
|
||||||
|
field: c_int,
|
||||||
|
ty: c_int,
|
||||||
|
bytes: *const c_uchar,
|
||||||
|
len: c_int,
|
||||||
|
loc: c_int,
|
||||||
|
set: c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn X509_get_signature_nid(x: *const X509) -> c_int;
|
pub fn X509_get_signature_nid(x: *const X509) -> c_int;
|
||||||
pub fn X509_ALGOR_get0(paobj: *mut *const ::ASN1_OBJECT, pptype: *mut c_int, ppval: *mut *const c_void, alg: *const ::X509_ALGOR);
|
pub fn X509_ALGOR_get0(paobj: *mut *const ::ASN1_OBJECT,
|
||||||
|
pptype: *mut c_int,
|
||||||
|
ppval: *mut *const c_void,
|
||||||
|
alg: *const ::X509_ALGOR);
|
||||||
pub fn X509_NAME_get_entry(n: *const ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
pub fn X509_NAME_get_entry(n: *const ::X509_NAME, loc: c_int) -> *mut ::X509_NAME_ENTRY;
|
||||||
pub fn X509_NAME_ENTRY_get_data(ne: *const ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
pub fn X509_NAME_ENTRY_get_data(ne: *const ::X509_NAME_ENTRY) -> *mut ::ASN1_STRING;
|
||||||
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, ext_nid: c_int, value: *const c_char) -> *mut ::X509_EXTENSION;
|
pub fn X509V3_EXT_nconf_nid(conf: *mut ::CONF,
|
||||||
pub fn X509V3_EXT_nconf(conf: *mut ::CONF, ctx: *mut ::X509V3_CTX, name: *const c_char, value: *const c_char) -> *mut ::X509_EXTENSION;
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
ext_nid: c_int,
|
||||||
|
value: *const c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
|
pub fn X509V3_EXT_nconf(conf: *mut ::CONF,
|
||||||
|
ctx: *mut ::X509V3_CTX,
|
||||||
|
name: *const c_char,
|
||||||
|
value: *const c_char)
|
||||||
|
-> *mut ::X509_EXTENSION;
|
||||||
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *const ::ASN1_STRING) -> c_int;
|
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *const ::ASN1_STRING) -> c_int;
|
||||||
pub fn BN_is_negative(b: *const ::BIGNUM) -> c_int;
|
pub fn BN_is_negative(b: *const ::BIGNUM) -> c_int;
|
||||||
pub fn EVP_CIPHER_key_length(cipher: *const EVP_CIPHER) -> c_int;
|
pub fn EVP_CIPHER_key_length(cipher: *const EVP_CIPHER) -> c_int;
|
||||||
pub fn EVP_CIPHER_block_size(cipher: *const EVP_CIPHER) -> c_int;
|
pub fn EVP_CIPHER_block_size(cipher: *const EVP_CIPHER) -> c_int;
|
||||||
pub fn EVP_CIPHER_iv_length(cipher: *const EVP_CIPHER) -> c_int;
|
pub fn EVP_CIPHER_iv_length(cipher: *const EVP_CIPHER) -> c_int;
|
||||||
pub fn EVP_PBE_scrypt(pass: *const c_char, passlen: size_t, salt: *const c_uchar, saltlen: size_t, N: u64, r: u64, p: u64, maxmem: u64, key: *mut c_uchar, keylen: size_t) -> c_int;
|
pub fn EVP_PBE_scrypt(pass: *const c_char,
|
||||||
|
passlen: size_t,
|
||||||
|
salt: *const c_uchar,
|
||||||
|
saltlen: size_t,
|
||||||
|
N: u64,
|
||||||
|
r: u64,
|
||||||
|
p: u64,
|
||||||
|
maxmem: u64,
|
||||||
|
key: *mut c_uchar,
|
||||||
|
keylen: size_t)
|
||||||
|
-> c_int;
|
||||||
pub fn DSA_get0_pqg(d: *const ::DSA,
|
pub fn DSA_get0_pqg(d: *const ::DSA,
|
||||||
p: *mut *const ::BIGNUM,
|
p: *mut *const ::BIGNUM,
|
||||||
q: *mut *const ::BIGNUM,
|
q: *mut *const ::BIGNUM,
|
||||||
|
|
@ -110,59 +157,59 @@ extern {
|
||||||
n: *mut *const ::BIGNUM,
|
n: *mut *const ::BIGNUM,
|
||||||
e: *mut *const ::BIGNUM,
|
e: *mut *const ::BIGNUM,
|
||||||
d: *mut *const ::BIGNUM);
|
d: *mut *const ::BIGNUM);
|
||||||
pub fn RSA_get0_factors(r: *const ::RSA,
|
pub fn RSA_get0_factors(r: *const ::RSA, p: *mut *const ::BIGNUM, q: *mut *const ::BIGNUM);
|
||||||
p: *mut *const ::BIGNUM,
|
|
||||||
q: *mut *const ::BIGNUM);
|
|
||||||
pub fn RSA_set0_key(r: *mut ::RSA,
|
pub fn RSA_set0_key(r: *mut ::RSA,
|
||||||
n: *mut ::BIGNUM,
|
n: *mut ::BIGNUM,
|
||||||
e: *mut ::BIGNUM,
|
e: *mut ::BIGNUM,
|
||||||
d: *mut ::BIGNUM) -> c_int;
|
d: *mut ::BIGNUM)
|
||||||
pub fn RSA_set0_factors(r: *mut ::RSA,
|
-> c_int;
|
||||||
p: *mut ::BIGNUM,
|
pub fn RSA_set0_factors(r: *mut ::RSA, p: *mut ::BIGNUM, q: *mut ::BIGNUM) -> c_int;
|
||||||
q: *mut ::BIGNUM) -> c_int;
|
|
||||||
pub fn RSA_set0_crt_params(r: *mut ::RSA,
|
pub fn RSA_set0_crt_params(r: *mut ::RSA,
|
||||||
dmp1: *mut ::BIGNUM,
|
dmp1: *mut ::BIGNUM,
|
||||||
dmq1: *mut ::BIGNUM,
|
dmq1: *mut ::BIGNUM,
|
||||||
iqmp: *mut ::BIGNUM) -> c_int;
|
iqmp: *mut ::BIGNUM)
|
||||||
|
-> c_int;
|
||||||
pub fn ASN1_STRING_get0_data(x: *const ::ASN1_STRING) -> *const c_uchar;
|
pub fn ASN1_STRING_get0_data(x: *const ::ASN1_STRING) -> *const c_uchar;
|
||||||
pub fn OPENSSL_sk_num(stack: *const ::OPENSSL_STACK) -> c_int;
|
pub fn OPENSSL_sk_num(stack: *const ::OPENSSL_STACK) -> c_int;
|
||||||
pub fn OPENSSL_sk_value(stack: *const ::OPENSSL_STACK,
|
pub fn OPENSSL_sk_value(stack: *const ::OPENSSL_STACK, idx: c_int) -> *mut c_void;
|
||||||
idx: c_int) -> *mut c_void;
|
|
||||||
pub fn SSL_CTX_get_options(ctx: *const ::SSL_CTX) -> c_ulong;
|
pub fn SSL_CTX_get_options(ctx: *const ::SSL_CTX) -> c_ulong;
|
||||||
pub fn SSL_CTX_set_options(ctx: *mut ::SSL_CTX, op: c_ulong) -> c_ulong;
|
pub fn SSL_CTX_set_options(ctx: *mut ::SSL_CTX, op: c_ulong) -> c_ulong;
|
||||||
pub fn SSL_CTX_clear_options(ctx: *mut ::SSL_CTX, op: c_ulong) -> c_ulong;
|
pub fn SSL_CTX_clear_options(ctx: *mut ::SSL_CTX, op: c_ulong) -> c_ulong;
|
||||||
pub fn X509_getm_notAfter(x: *const ::X509) -> *mut ::ASN1_TIME;
|
pub fn X509_getm_notAfter(x: *const ::X509) -> *mut ::ASN1_TIME;
|
||||||
pub fn X509_getm_notBefore(x: *const ::X509) -> *mut ::ASN1_TIME;
|
pub fn X509_getm_notBefore(x: *const ::X509) -> *mut ::ASN1_TIME;
|
||||||
pub fn X509_get0_signature(psig: *mut *const ::ASN1_BIT_STRING, palg: *mut *const ::X509_ALGOR, x: *const ::X509);
|
pub fn X509_get0_signature(psig: *mut *const ::ASN1_BIT_STRING,
|
||||||
|
palg: *mut *const ::X509_ALGOR,
|
||||||
|
x: *const ::X509);
|
||||||
pub fn DH_set0_pqg(dh: *mut ::DH,
|
pub fn DH_set0_pqg(dh: *mut ::DH,
|
||||||
p: *mut ::BIGNUM,
|
p: *mut ::BIGNUM,
|
||||||
q: *mut ::BIGNUM,
|
q: *mut ::BIGNUM,
|
||||||
g: *mut ::BIGNUM) -> c_int;
|
g: *mut ::BIGNUM)
|
||||||
|
-> c_int;
|
||||||
pub fn BIO_set_init(a: *mut ::BIO, init: c_int);
|
pub fn BIO_set_init(a: *mut ::BIO, init: c_int);
|
||||||
pub fn BIO_set_data(a: *mut ::BIO, data: *mut c_void);
|
pub fn BIO_set_data(a: *mut ::BIO, data: *mut c_void);
|
||||||
pub fn BIO_get_data(a: *mut ::BIO) -> *mut c_void;
|
pub fn BIO_get_data(a: *mut ::BIO) -> *mut c_void;
|
||||||
pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut ::BIO_METHOD;
|
pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut ::BIO_METHOD;
|
||||||
pub fn BIO_meth_free(biom: *mut ::BIO_METHOD);
|
pub fn BIO_meth_free(biom: *mut ::BIO_METHOD);
|
||||||
pub fn BIO_meth_set_write(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_write(biom: *mut ::BIO_METHOD,
|
||||||
write: unsafe extern fn(*mut ::BIO,
|
write: unsafe extern "C" fn(*mut ::BIO, *const c_char, c_int)
|
||||||
*const c_char,
|
-> c_int)
|
||||||
c_int) -> c_int) -> c_int;
|
-> c_int;
|
||||||
pub fn BIO_meth_set_read(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_read(biom: *mut ::BIO_METHOD,
|
||||||
read: unsafe extern fn(*mut ::BIO,
|
read: unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int)
|
||||||
*mut c_char,
|
-> c_int;
|
||||||
c_int) -> c_int) -> c_int;
|
|
||||||
pub fn BIO_meth_set_puts(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_puts(biom: *mut ::BIO_METHOD,
|
||||||
read: unsafe extern fn(*mut ::BIO,
|
read: unsafe extern "C" fn(*mut ::BIO, *const c_char) -> c_int)
|
||||||
*const c_char) -> c_int) -> c_int;
|
-> c_int;
|
||||||
pub fn BIO_meth_set_ctrl(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_ctrl(biom: *mut ::BIO_METHOD,
|
||||||
read: unsafe extern fn(*mut ::BIO,
|
read: unsafe extern "C" fn(*mut ::BIO, c_int, c_long, *mut c_void)
|
||||||
c_int,
|
-> c_long)
|
||||||
c_long,
|
-> c_int;
|
||||||
*mut c_void) -> c_long) -> c_int;
|
|
||||||
pub fn BIO_meth_set_create(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_create(biom: *mut ::BIO_METHOD,
|
||||||
create: unsafe extern fn(*mut ::BIO) -> c_int) -> c_int;
|
create: unsafe extern "C" fn(*mut ::BIO) -> c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn BIO_meth_set_destroy(biom: *mut ::BIO_METHOD,
|
pub fn BIO_meth_set_destroy(biom: *mut ::BIO_METHOD,
|
||||||
destroy: unsafe extern fn(*mut ::BIO) -> c_int) -> c_int;
|
destroy: unsafe extern "C" fn(*mut ::BIO) -> c_int)
|
||||||
|
-> c_int;
|
||||||
pub fn CRYPTO_get_ex_new_index(class_index: c_int,
|
pub fn CRYPTO_get_ex_new_index(class_index: c_int,
|
||||||
argl: c_long,
|
argl: c_long,
|
||||||
argp: *mut c_void,
|
argp: *mut c_void,
|
||||||
|
|
@ -186,9 +233,11 @@ extern {
|
||||||
|
|
||||||
pub fn OpenSSL_version_num() -> c_ulong;
|
pub fn OpenSSL_version_num() -> c_ulong;
|
||||||
pub fn OpenSSL_version(key: c_int) -> *const c_char;
|
pub fn OpenSSL_version(key: c_int) -> *const c_char;
|
||||||
|
pub fn OPENSSL_init_ssl(opts: u64, settings: *const OPENSSL_INIT_SETTINGS) -> c_int;
|
||||||
pub fn OPENSSL_sk_new_null() -> *mut ::OPENSSL_STACK;
|
pub fn OPENSSL_sk_new_null() -> *mut ::OPENSSL_STACK;
|
||||||
pub fn OPENSSL_sk_free(st: *mut ::OPENSSL_STACK);
|
pub fn OPENSSL_sk_free(st: *mut ::OPENSSL_STACK);
|
||||||
pub fn OPENSSL_sk_pop_free(st: *mut ::OPENSSL_STACK, free: Option<unsafe extern "C" fn (*mut c_void)>);
|
pub fn OPENSSL_sk_pop_free(st: *mut ::OPENSSL_STACK,
|
||||||
|
free: Option<unsafe extern "C" fn(*mut c_void)>);
|
||||||
pub fn OPENSSL_sk_push(st: *mut ::OPENSSL_STACK, data: *const c_void) -> c_int;
|
pub fn OPENSSL_sk_push(st: *mut ::OPENSSL_STACK, data: *const c_void) -> c_int;
|
||||||
pub fn OPENSSL_sk_pop(st: *mut ::OPENSSL_STACK) -> *mut c_void;
|
pub fn OPENSSL_sk_pop(st: *mut ::OPENSSL_STACK) -> *mut c_void;
|
||||||
|
|
||||||
|
|
@ -201,7 +250,8 @@ extern {
|
||||||
nid_cert: c_int,
|
nid_cert: c_int,
|
||||||
iter: c_int,
|
iter: c_int,
|
||||||
mac_iter: c_int,
|
mac_iter: c_int,
|
||||||
keytype: c_int) -> *mut PKCS12;
|
keytype: c_int)
|
||||||
|
-> *mut PKCS12;
|
||||||
pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long;
|
pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long;
|
||||||
pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut ::X509_NAME;
|
pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut ::X509_NAME;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue