Skip to content

Commit

Permalink
Merge branch 'release-v0.7.3' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Dec 18, 2015
2 parents cf075d8 + 5fa46d4 commit 6195bd4
Show file tree
Hide file tree
Showing 30 changed files with 1,381 additions and 1,205 deletions.
25 changes: 18 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
language: rust
sudo: false
addons:
apt:
packages:
- gcc-arm-linux-gnueabihf
rust:
- nightly
- beta
- stable
- 1.4.0
os:
- osx
- linux
env:
global:
- FEATURES="tlsv1_2 tlsv1_1 dtlsv1 dtlsv1_2 sslv2 sslv3 aes_xts aes_ctr npn alpn rfc5114 ecdh_auto pkcs5_pbkdf2_hmac"
matrix:
- TEST_FEATURES=false
- TEST_FEATURES=true
matrix:
# include:
# - os: linux
# env: TARGET=arm-unknown-linux-gnueabihf TEST_FEATURES=true
# rust: 1.4.0
exclude:
- os: osx
env: TEST_FEATURES=true
before_install:
- (test $TRAVIS_OS_NAME == "osx" || ./openssl/test/build.sh)
- ./openssl/test/build.sh
script:
- (test $TRAVIS_OS_NAME != "osx" || (cd openssl && cargo test))
- (test $TRAVIS_OS_NAME == "osx" || (cd openssl && OPENSSL_LIB_DIR=$HOME/openssl/lib OPENSSL_INCLUDE_DIR=$HOME/openssl/include LD_LIBRARY_PATH=$HOME/openssl/lib:$LD_LIBRARY_PATH PATH=$HOME/openssl/bin:$PATH cargo test))
- (test $TRAVIS_OS_NAME == "osx" || (cd openssl && OPENSSL_LIB_DIR=$HOME/openssl/lib OPENSSL_INCLUDE_DIR=$HOME/openssl/include LD_LIBRARY_PATH=$HOME/openssl/lib:$LD_LIBRARY_PATH PATH=$HOME/openssl/bin:$PATH cargo test --features "$FEATURES"))
- ./openssl/test/run.sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.2/openssl).
[Documentation](https://sfackler.github.io/rust-openssl/doc/v0.7.3/openssl).

## Building

Expand Down
6 changes: 3 additions & 3 deletions openssl-sys-extras/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "openssl-sys-extras"
version = "0.7.2"
version = "0.7.3"
authors = ["Steven Fackler <[email protected]>"]
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.2/openssl_sys_extras"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.3/openssl_sys_extras"
build = "build.rs"

[features]
ecdh_auto = []

[dependencies]
libc = "0.2"
openssl-sys = { version = "0.7.1", path = "../openssl-sys" }
openssl-sys = { version = "0.7.3", path = "../openssl-sys" }

[build-dependencies]
gcc = "0.3"
2 changes: 1 addition & 1 deletion openssl-sys-extras/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(non_upper_case_globals, non_snake_case)]
#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.2")]
#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.3")]

extern crate openssl_sys;
extern crate libc;
Expand Down
4 changes: 2 additions & 2 deletions openssl-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "openssl-sys"
version = "0.7.2"
version = "0.7.3"
authors = ["Alex Crichton <[email protected]>",
"Steven Fackler <[email protected]>"]
license = "MIT"
description = "FFI bindings to OpenSSL"
repository = "https://github.com/sfackler/rust-openssl"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.2/openssl_sys"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.3/openssl_sys"
links = "openssl"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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.2")]
#![doc(html_root_url="https://sfackler.github.io/rust-openssl/doc/v0.7.3")]

extern crate libc;

