aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--appveyor.yml4
-rw-r--r--openssl/Cargo.toml3
-rw-r--r--openssl/src/crypto/dsa.rs29
-rw-r--r--openssl/src/crypto/mod.rs1
-rw-r--r--openssl/src/crypto/pkey.rs13
-rw-r--r--openssl/src/crypto/rsa.rs28
-rw-r--r--openssl/src/ssl/mod.rs4
-rwxr-xr-xopenssl/test/run.sh4
9 files changed, 31 insertions, 57 deletions
diff --git a/.travis.yml b/.travis.yml
index 91c6ad62..0d76be3d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,7 +6,7 @@ addons:
- gcc-arm-linux-gnueabihf
rust:
- nightly
-- 1.8.0
+- 1.9.0
os:
- osx
- linux
diff --git a/appveyor.yml b/appveyor.yml
index f835d9f6..054b88f2 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -10,8 +10,8 @@ environment:
install:
- ps: Start-FileDownload "http://slproweb.com/download/Win${env:BITS}OpenSSL-1_0_2h.exe"
- Win%BITS%OpenSSL-1_0_2h.exe /SILENT /VERYSILENT /SP- /DIR="C:\OpenSSL"
- - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-1.8.0-${env:TARGET}.exe"
- - rust-1.8.0-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
+ - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-1.9.0-${env:TARGET}.exe"
+ - rust-1.9.0-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- SET PATH=%PATH%;C:\MinGW\bin
- rustc -V
diff --git a/openssl/Cargo.toml b/openssl/Cargo.toml
index 218969eb..3d4b098c 100644
--- a/openssl/Cargo.toml
+++ b/openssl/Cargo.toml
@@ -26,9 +26,6 @@ rfc5114 = ["openssl-sys/rfc5114"]
ecdh_auto = ["openssl-sys-extras/ecdh_auto"]
pkcs5_pbkdf2_hmac = ["openssl-sys/pkcs5_pbkdf2_hmac"]
-nightly = []
-catch_unwind = []
-
[dependencies]
bitflags = ">= 0.5.0, < 0.8.0"
lazy_static = "0.2"
diff --git a/openssl/src/crypto/dsa.rs b/openssl/src/crypto/dsa.rs
index 36806a48..a1e4572a 100644
--- a/openssl/src/crypto/dsa.rs
+++ b/openssl/src/crypto/dsa.rs
@@ -3,18 +3,15 @@ use std::fmt;
use error::ErrorStack;
use std::ptr;
use std::io::{self, Read, Write};
-use libc::{c_uint, c_int};
+use libc::{c_uint, c_int, c_char, c_void};
use bn::BigNum;
use bio::MemBio;
use crypto::hash;
use crypto::HashTypeInternals;
-
-#[cfg(feature = "catch_unwind")]
-use libc::{c_char, c_void};
-#[cfg(feature = "catch_unwind")]
use crypto::util::{CallbackState, invoke_passwd_cb};
+
/// Builder for upfront DSA parameter generateration
pub struct DSAParams(*mut ffi::DSA);
@@ -94,15 +91,12 @@ impl DSA {
///
/// The callback will be passed the password buffer and should return the number of characters
/// placed into the buffer.
- ///
- /// Requires the `catch_unwind` feature.
- #[cfg(feature = "catch_unwind")]
- pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<DSA, ErrorStack>
+ pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> io::Result<DSA>
where R: Read, F: FnOnce(&mut [c_char]) -> usize
{
let mut cb = CallbackState::new(pass_cb);
let mut mem_bio = try!(MemBio::new());
- try!(io::copy(reader, &mut mem_bio).map_err(StreamError));
+ try!(io::copy(reader, &mut mem_bio));
unsafe {
let cb_ptr = &mut cb as *mut _ as *mut c_void;
@@ -251,6 +245,8 @@ impl fmt::Debug for DSA {
mod test {
use std::fs::File;
use std::io::{Write, Cursor};
+ use libc::c_char;
+
use super::*;
use crypto::hash::*;
@@ -331,18 +327,17 @@ mod test {
}
#[test]
- #[cfg(feature = "catch_unwind")]
pub fn test_password() {
let mut password_queried = false;
let mut buffer = File::open("test/dsa-encrypted.pem").unwrap();
DSA::private_key_from_pem_cb(&mut buffer, |password| {
password_queried = true;
- password[0] = b'm' as _;
- password[1] = b'y' as _;
- password[2] = b'p' as _;
- password[3] = b'a' as _;
- password[4] = b's' as _;
- password[5] = b's' as _;
+ password[0] = b'm' as c_char;
+ password[1] = b'y' as c_char;
+ password[2] = b'p' as c_char;
+ password[3] = b'a' as c_char;
+ password[4] = b's' as c_char;
+ password[5] = b's' as c_char;
6
}).unwrap();
diff --git a/openssl/src/crypto/mod.rs b/openssl/src/crypto/mod.rs
index 6a34bd59..5b891ce7 100644
--- a/openssl/src/crypto/mod.rs
+++ b/openssl/src/crypto/mod.rs
@@ -25,7 +25,6 @@ pub mod symm;
pub mod memcmp;
pub mod rsa;
pub mod dsa;
-#[cfg(feature = "catch_unwind")]
mod util;
mod symm_internal;
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs
index 0231cc95..29feb016 100644
--- a/openssl/src/crypto/pkey.rs
+++ b/openssl/src/crypto/pkey.rs
@@ -1,4 +1,4 @@
-use libc::{c_int, c_uint, c_ulong};
+use libc::{c_int, c_uint, c_ulong, c_void, c_char};
use std::io;
use std::io::prelude::*;
use std::iter::repeat;
@@ -12,10 +12,6 @@ use crypto::hash::Type as HashType;
use ffi;
use crypto::rsa::RSA;
use error::ErrorStack;
-
-#[cfg(feature = "catch_unwind")]
-use libc::{c_void, c_char};
-#[cfg(feature = "catch_unwind")]
use crypto::util::{CallbackState, invoke_passwd_cb};
#[derive(Copy, Clone)]
@@ -104,16 +100,13 @@ impl PKey {
///
/// The callback will be passed the password buffer and should return the number of characters
/// placed into the buffer.
- ///
- /// Requires the `catch_unwind` feature.
- #[cfg(feature = "catch_unwind")]
- pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<PKey, SslError>
+ pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> io::Result<PKey>
where R: Read, F: FnOnce(&mut [c_char]) -> usize
{
let mut cb = CallbackState::new(pass_cb);
let mut mem_bio = try!(MemBio::new());
- try!(io::copy(reader, &mut mem_bio).map_err(StreamError));
+ try!(io::copy(reader, &mut mem_bio));
unsafe {
let evp = try_ssl_null!(ffi::PEM_read_bio_PrivateKey(mem_bio.get_handle(),
diff --git a/openssl/src/crypto/rsa.rs b/openssl/src/crypto/rsa.rs
index b403eab5..05c1c774 100644
--- a/openssl/src/crypto/rsa.rs
+++ b/openssl/src/crypto/rsa.rs
@@ -2,17 +2,13 @@ use ffi;
use std::fmt;
use std::ptr;
use std::io::{self, Read, Write};
-use libc::c_int;
+use libc::{c_int, c_void, c_char};
use bn::BigNum;
use bio::MemBio;
use error::ErrorStack;
use crypto::HashTypeInternals;
use crypto::hash;
-
-#[cfg(feature = "catch_unwind")]
-use libc::{c_void, c_char};
-#[cfg(feature = "catch_unwind")]
use crypto::util::{CallbackState, invoke_passwd_cb};
pub struct RSA(*mut ffi::RSA);
@@ -82,16 +78,13 @@ impl RSA {
}
/// Reads an RSA private key from PEM formatted data and supplies a password callback.
- ///
- /// Requires the `catch_unwind` feature.
- #[cfg(feature = "catch_unwind")]
- pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<RSA, ErrorStack>
+ pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> io::Result<RSA>
where R: Read, F: FnOnce(&mut [c_char]) -> usize
{
let mut cb = CallbackState::new(pass_cb);
let mut mem_bio = try!(MemBio::new());
- try!(io::copy(reader, &mut mem_bio).map_err(StreamError));
+ try!(io::copy(reader, &mut mem_bio));
unsafe {
let cb_ptr = &mut cb as *mut _ as *mut c_void;
@@ -245,6 +238,8 @@ impl fmt::Debug for RSA {
mod test {
use std::fs::File;
use std::io::Write;
+ use libc::c_char;
+
use super::*;
use crypto::hash::*;
@@ -303,18 +298,17 @@ mod test {
}
#[test]
- #[cfg(feature = "catch_unwind")]
pub fn test_password() {
let mut password_queried = false;
let mut buffer = File::open("test/rsa-encrypted.pem").unwrap();
RSA::private_key_from_pem_cb(&mut buffer, |password| {
password_queried = true;
- password[0] = b'm' as _;
- password[1] = b'y' as _;
- password[2] = b'p' as _;
- password[3] = b'a' as _;
- password[4] = b's' as _;
- password[5] = b's' as _;
+ password[0] = b'm' as c_char;
+ password[1] = b'y' as c_char;
+ password[2] = b'p' as c_char;
+ password[3] = b'a' as c_char;
+ password[4] = b's' as c_char;
+ password[5] = b's' as c_char;
6
}).unwrap();
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 9215a928..3d1ec6e5 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -467,7 +467,7 @@ impl SslContext {
let ctx = try_ssl_null!(unsafe { ffi::SSL_CTX_new(method.to_raw()) });
- let ctx = SslContext { ctx: ctx };
+ let mut ctx = SslContext { ctx: ctx };
match method {
#[cfg(feature = "dtlsv1")]
@@ -530,7 +530,7 @@ impl SslContext {
}
}
- fn set_mode(&self, mode: c_long) -> Result<(), ErrorStack> {
+ fn set_mode(&mut self, mode: c_long) -> Result<(), ErrorStack> {
wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_mode(self.ctx, mode) as c_int })
}
diff --git a/openssl/test/run.sh b/openssl/test/run.sh
index 85603773..cbd46cc6 100755
--- a/openssl/test/run.sh
+++ b/openssl/test/run.sh
@@ -7,10 +7,6 @@ if [ "$TEST_FEATURES" == "true" ]; then
FEATURES="tlsv1_2 tlsv1_1 dtlsv1 dtlsv1_2 sslv3 aes_xts aes_ctr npn alpn rfc5114 ecdh_auto pkcs5_pbkdf2_hmac"
fi
-if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then
- FEATURES="$FEATURES nightly catch_unwind"
-fi
-
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
export OPENSSL_LIB_DIR=$HOME/openssl/lib
export OPENSSL_INCLUDE_DIR=$HOME/openssl/include