public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rust-openssl-kdf] rawhide: Detect OpenSSL 4
@ 2026-08-08 17:08 Peter Robinson
0 siblings, 0 replies; only message in thread
From: Peter Robinson @ 2026-08-08 17:08 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rust-openssl-kdf
Branch : rawhide
Commit : 2110886b5271e3df938862491d255f13970949f6
Author : Peter Robinson <pbrobinson@gmail.com>
Date : 2026-08-08T18:08:10+01:00
Stats : +35/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rust-openssl-kdf/c/2110886b5271e3df938862491d255f13970949f6?branch=rawhide
Log:
Detect OpenSSL 4
---
diff --git a/openssl-kdf-detect-ossl4.patch b/openssl-kdf-detect-ossl4.patch
new file mode 100644
index 0000000..6570b5e
--- /dev/null
+++ b/openssl-kdf-detect-ossl4.patch
@@ -0,0 +1,34 @@
+--- a/build.rs
++++ b/build.rs
+@@ -34,6 +34,12 @@
+ return Err(std::io::ErrorKind::NotFound.into());
+ }
+
++/// Returns the OpenSSL major version number (e.g. 1, 3, 4), or `None` if it
++/// could not be parsed.
++fn openssl_major_version(version: &str) -> Option<u32> {
++ version.split('.').next()?.parse().ok()
++}
++
+ #[allow(unreachable_code)]
+ fn main() {
+ #[allow(unused_mut)]
+@@ -43,13 +49,16 @@
+ {
+ let openssl = pkg_config::probe_library("openssl").unwrap();
+ let openssl_version = &openssl.version;
+- if openssl_version.starts_with("1.") {
++ let major_version = openssl_major_version(openssl_version);
++ if major_version == Some(1) {
+ // Determine if this version of OpenSSL has the requisite patch backported
+ let kdf_h_cts = read_header(&openssl, "openssl/kdf.h").unwrap();
+ if kdf_h_cts.contains("KDF_CTX_new_id") {
+ available_implementations.push(Implementation::Ossl11);
+ }
+- } else if openssl_version.starts_with("3.") {
++ } else if major_version.map_or(false, |major| major >= 3) {
++ // The EVP_KDF API (including KBKDF) has been stable in upstream
++ // OpenSSL since 3.0, so this covers 3.x, 4.x, and later majors.
+ available_implementations.push(Implementation::Ossl3);
+ let core_names_h = read_header(&openssl, "openssl/core_names.h").unwrap();
+ if core_names_h.contains("OSSL_KDF_PARAM_KBKDF_R") {
diff --git a/rust-openssl-kdf.spec b/rust-openssl-kdf.spec
index c6d6857..acb8223 100644
--- a/rust-openssl-kdf.spec
+++ b/rust-openssl-kdf.spec
@@ -12,6 +12,7 @@ Summary: OpenSSL KDF function abstraction
License: MIT
URL: https://crates.io/crates/openssl-kdf
Source: %{crates_source}
+Patch0: openssl-kdf-detect-ossl4.patch
BuildRequires: cargo-rpm-macros >= 24
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-08 17:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-08 17:08 [rpms/rust-openssl-kdf] rawhide: Detect OpenSSL 4 Peter Robinson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox