public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/tpm2-tools] rawhide: OpenSSL 4 build fixes
@ 2026-06-12 16:33 Simo Sorce
  0 siblings, 0 replies; only message in thread
From: Simo Sorce @ 2026-06-12 16:33 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/tpm2-tools
            Branch : rawhide
            Commit : e4ef687d8774c79ec95683b7a215697f054668c2
            Author : Simo Sorce <simo@redhat.com>
            Date   : 2026-04-17T16:25:04-04:00
            Stats  : +86/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/tpm2-tools/c/e4ef687d8774c79ec95683b7a215697f054668c2?branch=rawhide

            Log:
            OpenSSL 4 build fixes

Signed-off-by: Simo Sorce <simo@redhat.com>

---
diff --git a/0001-Use-ASN1-getters-instead-of-direct-struct-access.patch b/0001-Use-ASN1-getters-instead-of-direct-struct-access.patch
new file mode 100644
index 0000000..8bdd530
--- /dev/null
+++ b/0001-Use-ASN1-getters-instead-of-direct-struct-access.patch
@@ -0,0 +1,80 @@
+From 87eda54b584ed9abe8118b0ed5569dea95b62a70 Mon Sep 17 00:00:00 2001
+From: Simo Sorce <simo@redhat.com>
+Date: Fri, 17 Apr 2026 16:13:18 -0400
+Subject: [PATCH] Use ASN1 getters instead of direct struct access
+
+This updates the code to interact correctly with modern OpenSSL versions
+(4.0+) where these structures are opaque, ensuring API compatibility and
+preventing build errors.
+
+Co-authored-by: Gemini <gemini@google.com>
+Signed-off-by: Simo Sorce <simo@redhat.com>
+---
+ lib/object.c       | 9 ++++-----
+ lib/tpm2_convert.c | 8 ++++----
+ 2 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/lib/object.c b/lib/object.c
+index 1d6cd42..17bf77a 100644
+--- a/lib/object.c
++++ b/lib/object.c
+@@ -1,4 +1,3 @@
+-
+ #include <stdio.h>
+ 
+ #include "files.h"
+@@ -251,21 +250,21 @@ tool_rc tpm2_util_object_fetch_priv_pub_from_tpk(const char *objectstr,
+         goto ret;
+     }
+ 
+-    int pub_len = tpk->pubkey->length;
+-    int priv_len = tpk->privkey->length;
++    int pub_len = ASN1_STRING_length(tpk->pubkey);
++    int priv_len = ASN1_STRING_length(tpk->privkey);
+     if (pub_len < 1 || priv_len < 1) {
+         LOG_ERR("Error deserializing TSS Privkey Object");
+         goto ret;
+     }
+ 
+-    rc = Tss2_MU_TPM2B_PUBLIC_Unmarshal(tpk->pubkey->data, pub_len,
++    rc = Tss2_MU_TPM2B_PUBLIC_Unmarshal(ASN1_STRING_get0_data(tpk->pubkey), pub_len,
+         NULL, pub);
+     if (rc != tool_rc_success) {
+         LOG_ERR("Error deserializing public portion of object");
+         goto ret;
+     }
+ 
+-    rc = Tss2_MU_TPM2B_PRIVATE_Unmarshal(tpk->privkey->data, priv_len,
++    rc = Tss2_MU_TPM2B_PRIVATE_Unmarshal(ASN1_STRING_get0_data(tpk->privkey), priv_len,
+         NULL, priv);
+     if (rc != tool_rc_success) {
+         LOG_ERR("Error deserializing private portion of object");
+diff --git a/lib/tpm2_convert.c b/lib/tpm2_convert.c
+index d3a30eb..e071a95 100644
+--- a/lib/tpm2_convert.c
++++ b/lib/tpm2_convert.c
+@@ -499,8 +499,8 @@ static bool pop_ecdsa(const char *path, TPMS_SIGNATURE_ECDSA *ecdsa) {
+         LOG_ERR("oom");
+         return false;
+     }
+-    memcpy(R->buffer, r->data, r->length);
+-    R->size = r->length;
++    memcpy(R->buffer, ASN1_STRING_get0_data(r), ASN1_STRING_length(r));
++    R->size = ASN1_STRING_length(r);
+     ASN1_INTEGER_free(r);
+ 
+     /*
+@@ -512,8 +512,8 @@ static bool pop_ecdsa(const char *path, TPMS_SIGNATURE_ECDSA *ecdsa) {
+         LOG_ERR("oom");
+         return false;
+     }
+-    memcpy(S->buffer, s->data, s->length);
+-    S->size = s->length;
++    memcpy(S->buffer, ASN1_STRING_get0_data(s), ASN1_STRING_length(s));
++    S->size = ASN1_STRING_length(s);
+     ASN1_INTEGER_free(s);
+ 
+     return true;
+-- 
+2.53.0
+

diff --git a/tpm2-tools.spec b/tpm2-tools.spec
index b6d6941..203bf8c 100644
--- a/tpm2-tools.spec
+++ b/tpm2-tools.spec
@@ -2,13 +2,15 @@
 
 Name:    tpm2-tools
 Version: 5.7
-Release: 5%{?candidate:.%{candidate}}%{?dist}
+Release: 6%{?candidate:.%{candidate}}%{?dist}
 Summary: A bunch of TPM testing toolS build upon tpm2-tss
 
 License: BSD-3-Clause
 URL:     https://github.com/tpm2-software/tpm2-tools
 Source0: https://github.com/tpm2-software/tpm2-tools/releases/download/%{version}%{?candidate:-%{candidate}}/%{name}-%{version}%{?candidate:-%{candidate}}.tar.gz
 
+Patch1: 0001-Use-ASN1-getters-instead-of-direct-struct-access.patch
+
 BuildRequires: make
 BuildRequires: gcc-c++
 BuildRequires: libtool
@@ -55,6 +57,9 @@ tpm2-tools is a batch of tools for tpm2.0. It is based on tpm2-tss.
 %{_mandir}/man1/tss2_*.1.gz
 
 %changelog
+* Fri Apr 17 2026 Simo Sorce <ssorce@redhat.com> - 5.7-6
+- OpenSSL 4 build fixes
+
 * Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 5.7-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-12 16:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12 16:33 [rpms/tpm2-tools] rawhide: OpenSSL 4 build fixes Simo Sorce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox