From c0a0b80020727b94ee0a4f3d7ee1e8e5b9fb85e6 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 16 Nov 2015 22:28:56 -0800 Subject: [PATCH 1/6] Remove unecessary build dependency --- openssl-sys/Cargo.toml | 1 - openssl-sys/build.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 6d625e7a..1c4900ea 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -29,7 +29,6 @@ libc = "0.2" [build-dependencies] pkg-config = "0.3" -gcc = "0.3" [target.le32-unknown-nacl.dependencies] libressl-pnacl-sys = "2.1.0" diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index bd9611c0..d8399c54 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -1,5 +1,4 @@ extern crate pkg_config; -extern crate gcc; use std::env; From 3c6c4a7b3df9082188ec45f3e636440abfc5c563 Mon Sep 17 00:00:00 2001 From: Overmind JIANG Date: Wed, 18 Nov 2015 11:36:34 +0800 Subject: [PATCH 2/6] Fix a leak when using `EVP_PKEY_get1_RSA`. `EVP_PKEY_get1_RSA` returns a RSA structure with its reference count increased by 1 and therefore we need to call `RSA_free` after finishing using that value. --- openssl-sys/src/lib.rs | 1 + openssl/src/crypto/pkey.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 018f8bca..239f8d9e 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -482,6 +482,7 @@ extern "C" { pub fn RAND_bytes(buf: *mut u8, num: c_int) -> c_int; + pub fn RSA_free(rsa: *mut RSA); 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, diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs index 6ca0aa12..741c6749 100644 --- a/openssl/src/crypto/pkey.rs +++ b/openssl/src/crypto/pkey.rs @@ -120,6 +120,7 @@ impl PKey { let mut s = repeat(0u8).take(len as usize).collect::>(); let r = f(rsa, &s.as_mut_ptr()); + ffi::RSA_free(rsa); s.truncate(r as usize); s From 38b3b4a11eabcd138e50639931254a0410869b51 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 19 Nov 2015 19:52:26 -0500 Subject: [PATCH 3/6] Fixed a typo in a comment. --- openssl/src/ssl/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 23364ef1..2775c4c8 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -588,7 +588,7 @@ impl SslContext { /// If `onoff` is set to `true`, enable ECDHE for key exchange with compatible /// clients, and automatically select an appropriate elliptic curve. /// - /// This method requires OpenSSL >= 1.2.0 or LibreSSL and the `ecdh_auto` feature. + /// This method requires OpenSSL >= 1.0.2 or LibreSSL and the `ecdh_auto` feature. #[cfg(feature = "ecdh_auto")] pub fn set_ecdh_auto(&mut self, onoff: bool) -> Result<(),SslError> { wrap_ssl_result( From 6bb3d8f1b5827ff27216d4219e08467b2461c071 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Fri, 20 Nov 2015 21:33:10 -0800 Subject: [PATCH 4/6] Implement try_clone for MaybeSslStream Closes #308 --- openssl/src/ssl/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 2775c4c8..cca369a2 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -1416,6 +1416,16 @@ impl MaybeSslStream where S: Read+Write { } } +impl MaybeSslStream { + /// Like `TcpStream::try_clone`. + pub fn try_clone(&self) -> io::Result> { + match *self { + MaybeSslStream::Ssl(ref s) => s.try_clone().map(MaybeSslStream::Ssl), + MaybeSslStream::Normal(ref s) => s.try_clone().map(MaybeSslStream::Normal), + } + } +} + /// An SSL stream wrapping a nonblocking socket. #[derive(Clone)] pub struct NonblockingSslStream { From fcc6be2b01fd0b88c1d0449162e17b44b4d1d7c7 Mon Sep 17 00:00:00 2001 From: Maximilian Hristache Date: Sat, 28 Nov 2015 16:24:08 +0100 Subject: [PATCH 5/6] Avoid empty include paths (i.e. cc -I "" ) as they are not supported by GCC. Fix #311 --- openssl-sys/build.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index d8399c54..0e3a76d2 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -15,8 +15,11 @@ fn main() { // rustc doesn't seem to work with pkg-config's output in mingw64 if !target.contains("windows") { if let Ok(info) = pkg_config::find_library("openssl") { - let paths = env::join_paths(info.include_paths).unwrap(); - println!("cargo:include={}", paths.to_str().unwrap()); + // avoid empty include paths as they are not supported by GCC + if info.include_paths.len() > 0 { + let paths = env::join_paths(info.include_paths).unwrap(); + println!("cargo:include={}", paths.to_str().unwrap()); + } return; } } From fce7cf4d362eef82b609b616e93048296e28c1a8 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 28 Nov 2015 16:14:58 -0800 Subject: [PATCH 6/6] Release v0.7.1 --- README.md | 2 +- openssl-sys-extras/Cargo.toml | 6 +++--- openssl-sys/Cargo.toml | 4 ++-- openssl-sys/src/lib.rs | 2 +- openssl/Cargo.toml | 8 ++++---- openssl/src/lib.rs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4820d986..d8cc1ec1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/sfackler/rust-openssl.svg?branch=master)](https://travis-ci.org/sfackler/rust-openssl) -[Documentation](https://sfackler.github.io/rust-openssl/doc/v0.7.0/openssl). +[Documentation](https://sfackler.github.io/rust-openssl/doc/v0.7.1/openssl). ## Building diff --git a/openssl-sys-extras/Cargo.toml b/openssl-sys-extras/Cargo.toml index a7f58f3c..c3d1f565 100644 --- a/openssl-sys-extras/Cargo.toml +++ b/openssl-sys-extras/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "openssl-sys-extras" -version = "0.7.0" +version = "0.7.1" authors = ["Steven Fackler "] license = "MIT" description = "Extra FFI bindings to OpenSSL that require a C shim" repository = "https://github.com/sfackler/rust-openssl" -documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.0/openssl_sys_extras" +documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.1/openssl_sys_extras" links = "openssl_shim" build = "build.rs" @@ -15,7 +15,7 @@ ecdh_auto = [] [dependencies] libc = "0.2" -openssl-sys = { version = "0.7", path = "../openssl-sys" } +openssl-sys = { version = "0.7.1", path = "../openssl-sys" } [build-dependencies] gcc = "0.3" diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 1c4900ea..17e4647f 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "openssl-sys" -version = "0.7.0" +version = "0.7.1" authors = ["Alex Crichton ", "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.7.0/openssl_sys" +documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.1/openssl_sys" links = "openssl" build = "build.rs" diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 239f8d9e..0f40bfed 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(dead_code)] -#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.0")] +#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.1")] extern crate libc; diff --git a/openssl/Cargo.toml b/openssl/Cargo.toml index 7cc29a1f..7b616f18 100644 --- a/openssl/Cargo.toml +++ b/openssl/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "openssl" -version = "0.7.0" +version = "0.7.1" authors = ["Steven Fackler "] license = "Apache-2.0" description = "OpenSSL bindings" repository = "https://github.com/sfackler/rust-openssl" -documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.0/openssl" +documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.1/openssl" readme = "../README.md" keywords = ["crypto", "tls", "ssl", "dtls"] @@ -27,8 +27,8 @@ ecdh_auto = ["openssl-sys-extras/ecdh_auto"] bitflags = ">= 0.2, < 0.4" lazy_static = "0.1" libc = "0.2" -openssl-sys = { version = "0.7", path = "../openssl-sys" } -openssl-sys-extras = { version = "0.7", path = "../openssl-sys-extras" } +openssl-sys = { version = "0.7.1", path = "../openssl-sys" } +openssl-sys-extras = { version = "0.7.1", path = "../openssl-sys-extras" } [dev-dependencies] rustc-serialize = "0.3" diff --git a/openssl/src/lib.rs b/openssl/src/lib.rs index 66ce1894..4691b6dd 100644 --- a/openssl/src/lib.rs +++ b/openssl/src/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.0")] +#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.1")] #[macro_use] extern crate bitflags;