Skip to content

Compat release for 1.1.1 #1001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ save_openssl: &SAVE_OPENSSL
paths:
- /openssl
deps_key: &DEPS_KEY
key: deps-1.19.0-{{ checksum "Cargo.lock" }}-{{ checksum "~/lib_key" }}-2
key: deps-1.21.0-{{ checksum "Cargo.lock" }}-{{ checksum "~/lib_key" }}-2
restore_deps: &RESTORE_DEPS
restore_cache:
<<: *DEPS_KEY
Expand All @@ -31,7 +31,7 @@ save_deps: &SAVE_DEPS
job: &JOB
working_directory: ~/build
docker:
- image: rust:1.19.0
- image: rust:1.21.0
steps:
- checkout
- run: apt-get update
Expand All @@ -45,7 +45,6 @@ job: &JOB
- run: ./test/build_openssl.sh
- *SAVE_OPENSSL
- *RESTORE_DEPS
- run: cargo run --manifest-path=systest/Cargo.toml --target $TARGET
- run: |
ulimit -c unlimited
export PATH=$OPENSSL_DIR/bin:$PATH
Expand Down Expand Up @@ -77,7 +76,7 @@ macos_job: &MACOS_JOB
- checkout
- run: sudo mkdir /opt
- run: sudo chown -R $USER /usr/local /opt
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.19.0
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.21.0
- run: sudo ln -s $CARGO_HOME/bin/* /usr/local/bin
- *RESTORE_REGISTRY
- run: cargo generate-lockfile
Expand All @@ -90,6 +89,9 @@ macos_job: &MACOS_JOB
cargo test --manifest-path=openssl/Cargo.toml --all-features
- *SAVE_DEPS

openssl_111: &OPENSSL_111
LIBRARY: openssl
VERSION: 1.1.1
openssl_110: &OPENSSL_110
LIBRARY: openssl
VERSION: 1.1.0g
Expand Down Expand Up @@ -125,6 +127,10 @@ base: &BASE

version: 2
jobs:
x86_64-openssl-1.1.1:
<<: *JOB
environment:
<<: [*OPENSSL_111, *X86_64, *BASE]
x86_64-openssl-1.1.0:
<<: *JOB
environment:
Expand All @@ -137,6 +143,10 @@ jobs:
<<: *JOB
environment:
<<: [*OPENSSL_101, *X86_64, *BASE]
i686-openssl-1.1.1:
<<: *JOB
environment:
<<: [*OPENSSL_111, *I686, *BASE]
i686-openssl-1.1.0:
<<: *JOB
environment:
Expand All @@ -149,6 +159,10 @@ jobs:
<<: *JOB
environment:
<<: [*OPENSSL_101, *I686, *BASE]
armhf-openssl-1.1.1:
<<: *JOB
environment:
<<: [*OPENSSL_111, *ARMHF, *BASE]
armhf-openssl-1.1.0:
<<: *JOB
environment:
Expand All @@ -175,12 +189,15 @@ workflows:
version: 2
tests:
jobs:
- x86_64-openssl-1.1.1
- x86_64-openssl-1.1.0
- x86_64-openssl-1.0.2
- x86_64-openssl-1.0.1
- i686-openssl-1.1.1
- i686-openssl-1.1.0
- i686-openssl-1.0.2
- i686-openssl-1.0.1
- armhf-openssl-1.1.1
- armhf-openssl-1.1.0
- armhf-openssl-1.0.2
- armhf-openssl-1.0.1
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[workspace]
members = ["openssl", "openssl-sys", "systest"]
members = ["openssl"]
2 changes: 1 addition & 1 deletion openssl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bitflags = "0.9"
foreign-types = "0.3.1"
lazy_static = "1"
libc = "0.2"
openssl-sys = { version = "0.9.23", path = "../openssl-sys" }
openssl-sys = "0.9.23"

[dev-dependencies]
tempdir = "0.3"
Expand Down
5 changes: 5 additions & 0 deletions openssl/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ fn main() {
}
Ok(ref v) if v == "110" => {
println!("cargo:rustc-cfg=ossl110");
println!("cargo:rustc-cfg=ossl11x");
}
Ok(ref v) if v == "111" => {
println!("cargo:rustc-cfg=ossl111");
println!("cargo:rustc-cfg=ossl11x");
}
_ => panic!("Unable to detect OpenSSL version"),
}
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/asn1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl fmt::Display for Asn1ObjectRef {
#[cfg(any(ossl101, ossl102))]
use ffi::ASN1_STRING_data;

#[cfg(ossl110)]
#[cfg(ossl11x)]
#[allow(bad_style)]
unsafe fn ASN1_STRING_data(s: *mut ffi::ASN1_STRING) -> *mut ::libc::c_uchar {
ffi::ASN1_STRING_get0_data(s) as *mut _
Expand Down
4 changes: 2 additions & 2 deletions openssl/src/bn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use ffi::{get_rfc2409_prime_768 as BN_get_rfc2409_prime_768,
get_rfc3526_prime_6144 as BN_get_rfc3526_prime_6144,
get_rfc3526_prime_8192 as BN_get_rfc3526_prime_8192};

#[cfg(ossl110)]
#[cfg(ossl11x)]
use ffi::{BN_get_rfc2409_prime_768, BN_get_rfc2409_prime_1024, BN_get_rfc3526_prime_1536,
BN_get_rfc3526_prime_2048, BN_get_rfc3526_prime_3072, BN_get_rfc3526_prime_4096,
BN_get_rfc3526_prime_6144, BN_get_rfc3526_prime_8192};
Expand Down Expand Up @@ -366,7 +366,7 @@ impl BigNumRef {
unsafe { (*self.as_ptr()).neg == 1 }
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
fn _is_negative(&self) -> bool {
unsafe { ffi::BN_is_negative(self.as_ptr()) == 1 }
}
Expand Down
10 changes: 5 additions & 5 deletions openssl/src/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Dh {
from_der!(Dh, ffi::d2i_DHparams);

/// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0.
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
pub fn get_1024_160() -> Result<Dh, ErrorStack> {
unsafe {
ffi::init();
Expand All @@ -49,7 +49,7 @@ impl Dh {
}

/// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0.
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
pub fn get_2048_224() -> Result<Dh, ErrorStack> {
unsafe {
ffi::init();
Expand All @@ -58,7 +58,7 @@ impl Dh {
}

/// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0.
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
pub fn get_2048_256() -> Result<Dh, ErrorStack> {
unsafe {
ffi::init();
Expand All @@ -67,7 +67,7 @@ impl Dh {
}
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
mod compat {
pub use ffi::DH_set0_pqg;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ mod tests {
use ssl::{SslMethod, SslContext};

#[test]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
fn test_dh_rfc5114() {
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
let dh1 = Dh::get_1024_160().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl fmt::Debug for Dsa {
}
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
mod compat {
use std::ptr;
use ffi::{self, BIGNUM, DSA};
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ops::{Deref, DerefMut};
use std::fmt;
use ffi;

#[cfg(ossl110)]
#[cfg(ossl11x)]
use ffi::{EVP_MD_CTX_new, EVP_MD_CTX_free};
#[cfg(any(ossl101, ossl102))]
use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub mod symm;
pub mod types;
pub mod version;
pub mod x509;
#[cfg(any(ossl102, ossl110))]
#[cfg(any(ossl102, ossl11x))]
mod verify;

fn cvt_p<T>(r: *mut T) -> Result<*mut T, ErrorStack> {
Expand Down
4 changes: 2 additions & 2 deletions openssl/src/pkcs5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn pbkdf2_hmac(
/// Derives a key from a password and salt using the scrypt algorithm.
///
/// Requires the `v110` feature and OpenSSL 1.1.0.
#[cfg(all(feature = "v110", ossl110))]
#[cfg(all(feature = "v110", ossl11x))]
pub fn scrypt(
pass: &[u8],
salt: &[u8],
Expand Down Expand Up @@ -546,7 +546,7 @@ mod tests {
}

#[test]
#[cfg(all(feature = "v110", ossl110))]
#[cfg(all(feature = "v110", ossl11x))]
fn scrypt() {
use hex::ToHex;

Expand Down
2 changes: 1 addition & 1 deletion openssl/src/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl fmt::Debug for Rsa {
}
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
mod compat {
use std::ptr;

Expand Down
2 changes: 1 addition & 1 deletion openssl/src/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use hash::MessageDigest;
use pkey::{PKeyCtxRef, PKeyRef};
use error::ErrorStack;

#[cfg(ossl110)]
#[cfg(ossl11x)]
use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
#[cfg(any(ossl101, ossl102))]
use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/ssl/bio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ unsafe extern "C" fn destroy<S>(bio: *mut BIO) -> c_int {
1
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
#[allow(bad_style)]
mod compat {
use std::io::{Read, Write};
Expand Down
4 changes: 2 additions & 2 deletions openssl/src/ssl/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use dh::Dh;
#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
use ec_key::EcKey;
use ssl::{get_callback_idx, get_ssl_callback_idx, SslRef, SniError, NPN_PROTOS_IDX};
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
use ssl::ALPN_PROTOS_IDX;
use x509::X509StoreContextRef;

Expand Down Expand Up @@ -158,7 +158,7 @@ pub extern "C" fn raw_next_proto_select_cb(
unsafe { select_proto_using(ssl, out, outlen, inbuf, inlen, *NPN_PROTOS_IDX) }
}

#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl11x)))]
pub extern "C" fn raw_alpn_select_cb(
ssl: *mut ffi::SSL,
out: *mut *const c_uchar,
Expand Down
6 changes: 3 additions & 3 deletions openssl/src/ssl/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ fn setup_curves(ctx: &mut SslContextBuilder) -> Result<(), ErrorStack> {
ctx._set_ecdh_auto(true)
}

#[cfg(ossl110)]
#[cfg(ossl11x)]
fn setup_curves(_: &mut SslContextBuilder) -> Result<(), ErrorStack> {
Ok(())
}
Expand All @@ -390,7 +390,7 @@ impl SslAcceptor {
}
}

#[cfg(any(ossl102, ossl110))]
#[cfg(any(ossl102, ossl11x))]
fn setup_verify(ctx: &mut SslContextBuilder) {
ctx.set_verify(SSL_VERIFY_PEER);
}
Expand All @@ -409,7 +409,7 @@ fn setup_verify(ctx: &mut SslContextBuilder) {
});
}

#[cfg(any(ossl102, ossl110))]
#[cfg(any(ossl102, ossl11x))]
fn setup_verify_hostname(ssl: &mut Ssl, domain: &str) -> Result<(), ErrorStack> {
let param = ssl._param_mut();
param.set_hostflags(::verify::X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
Expand Down
Loading