Commit 7c333469 authored by Steven Fackler's avatar Steven Fackler
Browse files

Remove version-specific features

Closes #852
parent cf658e4c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ job: &JOB
      cargo test \
        --manifest-path=openssl/Cargo.toml \
        --target $TARGET \
        --all-features \
        $TEST_ARGS
  - run:
      command: |
@@ -87,7 +86,7 @@ macos_job: &MACOS_JOB
  - run: cargo run --manifest-path=systest/Cargo.toml
  - run: |
      PATH=/usr/local/opt/openssl/bin:$PATH
      cargo test --manifest-path=openssl/Cargo.toml --all-features
      cargo test --manifest-path=openssl/Cargo.toml
  - *SAVE_DEPS

openssl_111: &OPENSSL_111
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ build = "build.rs"
[package.metadata.docs.rs]
all-features = true

# these are deprecated and don't do anything anymore
[features]
v101 = []
v102 = []
+7 −11
Original line number Diff line number Diff line
@@ -83,9 +83,8 @@ impl Dh<Params> {
        ffi::d2i_DHparams
    }

    /// Requires OpenSSL 1.0.2, 1.1.0, or 1.1.1 and the corresponding Cargo feature.
    #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
              all(feature = "v111", ossl111)))]
    /// Requires OpenSSL 1.0.2 or newer.
    #[cfg(any(ossl102, ossl110))]
    pub fn get_1024_160() -> Result<Dh<Params>, ErrorStack> {
        unsafe {
            ffi::init();
@@ -93,9 +92,8 @@ impl Dh<Params> {
        }
    }

    /// Requires OpenSSL 1.0.2, 1.1.0, or 1.1.1 and the corresponding Cargo feature.
    #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
              all(feature = "v111", ossl111)))]
    /// Requires OpenSSL 1.0.2 or newer.
    #[cfg(any(ossl102, ossl110))]
    pub fn get_2048_224() -> Result<Dh<Params>, ErrorStack> {
        unsafe {
            ffi::init();
@@ -103,9 +101,8 @@ impl Dh<Params> {
        }
    }

    /// Requires OpenSSL 1.0.2, 1.1.0, or 1.1.1 and the corresponding Cargo feature.
    #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
              all(feature = "v111", ossl111)))]
    /// Requires OpenSSL 1.0.2 or newer.
    #[cfg(any(ossl102, ossl110))]
    pub fn get_2048_256() -> Result<Dh<Params>, ErrorStack> {
        unsafe {
            ffi::init();
@@ -145,8 +142,7 @@ mod tests {
    use ssl::{SslContext, SslMethod};

    #[test]
    #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
              all(feature = "v111", ossl111)))]
    #[cfg(any(ossl102, ossl110))]
    fn test_dh_rfc5114() {
        let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
        let dh1 = Dh::get_1024_160().unwrap();
+3 −3
Original line number Diff line number Diff line
@@ -107,8 +107,8 @@ pub fn pbkdf2_hmac(

/// Derives a key from a password and salt using the scrypt algorithm.
///
/// Requires OpenSSL 1.1.0 or 1.1.1 and the corresponding Cargo feature.
#[cfg(any(all(feature = "v110", ossl110), all(feature = "v111", ossl111)))]
/// Requires OpenSSL 1.1.0 or newer.
#[cfg(any(ossl110))]
pub fn scrypt(
    pass: &[u8],
    salt: &[u8],
@@ -271,7 +271,7 @@ mod tests {
    }

    #[test]
    #[cfg(any(all(feature = "v110", ossl110), all(feature = "v111", ossl111)))]
    #[cfg(any(ossl110))]
    fn scrypt() {
        use hex;

+16 −18
Original line number Diff line number Diff line
use ffi;
use libc::{c_char, c_int, c_uchar, c_uint, c_void};
#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
use libc::size_t;
use std::ffi::CStr;
use std::ptr;
use std::slice;
use std::mem;
#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
use std::str;
use foreign_types::ForeignTypeRef;
use foreign_types::ForeignType;

use error::ErrorStack;
use dh::Dh;
#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
#[cfg(any(ossl101, ossl102))]
use ec::EcKey;
use pkey::Params;
use ssl::{get_callback_idx, get_ssl_callback_idx, SniError, SslAlert, SslContextRef, SslRef,
          SslSession, SslSessionRef};
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
          all(feature = "v111", ossl111)))]
#[cfg(any(ossl102, ossl110))]
use ssl::AlpnError;
use x509::X509StoreContextRef;
#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
use ssl::ExtensionContext;
#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
use x509::X509Ref;

pub extern "C" fn raw_verify<F>(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int
@@ -118,8 +117,7 @@ where
    }
}

#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110),
          all(feature = "v111", ossl111)))]
#[cfg(any(ossl102, ossl110))]
pub extern "C" fn raw_alpn_select<F>(
    ssl: *mut ffi::SSL,
    out: *mut *const c_uchar,
@@ -175,7 +173,7 @@ where
    }
}

#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
#[cfg(any(ossl101, ossl102))]
pub unsafe extern "C" fn raw_tmp_ecdh<F>(
    ssl: *mut ffi::SSL,
    is_export: c_int,
@@ -227,7 +225,7 @@ where
    }
}

#[cfg(any(all(feature = "v101", ossl101), all(feature = "v102", ossl102)))]
#[cfg(any(ossl101, ossl102))]
pub unsafe extern "C" fn raw_tmp_ecdh_ssl<F>(
    ssl: *mut ffi::SSL,
    is_export: c_int,
@@ -320,9 +318,9 @@ pub unsafe extern "C" fn raw_remove_session<F>(
    callback(ctx, session)
}

#[cfg(any(ossl110, ossl111))]
#[cfg(any(ossl110))]
type DataPtr = *const c_uchar;
#[cfg(not(any(ossl110, ossl111)))]
#[cfg(not(any(ossl110)))]
type DataPtr = *mut c_uchar;

pub unsafe extern "C" fn raw_get_session<F>(
@@ -352,7 +350,7 @@ where
    }
}

#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
pub unsafe extern "C" fn raw_keylog<F>(ssl: *const ffi::SSL, line: *const c_char)
where
    F: Fn(&SslRef, &str) + 'static + Sync + Send,
@@ -423,10 +421,10 @@ where
    }
}

#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
pub struct CustomExtAddState<T>(Option<T>);

#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
pub extern "C" fn raw_custom_ext_add<F, T>(
    ssl: *mut ffi::SSL,
    _: c_uint,
@@ -480,7 +478,7 @@ where
    }
}

#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
pub extern "C" fn raw_custom_ext_free<T>(
    ssl: *mut ffi::SSL,
    _: c_uint,
@@ -497,7 +495,7 @@ pub extern "C" fn raw_custom_ext_free<T>(
    }
}

#[cfg(all(feature = "v111", ossl111))]
#[cfg(ossl111)]
pub extern "C" fn raw_custom_ext_parse<F>(
    ssl: *mut ffi::SSL,
    _: c_uint,
Loading