commit: 39238b8aa14809710f3d02fcf1d03bb2173a51c3 Author: orbea <orbea <AT> riseup <DOT> net> AuthorDate: Sun May 25 04:25:44 2025 +0000 Commit: orbea <orbea <AT> riseup <DOT> net> CommitDate: Sun May 25 04:25:44 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=39238b8a
dev-libs/libtpms: add 0.10.0, 0.10.0-r1 Upstream-PR: https://github.com/stefanberger/libtpms/pull/502 Signed-off-by: orbea <orbea <AT> riseup.net> dev-libs/libtpms/Manifest | 1 + .../files/libtpms-0.10.0-Remove-WError.patch | 13 ++++++ .../libtpms/files/libtpms-0.10.0-libressl.patch | 28 ++++++++++++ ...2-Add-padding-to-OBJECT-for-32bit-targets.patch | 32 +++++++++++++ dev-libs/libtpms/libtpms-0.10.0-r1.ebuild | 53 ++++++++++++++++++++++ dev-libs/libtpms/libtpms-0.10.0.ebuild | 52 +++++++++++++++++++++ 6 files changed, 179 insertions(+) diff --git a/dev-libs/libtpms/Manifest b/dev-libs/libtpms/Manifest index b253048..eabf8c7 100644 --- a/dev-libs/libtpms/Manifest +++ b/dev-libs/libtpms/Manifest @@ -1 +1,2 @@ +DIST libtpms-0.10.0.tar.gz 1397526 BLAKE2B 8d05023f5f0fc8dd20cbf5606fa7be391b7dfdc45710c76387c97cef6afb555bd5f0920f73e4578719bdad8e64ba239c14f8c63ed1232c4c3e1b4a80c247b8e0 SHA512 a728188c26447656f43298d1475ebccf0f074d9474780a71fc64baf1ac8b6f6569c90e5ad07098dddc711ba1080eef409c1ac5334d054e7f144e48fa21b66df9 DIST libtpms-0.9.6.tar.gz 1264338 BLAKE2B 7b127ef370a48214814bb9ad0e8461ed0af21f32ab84f243945980c5e36ba5e374b4de7a83bf9c67c29264609063d48eae2dae83832daed70170bb1ed39eafea SHA512 35f26e4849eb98cd73461aff439c19f77bbbcde9b7661402e3d419354c4dcddd057349c4f7178573f1ceea2e95326498eb9afea3bd48064bbff534fc7f6939c3 diff --git a/dev-libs/libtpms/files/libtpms-0.10.0-Remove-WError.patch b/dev-libs/libtpms/files/libtpms-0.10.0-Remove-WError.patch new file mode 100644 index 0000000..1516dbe --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.10.0-Remove-WError.patch @@ -0,0 +1,13 @@ +diff --git a/configure.ac b/configure.ac +index 6fe0b21..5c0ca29 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -349,7 +349,7 @@ if test "x$enable_hardening" != "xno"; then + AC_SUBST([HARDENING_LDFLAGS]) + fi + +-AM_CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Werror -Wshadow -Wreturn-type -Wsign-compare -Wno-self-assign -Wmissing-prototypes" ++AM_CFLAGS="$CFLAGS $COVERAGE_CFLAGS -Wall -Wshadow -Wreturn-type -Wsign-compare -Wno-self-assign -Wmissing-prototypes" + AM_CFLAGS="$AM_CFLAGS" + AM_LDFLAGS="$LDFLAGS $COVERAGE_LDFLAGS" + diff --git a/dev-libs/libtpms/files/libtpms-0.10.0-libressl.patch b/dev-libs/libtpms/files/libtpms-0.10.0-libressl.patch new file mode 100644 index 0000000..32644a1 --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.10.0-libressl.patch @@ -0,0 +1,28 @@ +https://github.com/stefanberger/libtpms/pull/502 + +From b8af81fb31dbabfc1ac069b56e8a8a9501b90ac0 Mon Sep 17 00:00:00 2001 +From: orbea <[email protected]> +Date: Sat, 24 May 2025 20:19:35 -0700 +Subject: [PATCH] tpm2: fix build for LibreSSL 4.1.0 + +With LibreSSL 4.1.0 the EC_POINTs_mul function was removed, but the +newer OpenSSL 3 code path works instead. + +Signed-off-by: orbea <[email protected]> +--- + src/tpm2/crypto/openssl/BnToOsslMath.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tpm2/crypto/openssl/BnToOsslMath.c b/src/tpm2/crypto/openssl/BnToOsslMath.c +index 7ba48bed3..2b6cc1722 100644 +--- a/src/tpm2/crypto/openssl/BnToOsslMath.c ++++ b/src/tpm2/crypto/openssl/BnToOsslMath.c +@@ -621,7 +621,7 @@ LIB_EXPORT BOOL BnEccModMult2(bigPoint R, // OUT: computed point + EC_POINT_mul(E->G, pR, bnD, pQ, bnU, E->CTX); + else + { +-#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x4010000fL) + EC_POINT *pR1 = EC_POINT_new(E->G); + EC_POINT *pR2 = EC_POINT_new(E->G); + int OK; 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 0000000..d9a3c17 --- /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 <[email protected]> +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 <[email protected]> +--- + 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 0000000..b3519b5 --- /dev/null +++ b/dev-libs/libtpms/libtpms-0.10.0-r1.ebuild @@ -0,0 +1,53 @@ +# 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" + "${FILESDIR}/${PN}-0.10.0-libressl.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 +} diff --git a/dev-libs/libtpms/libtpms-0.10.0.ebuild b/dev-libs/libtpms/libtpms-0.10.0.ebuild new file mode 100644 index 0000000..c7c2356 --- /dev/null +++ b/dev-libs/libtpms/libtpms-0.10.0.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-libressl.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 +}
