Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose EVP_PKEY_security_bits for LibreSSL 3.6.0 and later #1761

Merged
merged 2 commits into from Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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