From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1721439-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 9CD4E1582EF
	for <garchives@archives.gentoo.org>; Tue, 25 Feb 2025 04:15:50 +0000 (UTC)
Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	(Authenticated sender: relay-lists.gentoo.org@gentoo.org)
	by smtp.gentoo.org (Postfix) with ESMTPSA id 40B3C34319F
	for <garchives@archives.gentoo.org>; Tue, 25 Feb 2025 04:15:50 +0000 (UTC)
Received: from bobolink.gentoo.org (localhost [127.0.0.1])
	by bobolink.gentoo.org (Postfix) with ESMTP id 3EEFD11037D;
	Tue, 25 Feb 2025 04:15:49 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by bobolink.gentoo.org (Postfix) with ESMTPS id 31ABD110260
	for <gentoo-commits@lists.gentoo.org>; Tue, 25 Feb 2025 04:15:49 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D1409342FE2
	for <gentoo-commits@lists.gentoo.org>; Tue, 25 Feb 2025 04:15:48 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 314A52712
	for <gentoo-commits@lists.gentoo.org>; Tue, 25 Feb 2025 04:15:47 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1740456887.7dffb121b44164c788806b71c16fec40f39754d1.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libtpms/files/, dev-libs/libtpms/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-libs/libtpms/files/libtpms-0.10.0-tpm2-Add-padding-to-OBJECT-for-32bit-targets.patch dev-libs/libtpms/libtpms-0.10.0-r1.ebuild
X-VCS-Directories: dev-libs/libtpms/files/ dev-libs/libtpms/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 7dffb121b44164c788806b71c16fec40f39754d1
X-VCS-Branch: master
Date: Tue, 25 Feb 2025 04:15:47 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 46ff3ca1-9242-419e-bcc1-4c5e81f128ed
X-Archives-Hash: 157e179c1437d6693f19f351fb67098e

commit:     7dffb121b44164c788806b71c16fec40f39754d1
Author:     Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Tue Feb 25 00:36:04 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Feb 25 04:14:47 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dffb121

dev-libs/libtpms: Fix nvram_offsets test on 32-bit platforms

Closes: https://bugs.gentoo.org/948139
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40742
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...2-Add-padding-to-OBJECT-for-32bit-targets.patch | 32 +++++++++++++
 dev-libs/libtpms/libtpms-0.10.0-r1.ebuild          | 52 ++++++++++++++++++++++
 2 files changed, 84 insertions(+)

diff --git a/dev-libs/libtpms/files/libtpms-0.10.0-tpm2-Add-padding-to-OBJECT-for-32bit-targets.patch b/dev-libs/libtpms/files/libtpms-0.10.0-tpm2-Add-padding-to-OBJECT-for-32bit-targets.patch
new file mode 100644
index 000000000000..d9a3c17b57fb
--- /dev/null
+++ b/dev-libs/libtpms/files/libtpms-0.10.0-tpm2-Add-padding-to-OBJECT-for-32bit-targets.patch
@@ -0,0 +1,32 @@
+Bug: https://bugs.gentoo.org/948139
+
+From 095a085b6f447551110e09b2013c6a21c2a29f2d Mon Sep 17 00:00:00 2001
+From: Stefan Berger <stefanb@linux.ibm.com>
+Date: Fri, 15 Nov 2024 08:07:23 -0500
+Subject: [PATCH] tpm2: Add padding to OBJECT for 32bit targets
+
+The nvram_offsets test fails on 32bit targets due to an unexpected size
+of an OBJECT. This was due to missing padding.
+
+Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
+---
+ src/tpm2/Global.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/tpm2/Global.h b/src/tpm2/Global.h
+index 910b940..c4d7176 100644
+--- a/src/tpm2/Global.h
++++ b/src/tpm2/Global.h
+@@ -265,6 +265,9 @@ typedef struct OBJECT
+     // this field carries additional metadata
+     // needed to derive the proof value for
+     // the object.
++#if __LONG_WIDTH__ == 32
++    UINT8               _pad1[4]; /* 32 bit targets need padding */
++#endif
+ 
+     // libtpms added: SEED_COMPAT_LEVEL to use for deriving child keys
+     SEED_COMPAT_LEVEL   seedCompatLevel;
+-- 
+2.45.3
+

diff --git a/dev-libs/libtpms/libtpms-0.10.0-r1.ebuild b/dev-libs/libtpms/libtpms-0.10.0-r1.ebuild
new file mode 100644
index 000000000000..6bb387ee03b5
--- /dev/null
+++ b/dev-libs/libtpms/libtpms-0.10.0-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools eapi9-ver
+
+DESCRIPTION="Library providing software emulation of a TPM"
+HOMEPAGE="https://github.com/stefanberger/libtpms"
+SRC_URI="https://github.com/stefanberger/libtpms/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+
+DEPEND="dev-libs/openssl:="
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-0.10.0-Remove-WError.patch"
+	"${FILESDIR}/${PN}-0.10.0-tpm2-Add-padding-to-OBJECT-for-32bit-targets.patch"
+)
+
+src_prepare() {
+	default
+	eautoreconf
+}
+
+src_configure() {
+	# --disable-hardening because it just sets what our toolchain
+	# already does. If the user wants to disable that in their *FLAGS,
+	# or via USE on toolchain packages, honour that.
+	econf \
+		--with-openssl \
+		--disable-hardening
+}
+
+src_install() {
+	default
+	find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+	if ver_replacing -lt 0.8.0; then
+		elog "Versions of libtpms prior to 0.8.0 generate weaker than expected TPM 2.0 RSA"
+		elog "keys due to a flawed key creation algorithm. Because fixing this would render"
+		elog "existing sealed data inaccessible, to use the corrected algorithm, the old"
+		elog "TPM state file must be deleted and a new TPM state file created. Data still"
+		elog "sealed using the old state file will be permanently inaccessible. For the"
+		elog "details see https://github.com/stefanberger/libtpms/issues/183"
+	fi
+}