Skip to content

Commit

Permalink
Merge pull request #1761 from vishwin/master
Browse files Browse the repository at this point in the history
Expose EVP_PKEY_security_bits for LibreSSL 3.6.0 and later
  • Loading branch information
sfackler committed Dec 20, 2022
2 parents d780a8f + 0d8d502 commit 64ba480
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions openssl-sys/build/cfgs.rs
Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/evp.rs
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions openssl/src/pkey.rs
Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 64ba480

Please sign in to comment.