Expand Down
8 changes: 4 additions & 4 deletions openssl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "openssl"
version = "0.7.2"
version = "0.7.3"
authors = ["Steven Fackler <[email protected]>"]
license = "Apache-2.0"
description = "OpenSSL bindings"
repository = "https://github.com/sfackler/rust-openssl"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.2/openssl"
documentation = "https://sfackler.github.io/rust-openssl/doc/v0.7.3/openssl"
readme = "../README.md"
keywords = ["crypto", "tls", "ssl", "dtls"]
build = "build.rs"
Expand All @@ -29,8 +29,8 @@ pkcs5_pbkdf2_hmac = ["openssl-sys/pkcs5_pbkdf2_hmac"]
bitflags = ">= 0.2, < 0.4"
lazy_static = "0.1"
libc = "0.2"
openssl-sys = { version = "0.7.1", path = "../openssl-sys" }
openssl-sys-extras = { version = "0.7.1", path = "../openssl-sys-extras" }
openssl-sys = { version = "0.7.3", path = "../openssl-sys" }
openssl-sys-extras = { version = "0.7.3", path = "../openssl-sys-extras" }

[build-dependencies]
gcc = "0.3"
Expand Down
13 changes: 6 additions & 7 deletions openssl/src/asn1/mod.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
use libc::{c_long};
use libc::c_long;
use std::ptr;

use ffi;
use ssl::error::{SslError};
use ssl::error::SslError;


pub struct Asn1Time {
handle: *mut ffi::ASN1_TIME,
owned: bool
owned: bool,
}

impl Asn1Time {
/// Wraps existing ASN1_TIME and takes ownership
pub fn new(handle: *mut ffi::ASN1_TIME) -> Asn1Time {
Asn1Time {
handle: handle,
owned: true
owned: true,
}
}

fn new_with_period(period: u64) -> Result<Asn1Time, SslError> {
ffi::init();

let handle = unsafe {
try_ssl_null!(ffi::X509_gmtime_adj(ptr::null_mut(),
period as c_long))
try_ssl_null!(ffi::X509_gmtime_adj(ptr::null_mut(), period as c_long))
};
Ok(Asn1Time::new(handle))
}
Expand All @@ -36,7 +35,7 @@ impl Asn1Time {

/// Returns raw handle
pub unsafe fn get_handle(&self) -> *mut ffi::ASN1_TIME {
return self.handle
return self.handle;
}
}

Expand Down
26 changes: 14 additions & 12 deletions openssl/src/bio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::cmp;

use ffi;
use ffi_extras;
use ssl::error::{SslError};
use ssl::error::SslError;

pub struct MemBio {
bio: *mut ffi::BIO,
owned: bool
owned: bool,
}

impl Drop for MemBio {
Expand All @@ -33,15 +33,15 @@ impl MemBio {

Ok(MemBio {
bio: bio,
owned: true
owned: true,
})
}

/// Returns a "borrow", i.e. it has no ownership
pub fn borrowed(bio: *mut ffi::BIO) -> MemBio {
MemBio {
bio: bio,
owned: false
owned: false,
}
}

Expand All @@ -60,17 +60,21 @@ impl MemBio {

/// Sets the BIO's EOF state.
pub fn set_eof(&self, eof: bool) {
let v = if eof { 0 } else { -1 };
unsafe { ffi_extras::BIO_set_mem_eof_return(self.bio, v); }
let v = if eof {
0
} else {
-1
};
unsafe {
ffi_extras::BIO_set_mem_eof_return(self.bio, v);
}
}
}

impl Read for MemBio {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let len = cmp::min(c_int::max_value() as usize, buf.len()) as c_int;
let ret = unsafe {
ffi::BIO_read(self.bio, buf.as_ptr() as *mut c_void, len)
};
let ret = unsafe { ffi::BIO_read(self.bio, buf.as_ptr() as *mut c_void, len) };

if ret <= 0 {
let is_eof = unsafe { ffi_extras::BIO_eof(self.bio) };
Expand All @@ -88,9 +92,7 @@ impl Read for MemBio {
impl Write for MemBio {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let len = cmp::min(c_int::max_value() as usize, buf.len()) as c_int;
let ret = unsafe {
ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void, len)
};
let ret = unsafe { ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void, len) };

if ret < 0 {
Err(io::Error::new(io::ErrorKind::Other, SslError::get()))
Expand Down
Loading

0 comments on commit 6195bd4

Please sign in to comment.