Commit 27657755 authored by Steven Fackler's avatar Steven Fackler
Browse files

OpenSSL 1.1.1 support

parent 41598534
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -90,6 +90,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-pre1
openssl_110: &OPENSSL_110
  LIBRARY: openssl
  VERSION: 1.1.0g
@@ -125,6 +128,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:
@@ -137,6 +144,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:
@@ -145,10 +156,10 @@ jobs:
    <<: *JOB
    environment:
      <<: [*OPENSSL_102, *I686, *BASE]
  i686-openssl-1.0.1:
  armhf-openssl-1.1.1:
    <<: *JOB
    environment:
      <<: [*OPENSSL_101, *I686, *BASE]
      <<: [*OPENSSL_111, *ARMHF, *BASE]
  armhf-openssl-1.1.0:
    <<: *JOB
    environment:
@@ -157,10 +168,6 @@ jobs:
    <<: *JOB
    environment:
      <<: [*OPENSSL_102, *ARMHF, *BASE]
  armhf-openssl-1.0.1:
    <<: *JOB
    environment:
      <<: [*OPENSSL_101, *ARMHF, *BASE]
  x86_64-libressl-2.5.0:
    <<: *JOB
    environment:
@@ -175,15 +182,16 @@ 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
    - x86_64-libressl-2.5.0
    - x86_64-libressl-2.6.3
    - macos
+11 −4
Original line number Diff line number Diff line
@@ -343,8 +343,10 @@ RUST_LIBRESSL_251
RUST_LIBRESSL_250
#elif defined (LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20500000
RUST_LIBRESSL_OLD
#elif OPENSSL_VERSION_NUMBER >= 0x10101000
#elif OPENSSL_VERSION_NUMBER >= 0x10102000
RUST_OPENSSL_NEW
#elif OPENSSL_VERSION_NUMBER >= 0x10101000
RUST_OPENSSL_111
#elif OPENSSL_VERSION_NUMBER >= 0x10100060
RUST_OPENSSL_110F
#elif OPENSSL_VERSION_NUMBER >= 0x10100000
@@ -471,6 +473,11 @@ See rust-openssl README for more information:
        println!("cargo:libressl_version=26x");
        println!("cargo:version=101");
        Version::Libressl
    } else if expanded.contains("RUST_OPENSSL_111") {
        println!("cargo:rustc-cfg=ossl111");
        println!("cargo:rustc-cfg=ossl110");
        println!("cargo:version=111");
        Version::Openssl110
    } else if expanded.contains("RUST_OPENSSL_110F") {
        println!("cargo:rustc-cfg=ossl110");
        println!("cargo:rustc-cfg=ossl110f");
@@ -493,9 +500,9 @@ See rust-openssl README for more information:
        panic!(
            "

This crate is only compatible with OpenSSL 1.0.1, 1.0.2, and 1.1.0, or LibreSSL
2.5 and 2.6.0, but a different version of OpenSSL was found. The build is now
aborting due to this version mismatch.
This crate is only compatible with OpenSSL 1.0.1 through 1.1.1, or LibreSSL 2.5
and 2.6, but a different version of OpenSSL was found. The build is now aborting
due to this version mismatch.

"
        );
+12 −6
Original line number Diff line number Diff line
@@ -1255,9 +1255,9 @@ pub const SSL_OP_CRYPTOPRO_TLSEXT_BUG: c_ulong = 0x0;
pub const SSL_OP_LEGACY_SERVER_CONNECT: c_ulong = 0x00000004;
#[cfg(not(libressl))]
pub const SSL_OP_SAFARI_ECDHE_ECDSA_BUG: c_ulong = 0x00000040;
#[cfg(not(any(libressl, ossl110f)))]
#[cfg(not(any(libressl, ossl110f, ossl111)))]
pub const SSL_OP_ALL: c_ulong = 0x80000BFF;
#[cfg(ossl110f)]
#[cfg(any(ossl110f, ossl111))]
pub const SSL_OP_ALL: c_ulong = SSL_OP_CRYPTOPRO_TLSEXT_BUG | SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
    | SSL_OP_LEGACY_SERVER_CONNECT | SSL_OP_TLSEXT_PADDING
    | SSL_OP_SAFARI_ECDHE_ECDSA_BUG;
@@ -1276,16 +1276,22 @@ pub const SSL_OP_TLS_ROLLBACK_BUG: c_ulong = 0x00800000;
#[cfg(not(libressl))]
pub const SSL_OP_NO_SSLv3: c_ulong = 0x02000000;
pub const SSL_OP_NO_TLSv1: c_ulong = 0x04000000;
pub const SSL_OP_NO_TLSv1_2: c_ulong = 0x08000000;
pub const SSL_OP_NO_TLSv1_1: c_ulong = 0x10000000;
pub const SSL_OP_NO_TLSv1_2: c_ulong = 0x08000000;
#[cfg(ossl111)]
pub const SSL_OP_NO_TLSv1_3: c_ulong = 0x20000000;

#[cfg(not(any(ossl101, libressl)))]
pub const SSL_OP_NO_DTLSv1: c_ulong = 0x04000000;
#[cfg(not(any(ossl101, libressl)))]
pub const SSL_OP_NO_DTLSv1_2: c_ulong = 0x08000000;
#[cfg(not(any(ossl101, libressl)))]
#[cfg(not(any(ossl101, libressl, ossl111)))]
pub const SSL_OP_NO_SSL_MASK: c_ulong =
    SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2;
#[cfg(ossl111)]
pub const SSL_OP_NO_SSL_MASK: c_ulong = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1
    | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2
    | SSL_OP_NO_TLSv1_3;

pub const SSL_FILETYPE_PEM: c_int = X509_FILETYPE_PEM;
pub const SSL_FILETYPE_ASN1: c_int = X509_FILETYPE_ASN1;
@@ -2498,9 +2504,9 @@ extern "C" {
    );
    pub fn SSL_get_session(s: *const SSL) -> *mut SSL_SESSION;
    pub fn SSL_set_session(ssl: *mut SSL, session: *mut SSL_SESSION) -> c_int;
    #[cfg(not(any(ossl101, libressl, ossl110f)))]
    #[cfg(not(any(ossl101, libressl, ossl110f, ossl111)))]
    pub fn SSL_is_server(s: *mut SSL) -> c_int;
    #[cfg(ossl110f)]
    #[cfg(any(ossl110f, ossl111))]
    pub fn SSL_is_server(s: *const SSL) -> c_int;

    pub fn SSL_SESSION_free(s: *mut SSL_SESSION);
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ all-features = true
v101 = []
v102 = []
v110 = []
v111 = ["v110"]

[dependencies]
bitflags = "1.0"
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ fn main() {
        Ok(ref v) if v == "110" => {
            println!("cargo:rustc-cfg=ossl110");
        }
        Ok(ref v) if v == "111" => {
            println!("cargo:rustc-cfg=ossl110");
            println!("cargo:rustc-cfg=ossl111");
        }
        _ => panic!("Unable to detect OpenSSL version"),
    }

Loading