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

Merge pull request #1761 from vishwin/master

Expose EVP_PKEY_security_bits for LibreSSL 3.6.0 and later
parents d780a8fe 0d8d5022
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
        if libressl_version >= 0x3_05_00_00_0 {
            cfgs.push("libressl350");
        }
        if libressl_version >= 0x3_06_00_00_0 {
            cfgs.push("libressl360");
        }
        if libressl_version >= 0x3_07_00_00_0 {
            cfgs.push("libressl370");
        }
+1 −1
Original line number Diff line number Diff line
@@ -427,7 +427,7 @@ cfg_if! {
        const_ptr_api! {
            extern "C" {
                pub fn EVP_PKEY_bits(key: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int;
                #[cfg(ossl110)]
                #[cfg(any(ossl110, libressl360))]
                pub fn EVP_PKEY_security_bits(pkey: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int;
            }
        }
+2 −2
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ where
    ///
    ///Bits of security is defined in NIST SP800-57.
    #[corresponds(EVP_PKEY_security_bits)]
    #[cfg(ossl110)]
    #[cfg(any(ossl110, libressl360))]
    pub fn security_bits(&self) -> u32 {
        unsafe { ffi::EVP_PKEY_security_bits(self.as_ptr()) as u32 }
    }
@@ -1028,7 +1028,7 @@ mod tests {
    }

    #[test]
    #[cfg(ossl110)]
    #[cfg(any(ossl110, libressl360))]
    fn test_security_bits() {
        let group = crate::ec::EcGroup::from_curve_name(crate::nid::Nid::SECP521R1).unwrap();
        let ec_key = EcKey::generate(&group).unwrap();