From 214c3a60f04da5c5fe6f0722641a1272c795cde2 Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Thu, 15 Oct 2015 08:54:46 -0700 Subject: Expose RSA_generate_key_ex. --- openssl-sys/src/lib.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'openssl-sys') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index bc177959..e26bec0a 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -513,6 +513,7 @@ extern "C" { pub fn RAND_bytes(buf: *mut u8, num: c_int) -> c_int; pub fn RSA_generate_key(modsz: c_int, e: c_ulong, cb: *const c_void, cbarg: *const c_void) -> *mut RSA; + pub fn RSA_generate_key_ex(rsa: *mut RSA, bits: c_int, e: *mut BIGNUM, cb: *const c_void) -> c_int; pub fn RSA_private_decrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int) -> c_int; pub fn RSA_public_encrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, -- cgit v1.2.3 From c37767df8fc1775858cd573cbe4d5e3a17fbd370 Mon Sep 17 00:00:00 2001 From: Jamie Turner Date: Sat, 19 Sep 2015 20:50:06 -0700 Subject: Nonblocking streams support. --- openssl-sys/src/lib.rs | 2 ++ openssl-sys/src/openssl_shim.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'openssl-sys') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index e26bec0a..96da64f3 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -678,6 +678,8 @@ extern "C" { // These functions are defined in OpenSSL as macros, so we shim them #[link_name = "BIO_eof_shim"] pub fn BIO_eof(b: *mut BIO) -> c_int; + #[link_name = "BIO_set_nbio_shim"] + pub fn BIO_set_nbio(b: *mut BIO, enabled: c_long) -> c_long; #[link_name = "BIO_set_mem_eof_return_shim"] pub fn BIO_set_mem_eof_return(b: *mut BIO, v: c_int); pub fn SSL_CTX_set_options_shim(ctx: *mut SSL_CTX, options: c_long) -> c_long; diff --git a/openssl-sys/src/openssl_shim.c b/openssl-sys/src/openssl_shim.c index 8ebe23ac..84adb47b 100644 --- a/openssl-sys/src/openssl_shim.c +++ b/openssl-sys/src/openssl_shim.c @@ -83,6 +83,10 @@ int BIO_eof_shim(BIO *b) { return BIO_eof(b); } +long BIO_set_nbio_shim(BIO *b, long enabled) { + return BIO_set_nbio(b, enabled); +} + void BIO_set_mem_eof_return_shim(BIO *b, int v) { BIO_set_mem_eof_return(b, v); } -- cgit v1.2.3 From 613a9ff7216630bb80d2b905933883155dda6db7 Mon Sep 17 00:00:00 2001 From: Peter Atashian Date: Sun, 25 Oct 2015 05:11:23 -0400 Subject: Explicitly depend on gdi32 and user32 on Windows Since openssl ends up depending on functions from these system libraries, depend on -sys crates that provide these system libraries. --- openssl-sys/Cargo.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 045e15eb..1e32f87c 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -39,3 +39,15 @@ libressl-pnacl-sys = "2.1.0" libressl-pnacl-sys = "2.1.0" [target.arm-unknown-nacl.dependencies] libressl-pnacl-sys = "2.1.0" +[target.i686-pc-windows-gnu] +user32-sys = "*" +gdi32-sys = "*" +[target.x86_64-pc-windows-gnu] +user32-sys = "*" +gdi32-sys = "*" +[target.i686-pc-windows-msvc] +user32-sys = "*" +gdi32-sys = "*" +[target.x86_64-pc-windows-msvc] +user32-sys = "*" +gdi32-sys = "*" -- cgit v1.2.3 From 11e3b1b56317ca1e24cfc1c0a3805123fa73bfb8 Mon Sep 17 00:00:00 2001 From: Thom May Date: Wed, 28 Oct 2015 16:40:05 +0000 Subject: Provide public_decrypt, private_encrypt for PKEY --- openssl-sys/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openssl-sys') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 96da64f3..2aa36a89 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -516,6 +516,10 @@ extern "C" { pub fn RSA_generate_key_ex(rsa: *mut RSA, bits: c_int, e: *mut BIGNUM, cb: *const c_void) -> c_int; pub fn RSA_private_decrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int) -> c_int; + pub fn RSA_public_decrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, + pad: c_int) -> c_int; + pub fn RSA_private_encrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, + pad: c_int) -> c_int; pub fn RSA_public_encrypt(flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int) -> c_int; pub fn RSA_sign(t: c_int, m: *const u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint, -- cgit v1.2.3 From be2cbabdb72850d72deb674d871d0e172309e6aa Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 14 Oct 2015 21:54:00 -0400 Subject: Revert "Revert "Merge pull request #280 from ltratt/libressl_build"" This reverts commit ae3d0e36d71bb121c2fc1a75b3bc6d97f0e61480. --- openssl-sys/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 045e15eb..dd2704f5 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -17,6 +17,7 @@ tlsv1_1 = [] dtlsv1 = [] dtlsv1_2 = [] sslv2 = [] +sslv3 = [] aes_xts = [] aes_ctr = [] npn = [] -- cgit v1.2.3 From 309b6d9f46c3ae97dfe0e0594e1a098149f0b950 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 9 Nov 2015 20:50:22 -0800 Subject: Switch to libc 0.2 --- openssl-sys/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index dd2704f5..365144c1 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -26,7 +26,7 @@ rfc5114 = [] ecdh_auto = [] [dependencies] -libc = "0.1" +libc = "0.2" [build-dependencies] pkg-config = "0.3" -- cgit v1.2.3 From a8a10e64ad21fe900dbeef220493cc31cbeda48e Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 10 Nov 2015 21:32:19 -0800 Subject: Split stuff requiring a shim out to a separate crate --- openssl-sys/Cargo.toml | 1 - openssl-sys/build.rs | 80 +---------------------- openssl-sys/src/lib.rs | 97 +++++++--------------------- openssl-sys/src/openssl_shim.c | 142 ----------------------------------------- openssl-sys/src/ssl_options.rs | 46 ------------- 5 files changed, 24 insertions(+), 342 deletions(-) delete mode 100644 openssl-sys/src/openssl_shim.c delete mode 100644 openssl-sys/src/ssl_options.rs (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 365144c1..6630b1ce 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -23,7 +23,6 @@ aes_ctr = [] npn = [] alpn = [] rfc5114 = [] -ecdh_auto = [] [dependencies] libc = "0.2" diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index aa47f2de..bd9611c0 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -2,10 +2,6 @@ extern crate pkg_config; extern crate gcc; use std::env; -use std::fmt::Write as FmtWrite; -use std::path::PathBuf; -use std::fs::File; -use std::io::Write; fn main() { let target = env::var("TARGET").unwrap(); @@ -20,7 +16,8 @@ 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") { - build_openssl_shim(&info.include_paths); + let paths = env::join_paths(info.include_paths).unwrap(); + println!("cargo:include={}", paths.to_str().unwrap()); return; } } @@ -59,82 +56,9 @@ fn main() { println!("cargo:rustc-link-lib={}={}", mode, lib); } - let mut include_dirs = vec![]; - if let Some(include_dir) = include_dir { println!("cargo:include={}", include_dir); - include_dirs.push(PathBuf::from(&include_dir)); - } - - build_openssl_shim(&include_dirs); -} - -macro_rules! import_options { - ( $( $name:ident $val:expr )* ) => { - &[ $( (stringify!($name),$val), )* ] - }; -} - -fn generate_options_shim() -> PathBuf { - let options: &[(&'static str,u64)]=include!("src/ssl_options.rs"); - let mut shim = String::new(); - writeln!(shim,"#include ").unwrap(); - writeln!(shim,"#include ").unwrap(); - - for &(name,value) in options { - writeln!(shim,"#define RUST_{} UINT64_C({})",name,value).unwrap(); - writeln!(shim,"#ifndef {}",name).unwrap(); - writeln!(shim,"# define {} 0",name).unwrap(); - writeln!(shim,"#endif").unwrap(); - } - - writeln!(shim,"#define COPY_MASK ( \\").unwrap(); - - let mut it=options.iter().peekable(); - while let Some(&(name,_))=it.next() { - let eol=match it.peek() { - Some(_) => " | \\", - None => " )" - }; - writeln!(shim," ((RUST_{0}==(uint64_t)(uint32_t){0})?RUST_{0}:UINT64_C(0)){1}",name,eol).unwrap(); } - - writeln!(shim,"long rust_openssl_ssl_ctx_options_rust_to_c(uint64_t rustval) {{").unwrap(); - writeln!(shim," long cval=rustval©_MASK;").unwrap(); - for &(name,_) in options { - writeln!(shim," if (rustval&RUST_{0}) cval|={0};",name).unwrap(); - } - writeln!(shim," return cval;").unwrap(); - writeln!(shim,"}}").unwrap(); - - writeln!(shim,"uint64_t rust_openssl_ssl_ctx_options_c_to_rust(long cval) {{").unwrap(); - writeln!(shim," uint64_t rustval=cval©_MASK;").unwrap(); - for &(name,_) in options { - writeln!(shim," if (cval&{0}) rustval|=RUST_{0};",name).unwrap(); - } - writeln!(shim," return rustval;").unwrap(); - writeln!(shim,"}}").unwrap(); - - let out_dir = env::var("OUT_DIR").unwrap(); - let dest_file = PathBuf::from(&out_dir).join("ssl_ctx_options_shim.c"); - let mut f = File::create(&dest_file).unwrap(); - - f.write_all(shim.as_bytes()).unwrap(); - - dest_file -} - -fn build_openssl_shim(include_paths: &[PathBuf]) { - let options_shim_file = generate_options_shim(); - let mut config = gcc::Config::new(); - - for path in include_paths { - config.include(path); - } - - config.file("src/openssl_shim.c") - .file(options_shim_file) - .compile("libopenssl_shim.a"); } fn get_mingw_in_path() -> Option> { diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 2aa36a89..e0964d84 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -159,14 +159,6 @@ pub const SSL_TLSEXT_ERR_ALERT_WARNING: c_int = 1; pub const SSL_TLSEXT_ERR_ALERT_FATAL: c_int = 2; pub const SSL_TLSEXT_ERR_NOACK: c_int = 3; -macro_rules! import_options { - ( $( $name:ident $val:expr )* ) => { - $( pub const $name: u64 = $val; )* - }; -} - -include!("ssl_options.rs"); - #[cfg(any(feature = "npn", feature = "alpn"))] pub const OPENSSL_NPN_UNSUPPORTED: c_int = 0; #[cfg(any(feature = "npn", feature = "alpn"))] @@ -238,16 +230,14 @@ pub const X509_V_OK: c_int = 0; 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, +unsafe extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char, _line: c_int) { - unsafe { - let mutex = &(*MUTEXES)[n as usize]; + let mutex = &(*MUTEXES)[n as usize]; - if mode & CRYPTO_LOCK != 0 { - (*GUARDS)[n as usize] = Some(mutex.lock().unwrap()); - } else { - &(*GUARDS)[n as usize].take(); - } + if mode & CRYPTO_LOCK != 0 { + (*GUARDS)[n as usize] = Some(mutex.lock().unwrap()); + } else { + &(*GUARDS)[n as usize].take(); } } @@ -270,29 +260,27 @@ pub fn init() { GUARDS = mem::transmute(guards); CRYPTO_set_locking_callback(locking_function); - rust_openssl_set_id_callback(); + set_id_callback(); } }) } -pub unsafe fn SSL_CTX_set_options(ssl: *mut SSL_CTX, op: u64) -> u64 { - rust_openssl_ssl_ctx_options_c_to_rust(SSL_CTX_set_options_shim(ssl, rust_openssl_ssl_ctx_options_rust_to_c(op))) -} +#[cfg(unix)] +fn set_id_callback() { + unsafe extern "C" fn thread_id() -> c_ulong { + libc::pthread_self() as c_ulong + } -pub unsafe fn SSL_CTX_get_options(ssl: *mut SSL_CTX) -> u64 { - rust_openssl_ssl_ctx_options_c_to_rust(SSL_CTX_get_options_shim(ssl)) + unsafe { + CRYPTO_set_id_callback(thread_id); + } } -pub unsafe fn SSL_CTX_clear_options(ssl: *mut SSL_CTX, op: u64) -> u64 { - rust_openssl_ssl_ctx_options_c_to_rust(SSL_CTX_clear_options_shim(ssl, rust_openssl_ssl_ctx_options_rust_to_c(op))) -} +#[cfg(not(unix))] +fn set_id_callback() {} // True functions extern "C" { - fn rust_openssl_ssl_ctx_options_rust_to_c(rustval: u64) -> c_long; - fn rust_openssl_ssl_ctx_options_c_to_rust(cval: c_long) -> u64; - fn rust_openssl_set_id_callback(); - pub fn ASN1_INTEGER_set(dest: *mut ASN1_INTEGER, value: c_long) -> c_int; pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING; pub fn ASN1_TIME_free(tm: *mut ASN1_TIME); @@ -375,10 +363,11 @@ extern "C" { pub fn BN_bn2hex(a: *mut BIGNUM) -> *const c_char; pub fn CRYPTO_num_locks() -> c_int; - pub fn CRYPTO_set_locking_callback(func: extern "C" fn(mode: c_int, - n: c_int, - file: *const c_char, - line: c_int)); + pub fn CRYPTO_set_locking_callback(func: unsafe extern "C" fn(mode: c_int, + n: c_int, + file: *const c_char, + line: c_int)); + pub fn CRYPTO_set_id_callback(func: unsafe extern "C" fn() -> c_ulong); pub fn CRYPTO_free(buf: *mut c_void); pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; @@ -467,24 +456,6 @@ extern "C" { pub fn HMAC_CTX_cleanup(ctx: *mut HMAC_CTX); pub fn HMAC_CTX_copy(dst: *mut HMAC_CTX, src: *const HMAC_CTX) -> c_int; - // Pre-1.0 versions of these didn't return anything, so the shims bridge that gap - #[cfg_attr(not(target_os = "nacl"), link_name = "HMAC_Init_ex_shim")] - pub fn HMAC_Init_ex(ctx: *mut HMAC_CTX, key: *const u8, keylen: c_int, md: *const EVP_MD, imple: *const ENGINE) -> c_int; - #[cfg_attr(not(target_os = "nacl"), link_name = "HMAC_Final_shim")] - pub fn HMAC_Final(ctx: *mut HMAC_CTX, output: *mut u8, len: *mut c_uint) -> c_int; - #[cfg_attr(not(target_os = "nacl"), link_name = "HMAC_Update_shim")] - pub fn HMAC_Update(ctx: *mut HMAC_CTX, input: *const u8, len: c_uint) -> c_int; - - /// Deprecated - use the non "_shim" version - #[cfg_attr(target_os = "nacl", link_name = "HMAC_Init_ex")] - pub fn HMAC_Init_ex_shim(ctx: *mut HMAC_CTX, key: *const u8, keylen: c_int, md: *const EVP_MD, imple: *const ENGINE) -> c_int; - /// Deprecated - use the non "_shim" version - #[cfg_attr(target_os = "nacl", link_name = "HMAC_Final")] - pub fn HMAC_Final_shim(ctx: *mut HMAC_CTX, output: *mut u8, len: *mut c_uint) -> c_int; - /// Deprecated - use the non "_shim" version - #[cfg_attr(target_os = "nacl", link_name = "HMAC_Update")] - pub fn HMAC_Update_shim(ctx: *mut HMAC_CTX, input: *const u8, len: c_uint) -> c_int; - pub fn PEM_read_bio_DHparams(bio: *mut BIO, out: *mut *mut DH, callback: Option, user_data: *mut c_void) -> *mut DH; pub fn PEM_read_bio_X509(bio: *mut BIO, out: *mut *mut X509, callback: Option, @@ -678,30 +649,6 @@ extern "C" { pub fn d2i_RSA_PUBKEY(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA; pub fn i2d_RSAPrivateKey(k: *mut RSA, buf: *const *mut u8) -> c_int; pub fn d2i_RSAPrivateKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA; - - // These functions are defined in OpenSSL as macros, so we shim them - #[link_name = "BIO_eof_shim"] - pub fn BIO_eof(b: *mut BIO) -> c_int; - #[link_name = "BIO_set_nbio_shim"] - pub fn BIO_set_nbio(b: *mut BIO, enabled: c_long) -> c_long; - #[link_name = "BIO_set_mem_eof_return_shim"] - pub fn BIO_set_mem_eof_return(b: *mut BIO, v: c_int); - pub fn SSL_CTX_set_options_shim(ctx: *mut SSL_CTX, options: c_long) -> c_long; - pub fn SSL_CTX_get_options_shim(ctx: *mut SSL_CTX) -> c_long; - pub fn SSL_CTX_clear_options_shim(ctx: *mut SSL_CTX, options: c_long) -> c_long; - #[link_name = "SSL_CTX_add_extra_chain_cert_shim"] - pub fn SSL_CTX_add_extra_chain_cert(ctx: *mut SSL_CTX, x509: *mut X509) -> c_long; - #[link_name = "SSL_CTX_set_read_ahead_shim"] - pub fn SSL_CTX_set_read_ahead(ctx: *mut SSL_CTX, m: c_long) -> c_long; - #[cfg(feature = "ecdh_auto")] - #[link_name = "SSL_CTX_set_ecdh_auto_shim"] - pub fn SSL_CTX_set_ecdh_auto(ssl: *mut SSL_CTX, onoff: c_int) -> c_int; - #[link_name = "SSL_set_tlsext_host_name_shim"] - pub fn SSL_set_tlsext_host_name(s: *mut SSL, name: *const c_char) -> c_long; - #[link_name = "SSL_CTX_set_tmp_dh_shim"] - pub fn SSL_CTX_set_tmp_dh(s: *mut SSL, dh: *const DH) -> c_long; - #[link_name = "X509_get_extensions_shim"] - pub fn X509_get_extensions(x: *mut X509) -> *mut stack_st_X509_EXTENSION; } pub mod probe; diff --git a/openssl-sys/src/openssl_shim.c b/openssl-sys/src/openssl_shim.c deleted file mode 100644 index 84adb47b..00000000 --- a/openssl-sys/src/openssl_shim.c +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include -#include -#include - -#if defined(__APPLE__) || defined(__linux) - -#include -#include - -unsigned long thread_id() -{ - return (unsigned long) pthread_self(); -} - -void rust_openssl_set_id_callback() { - CRYPTO_set_id_callback(thread_id); -} - -#else -// Openssl already handles Windows directly, so we don't -// need to explicitly set it - -void rust_openssl_set_id_callback() { - // We don't know how to set the callback for arbitrary OSes - // Let openssl use its defaults and hope they work. -} - -#endif - - -#if OPENSSL_VERSION_NUMBER < 0x10000000L -// Copied from openssl crypto/hmac/hmac.c -int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) - { - if (!EVP_MD_CTX_copy(&dctx->i_ctx, &sctx->i_ctx)) - goto err; - if (!EVP_MD_CTX_copy(&dctx->o_ctx, &sctx->o_ctx)) - goto err; - if (!EVP_MD_CTX_copy(&dctx->md_ctx, &sctx->md_ctx)) - goto err; - memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK); - dctx->key_length = sctx->key_length; - dctx->md = sctx->md; - return 1; - err: - return 0; - } - -int HMAC_Init_ex_shim(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl) { - HMAC_Init_ex(ctx, key, key_len, md, impl); - return 1; -} - -int HMAC_Update_shim(HMAC_CTX *ctx, const unsigned char *data, int len) { - HMAC_Update(ctx, data, len); - return 1; -} - -int HMAC_Final_shim(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) { - HMAC_Final(ctx, md, len); - return 1; -} - -#else - -int HMAC_Init_ex_shim(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl) { - return HMAC_Init_ex(ctx, key, key_len, md, impl); -} - -int HMAC_Update_shim(HMAC_CTX *ctx, const unsigned char *data, int len) { - return HMAC_Update(ctx, data, len); -} - -int HMAC_Final_shim(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) { - return HMAC_Final(ctx, md, len); -} -#endif - -// shims for OpenSSL macros - -int BIO_eof_shim(BIO *b) { - return BIO_eof(b); -} - -long BIO_set_nbio_shim(BIO *b, long enabled) { - return BIO_set_nbio(b, enabled); -} - -void BIO_set_mem_eof_return_shim(BIO *b, int v) { - BIO_set_mem_eof_return(b, v); -} - -long SSL_CTX_set_options_shim(SSL_CTX *ctx, long options) { - return SSL_CTX_set_options(ctx, options); -} - -long SSL_CTX_get_options_shim(SSL_CTX *ctx) { - return SSL_CTX_get_options(ctx); -} - -long SSL_CTX_clear_options_shim(SSL_CTX *ctx, long options) { - return SSL_CTX_clear_options(ctx, options); -} - -long SSL_CTX_add_extra_chain_cert_shim(SSL_CTX *ctx, X509 *x509) { - return SSL_CTX_add_extra_chain_cert(ctx, x509); -} - -long SSL_CTX_set_read_ahead_shim(SSL_CTX *ctx, long m) { - return SSL_CTX_set_read_ahead(ctx, m); -} - -long SSL_CTX_set_tmp_dh_shim(SSL_CTX *ctx, DH *dh) { - return SSL_CTX_set_tmp_dh(ctx, dh); -} - -#if OPENSSL_VERSION_NUMBER >= 0x10002000L -int SSL_CTX_set_ecdh_auto_shim(SSL_CTX *ctx, int onoff) { - return SSL_CTX_set_ecdh_auto(ctx, onoff); -} -#endif - -DH *DH_new_from_params(BIGNUM *p, BIGNUM *g, BIGNUM *q) { - DH *dh; - - if ((dh = DH_new()) == NULL) { - return NULL; - } - dh->p = p; - dh->g = g; - dh->q = q; - return dh; -} - -long SSL_set_tlsext_host_name_shim(SSL *s, char *name) { - return SSL_set_tlsext_host_name(s, name); -} - -STACK_OF(X509_EXTENSION) *X509_get_extensions_shim(X509 *x) { - return x->cert_info ? x->cert_info->extensions : NULL; -} diff --git a/openssl-sys/src/ssl_options.rs b/openssl-sys/src/ssl_options.rs deleted file mode 100644 index a1c778ac..00000000 --- a/openssl-sys/src/ssl_options.rs +++ /dev/null @@ -1,46 +0,0 @@ -import_options!{ -// The following values are directly from recent OpenSSL -SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001 -SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002 -SSL_OP_LEGACY_SERVER_CONNECT 0x00000004 -SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008 -SSL_OP_TLSEXT_PADDING 0x00000010 -SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020 -SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040 -SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080 -SSL_OP_TLS_D5_BUG 0x00000100 -SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200 -// unused: 0x00000400 -SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800 -SSL_OP_NO_QUERY_MTU 0x00001000 -SSL_OP_COOKIE_EXCHANGE 0x00002000 -SSL_OP_NO_TICKET 0x00004000 -SSL_OP_CISCO_ANYCONNECT 0x00008000 -SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000 -SSL_OP_NO_COMPRESSION 0x00020000 -SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000 -SSL_OP_SINGLE_ECDH_USE 0x00080000 -SSL_OP_SINGLE_DH_USE 0x00100000 -// unused: 0x00200000 -SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000 -SSL_OP_TLS_ROLLBACK_BUG 0x00800000 -SSL_OP_NO_SSLv2 0x01000000 -SSL_OP_NO_SSLv3 0x02000000 -SSL_OP_NO_DTLSv1 0x04000000 -SSL_OP_NO_TLSv1 0x04000000 -SSL_OP_NO_DTLSv1_2 0x08000000 -SSL_OP_NO_TLSv1_2 0x08000000 -SSL_OP_NO_TLSv1_1 0x10000000 -SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000 -SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000 -SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000 - -// The following values were in 32-bit range in old OpenSSL -SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x100000000 -SSL_OP_MSIE_SSLV2_RSA_PADDING 0x200000000 -SSL_OP_PKCS1_CHECK_1 0x400000000 -SSL_OP_PKCS1_CHECK_2 0x800000000 - -// The following values were redefined to 0 for security reasons -SSL_OP_EPHEMERAL_RSA 0x0 -} -- cgit v1.2.3 From f36f610d079df6053bedec8b00d7c3bdb376815d Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 11 Nov 2015 22:35:11 -0800 Subject: Move HMAC_CTX_copy to sys-extras --- openssl-sys/src/lib.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'openssl-sys') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index e0964d84..674b303f 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -454,7 +454,6 @@ extern "C" { pub fn HMAC_CTX_init(ctx: *mut HMAC_CTX); pub fn HMAC_CTX_cleanup(ctx: *mut HMAC_CTX); - pub fn HMAC_CTX_copy(dst: *mut HMAC_CTX, src: *const HMAC_CTX) -> c_int; pub fn PEM_read_bio_DHparams(bio: *mut BIO, out: *mut *mut DH, callback: Option, user_data: *mut c_void) -> *mut DH; -- cgit v1.2.3 From be7171ee10bbdbfa005ca4ae4f6ec87c05f82c25 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 16 Nov 2015 21:02:23 -0800 Subject: Don't depend on wildcard windows deps --- openssl-sys/Cargo.toml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index ebcddfc6..fea58bc5 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -39,15 +39,16 @@ libressl-pnacl-sys = "2.1.0" libressl-pnacl-sys = "2.1.0" [target.arm-unknown-nacl.dependencies] libressl-pnacl-sys = "2.1.0" + [target.i686-pc-windows-gnu] -user32-sys = "*" -gdi32-sys = "*" +user32-sys = "0.1" +gdi32-sys = "0.1" [target.x86_64-pc-windows-gnu] -user32-sys = "*" -gdi32-sys = "*" +user32-sys = "0.1" +gdi32-sys = "0.1" [target.i686-pc-windows-msvc] -user32-sys = "*" -gdi32-sys = "*" +user32-sys = "0.1" +gdi32-sys = "0.1" [target.x86_64-pc-windows-msvc] -user32-sys = "*" -gdi32-sys = "*" +user32-sys = "0.1" +gdi32-sys = "0.1" -- cgit v1.2.3 From 9ebf0944377dec81fff25b9942e4ab9bfe67cfb0 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 16 Nov 2015 21:03:34 -0800 Subject: Mention why the windows deps are there --- openssl-sys/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index fea58bc5..6bfabc4e 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -40,6 +40,7 @@ libressl-pnacl-sys = "2.1.0" [target.arm-unknown-nacl.dependencies] libressl-pnacl-sys = "2.1.0" +# Only here to make sure we link to these in a static build on Windows [target.i686-pc-windows-gnu] user32-sys = "0.1" gdi32-sys = "0.1" -- cgit v1.2.3 From 82547f53d7946bb1d85ca0793d92873328a7632c Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 16 Nov 2015 20:39:20 -0800 Subject: Release v0.7.0 --- openssl-sys/Cargo.toml | 4 ++-- openssl-sys/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'openssl-sys') diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 6bfabc4e..6d625e7a 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "openssl-sys" -version = "0.6.7" +version = "0.7.0" authors = ["Alex Crichton ", "Steven Fackler "] license = "MIT" description = "FFI bindings to OpenSSL" repository = "https://github.com/sfackler/rust-openssl" -documentation = "https://sfackler.github.io/rust-openssl/doc/v0.6.7/openssl_sys" +documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.0/openssl_sys" links = "openssl" build = "build.rs" diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 674b303f..018f8bca 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.6.7")] +#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.0")] extern crate libc; -- cgit v1.2.3