Unverified Commit ade74ca0 authored by Steven Fackler's avatar Steven Fackler Committed by GitHub
Browse files

Merge pull request #2056 from alex/boringssl-osslconf

Use osslconf on BoringSSL
parents 9e790732 043b83d3
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ jobs:
            - false
          library:
            - name: boringssl
              version: bcecc7d834fc44ad257b2f23f88e1cf597ab2736
              version: 8d71d244c0debac4079beeb02b5802fde59b94bd
            - name: openssl
              version: vendored
            - name: openssl
@@ -239,7 +239,7 @@ jobs:
        - uses: actions/cache@v3
          with:
            path: /opt/openssl
            key: openssl-${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-2
            key: openssl-${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-6
          if: matrix.library.version != 'vendored'
          id: openssl-cache
        - run: |
@@ -313,11 +313,8 @@ jobs:
              make install

              # Copy stuff around so it's all as the build system expects.
              cp -r rust/ "$OPENSSL_DIR/rust"
              mkdir -p "$OPENSSL_DIR/crypto/"
              mkdir -p "$OPENSSL_DIR/ssl/"
              cp "$OPENSSL_DIR/lib/libcrypto.a" "$OPENSSL_DIR/crypto/"
              cp "$OPENSSL_DIR/lib/libssl.a" "$OPENSSL_DIR/ssl/"
              cp -r ../rust/ "$OPENSSL_DIR/rust"
              cp -r ./ "$OPENSSL_DIR/build"
            esac

          if: matrix.library.version != 'vendored' && !steps.openssl-cache.outputs.cache-hit
@@ -356,6 +353,7 @@ jobs:
          run: |
            if [[ "${{ matrix.library.name }}" == "boringssl" && "${{ matrix.bindgen }}" != "true" ]]; then
              features="--features unstable_boringssl"
              BORINGSSL_BUILD_DIR="$OPENSSL_DIR/build/"
            fi
            if [[ "${{ matrix.library.version }}" == "vendored" ]]; then
              features="--features vendored"
+13 −5
Original line number Diff line number Diff line
@@ -60,6 +60,14 @@ fn check_ssl_kind() {
    if cfg!(feature = "unstable_boringssl") {
        println!("cargo:rustc-cfg=boringssl");
        println!("cargo:boringssl=true");

        if let Ok(vars) = env::var("DEP_BSSL_CONF") {
            for var in vars.split(',') {
                println!("cargo:rustc-cfg=osslconf=\"{}\"", var);
            }
            println!("cargo:conf={}", vars);
        }

        // BoringSSL does not have any build logic, exit early
        std::process::exit(0);
    }
@@ -223,6 +231,11 @@ See rust-openssl documentation for more information:
        }
    }

    for enabled in &enabled {
        println!("cargo:rustc-cfg=osslconf=\"{}\"", enabled);
    }
    println!("cargo:conf={}", enabled.join(","));

    if is_boringssl {
        println!("cargo:rustc-cfg=boringssl");
        println!("cargo:boringssl=true");
@@ -233,11 +246,6 @@ See rust-openssl documentation for more information:
    // We set this for any non-BoringSSL lib.
    println!("cargo:rustc-cfg=openssl");

    for enabled in &enabled {
        println!("cargo:rustc-cfg=osslconf=\"{}\"", enabled);
    }
    println!("cargo:conf={}", enabled.join(","));

    for cfg in cfgs::get(openssl_version, libressl_version) {
        println!("cargo:rustc-cfg={}", cfg);
    }
+15 −15
Original line number Diff line number Diff line
@@ -391,37 +391,37 @@ extern "C" {
    #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
    pub fn EVP_sm4_ctr() -> *const EVP_CIPHER;

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER;

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
    pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
    pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
    pub fn EVP_cast5_cbc() -> *const EVP_CIPHER;

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
    pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
    pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
    pub fn EVP_idea_cbc() -> *const EVP_CIPHER;

    #[cfg(not(ossl110))]
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ fn main() {

    if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
        println!("cargo:rustc-cfg=boringssl");
        return;
    }

    if let Ok(v) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
+10 −16
Original line number Diff line number Diff line
@@ -343,13 +343,11 @@ impl Cipher {
    }

    #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
    #[cfg(not(boringssl))]
    pub fn bf_cfb64() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_bf_cfb64() as *mut _) }
    }

    #[cfg(not(osslconf = "OPENSSL_NO_BF"))]
    #[cfg(not(boringssl))]
    pub fn bf_ofb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_bf_ofb() as *mut _) }
    }
@@ -380,52 +378,52 @@ impl Cipher {
        unsafe { CipherRef::from_ptr(ffi::EVP_rc4() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia128_cfb128() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cfb128() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia128_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_ecb() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia192_cfb128() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cfb128() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia192_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_ecb() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia256_cfb128() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cfb128() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
    pub fn camellia256_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_ecb() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
    pub fn cast5_cfb64() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cfb64() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
    #[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
    pub fn cast5_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_cast5_ecb() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
    pub fn idea_cfb64() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_idea_cfb64() as *mut _) }
    }

    #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
    #[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
    pub fn idea_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_idea_ecb() as *mut _) }
    }
@@ -441,25 +439,21 @@ impl Cipher {
    }

    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
    #[cfg(not(boringssl))]
    pub fn seed_cbc() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_seed_cbc() as *mut _) }
    }

    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
    #[cfg(not(boringssl))]
    pub fn seed_cfb128() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_seed_cfb128() as *mut _) }
    }

    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
    #[cfg(not(boringssl))]
    pub fn seed_ecb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_seed_ecb() as *mut _) }
    }

    #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
    #[cfg(not(boringssl))]
    pub fn seed_ofb() -> &'static CipherRef {
        unsafe { CipherRef::from_ptr(ffi::EVP_seed_ofb() as *mut _) }
    }
Loading