Commit 632ed2be authored by Steffen Eiden's avatar Steffen Eiden
Browse files

fixup! Add get_security_bits for PKey

parent 3f2563f6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -143,6 +143,11 @@ cfg_if! {
        pub unsafe fn EVP_PKEY_bits(pkey: *const EVP_PKEY) -> c_int {
            EVP_PKEY_get_bits(pkey)
        }

        #[inline]
        pub unsafe fn EVP_PKEY_security_bits(pkey: *const EVP_PKEY) -> c_int {
            EVP_PKEY_get_security_bits(pkey)
        }
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -1030,7 +1030,7 @@ mod tests {
    fn test_security_bits() {
        let group = crate::ec::EcGroup::from_curve_name(crate::nid::Nid::SECP521R1).unwrap();
        let ec_key = EcKey::generate(&group).unwrap();
        let pkey: PKey<Private> = ec_key.clone().try_into().unwrap();
        let pkey: PKey<Private> = ec_key.try_into().unwrap();

        assert_eq!(pkey.security_bits(), 256);
    }