aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororbea <orbea@riseup.net>2022-10-07 08:28:29 -0700
committerQuentin Retornaz <gentoo@retornaz.com>2022-10-07 23:11:14 +0200
commit3e6fcbdaa8f248d37bb4bb06bfc0973dd35768da (patch)
tree2bde10b393ce017202d6c350cd34ebbc4704bf87 /app-crypt
parentdev-util/cargo-audit: Remove old version (diff)
downloadlibressl-3e6fcbdaa8f248d37bb4bb06bfc0973dd35768da.tar.gz
libressl-3e6fcbdaa8f248d37bb4bb06bfc0973dd35768da.tar.bz2
libressl-3e6fcbdaa8f248d37bb4bb06bfc0973dd35768da.zip
app-crypt/tpm2-tss: Add 3.2.0-r4
Signed-off-by: orbea <orbea@riseup.net> Signed-off-by: Quentin Retornaz <gentoo@retornaz.com>
Diffstat (limited to 'app-crypt')
-rw-r--r--app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-Dont-run-systemd-sysusers-in-Makefile.patch57
-rw-r--r--app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-slibtool.patch49
-rw-r--r--app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-test-fix-usage-of-FILE-in-unit-test-fapi-io.patch146
-rw-r--r--app-crypt/tpm2-tss/tpm2-tss-3.2.0-r4.ebuild105
4 files changed, 357 insertions, 0 deletions
diff --git a/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-Dont-run-systemd-sysusers-in-Makefile.patch b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-Dont-run-systemd-sysusers-in-Makefile.patch
new file mode 100644
index 0000000..90b1280
--- /dev/null
+++ b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-Dont-run-systemd-sysusers-in-Makefile.patch
@@ -0,0 +1,57 @@
+diff --git a/Makefile.am b/Makefile.am
+index ce19aac3..22a8c075 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -498,10 +498,9 @@ fapi-config.json: dist/fapi-config.json.in
+ -e 's|[@]userstatedir@|$(userstatedir)|g' \
+ < "$<" > "$@"
+
+-sysusers_DATA = dist/sysusers.d/tpm2-tss.conf
+ tmpfiles_DATA = tpm2-tss-fapi.conf
+
+-EXTRA_DIST += dist/sysusers.d/tpm2-tss.conf dist/tmpfiles.d/tpm2-tss-fapi.conf.in
++EXTRA_DIST += dist/tmpfiles.d/tpm2-tss-fapi.conf.in
+ CLEANFILES += tpm2-tss-fapi.conf
+
+ # We have to do this ourselves, in order to get absolute paths
+@@ -726,13 +725,6 @@ EXTRA_DIST += dist/tpm-udev.rules
+
+ install-dirs:
+ if HOSTOS_LINUX
+-if SYSD_SYSUSERS
+- @echo "systemd-sysusers $(DESTDIR)$(sysconfdir)/sysusers.d/tpm2-tss.conf"
+- @systemd-sysusers $(DESTDIR)$(sysconfdir)/sysusers.d/tpm2-tss.conf || echo "WARNING Failed to create the tss user and group"
+-else
+- @echo "call make_tss_user_and_group"
+- @$(call make_tss_user_and_group) || echo "WARNING Failed to create the tss user and group"
+-endif
+ if SYSD_TMPFILES
+ @echo "systemd-tmpfiles --create $(DESTDIR)$(sysconfdir)/tmpfiles.d/tpm2-tss-fapi.conf"
+ @systemd-tmpfiles --create $(DESTDIR)$(sysconfdir)/tmpfiles.d/tpm2-tss-fapi.conf|| echo "WARNING Failed to create the FAPI directories with the correct permissions"
+diff --git a/configure.ac b/configure.ac
+index 6482944f..44c0e383 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -483,22 +483,9 @@ AS_IF([test "x$enable_integration" = "xyes" && test "x$enable_self_generated_cer
+ [AC_MSG_WARN([Running integration tests without EK certificate verification, use --enable-self-generated-certificate for full test coverage])])
+
+ # Check for systemd helper tools used by make install
+-AC_CHECK_PROG(systemd_sysusers, systemd-sysusers, yes)
+-AM_CONDITIONAL(SYSD_SYSUSERS, test "x$systemd_sysusers" = "xyes")
+ AC_CHECK_PROG(systemd_tmpfiles, systemd-tmpfiles, yes)
+ AM_CONDITIONAL(SYSD_TMPFILES, test "x$systemd_tmpfiles" = "xyes")
+
+-# Check all tools used by make install
+-AS_IF([test "$HOSTOS" = "Linux"],
+- [ AC_CHECK_PROG(useradd, useradd, yes)
+- AC_CHECK_PROG(groupadd, groupadd, yes)
+- AC_CHECK_PROG(adduser, adduser, yes)
+- AC_CHECK_PROG(addgroup, addgroup, yes)
+- AS_IF([test "x$addgroup" != "xyes" && test "x$groupadd" != "xyes" ],
+- [AC_MSG_ERROR([addgroup or groupadd are needed.])])
+- AS_IF([test "x$adduser" != "xyes" && test "x$useradd" != "xyes" ],
+- [AC_MSG_ERROR([adduser or useradd are needed.])])])
+-
+ AC_SUBST([PATH])
+
+ dnl --------- Doxy Gen -----------------------
diff --git a/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-slibtool.patch b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-slibtool.patch
new file mode 100644
index 0000000..b7d5e5c
--- /dev/null
+++ b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-slibtool.patch
@@ -0,0 +1,49 @@
+Bug: https://bugs.gentoo.org/858674
+Upstream-PR: https://github.com/tpm2-software/tpm2-tss/pull/2391
+Upstream-Commit: https://github.com/tpm2-software/tpm2-tss/commit/5e626ab72283017cf4cb2dc4b101d16a58a6c470
+
+From f61fd726c064e909b7576f233f0ad0e885e1752e Mon Sep 17 00:00:00 2001
+From: orbea <orbea@riseup.net>
+Date: Thu, 14 Jul 2022 09:22:49 -0700
+Subject: [PATCH] build: Remove erroneous comma
+
+When building tpm2-tss with slibtool instead of GNU libtool the build
+will fail during 'make check'. This happens because there is an extra
+erroneous comma which is then passed to gcc causing it to fail to find a
+non-existent file. With GNU libtool it appears that the comma is
+silently removed while slibtool does not do this.
+
+rdlibtool --tag=CC --mode=link gcc -I./src -I./include/tss2 -I./test/fuzz/tcti -std=c99 -Wall -Wextra -Wformat-security -Werror -fstack-protector-all -fpic -fPIC -Wno-missing-braces -Wstrict-overflow=5 -DINTERNALBUILD=1 -I./include -I./src/tss2-mu -I./src/tss2-sys -I./src/tss2-esys -I./src/tss2-fapi -I./test/data -Wno-unused-parameter -Wno-missing-field-initializers -DTOP_SOURCEDIR="." -DTOP_SOURCEDIR="." -g -Wl,--wrap=read -Wl,--wrap=write, -Wl,--wrap=poll -Wl,--wrap=open -o test/unit/tcti-device test/unit/tcti_device-tcti-device.o src/tss2-tcti/test_unit_tcti_device-tcti-common.o src/tss2-tcti/test_unit_tcti_device-tcti-device.o -lcmocka src/tss2-mu/libtss2-mu.la libutil.la
+
+rdlibtool: lconf: {.name="libtool"}.
+rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/tpm2-tss"}.
+rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 15835}.
+rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = 3.
+rdlibtool: lconf: found "/tmp/tpm2-tss/libtool".
+rdlibtool: link: gcc test/unit/tcti_device-tcti-device.o src/tss2-tcti/test_unit_tcti_device-tcti-common.o src/tss2-tcti/test_unit_tcti_device-tcti-device.o .libs/libutil.a -I./src -I./include/tss2 -I./test/fuzz/tcti -std=c99 -Wall -Wextra -Wformat-security -Werror -fstack-protector-all -fpic -fPIC -Wno-missing-braces -Wstrict-overflow=5 -DINTERNALBUILD=1 -I./include -I./src/tss2-mu -I./src/tss2-sys -I./src/tss2-esys -I./src/tss2-fapi -I./test/data -Wno-unused-parameter -Wno-missing-field-initializers -DTOP_SOURCEDIR="." -DTOP_SOURCEDIR="." -g -Wl,--wrap=read -Wl,--wrap=write, -Wl,--wrap=poll -Wl,--wrap=open -lcmocka -Lsrc/tss2-mu/.libs -ltss2-mu -L.libs -o test/unit/.libs/tcti-device
+/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find : No such file or directory
+collect2: error: ld returned 1 exit status
+rdlibtool: exec error upon slbt_exec_link_create_executable(), line 1745: (see child process error messages).
+rdlibtool: < returned to > slbt_exec_link(), line 2155.
+make[1]: *** [Makefile:14899: test/unit/tcti-device] Error 2
+make[1]: Leaving directory '/tmp/tpm2-tss'
+make: *** [Makefile:29619: check-am] Error 2
+
+Signed-off-by: orbea <orbea@riseup.net>
+---
+ Makefile-test.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile-test.am b/Makefile-test.am
+index bb933e956..533dfb38a 100644
+--- a/Makefile-test.am
++++ b/Makefile-test.am
+@@ -413,7 +413,7 @@ if UNIT
+ if ENABLE_TCTI_DEVICE
+ test_unit_tcti_device_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
+ test_unit_tcti_device_LDADD = $(CMOCKA_LIBS) $(libtss2_mu) $(libutil)
+-test_unit_tcti_device_LDFLAGS = -Wl,--wrap=read -Wl,--wrap=write, -Wl,--wrap=poll \
++test_unit_tcti_device_LDFLAGS = -Wl,--wrap=read -Wl,--wrap=write -Wl,--wrap=poll \
+ -Wl,--wrap=open
+ test_unit_tcti_device_SOURCES = test/unit/tcti-device.c \
+ src/tss2-tcti/tcti-common.c \
diff --git a/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-test-fix-usage-of-FILE-in-unit-test-fapi-io.patch b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-test-fix-usage-of-FILE-in-unit-test-fapi-io.patch
new file mode 100644
index 0000000..aff792a
--- /dev/null
+++ b/app-crypt/tpm2-tss/files/tpm2-tss-3.2.0-test-fix-usage-of-FILE-in-unit-test-fapi-io.patch
@@ -0,0 +1,146 @@
+https://github.com/tpm2-software/tpm2-tss/commit/bda22252507124bb8e466ac2f0c61d5ebed9027d
+https://github.com/tpm2-software/tpm2-tss/pull/2423
+https://bugs.gentoo.org/833530
+
+From bda22252507124bb8e466ac2f0c61d5ebed9027d Mon Sep 17 00:00:00 2001
+From: William Roberts <william.c.roberts@intel.com>
+Date: Mon, 26 Sep 2022 15:16:15 -0500
+Subject: [PATCH] test: fix usage of FILE in unit test fapi-io
+
+The unit test had a static FILE structure used to pass to stdio FILE *
+routines as a dummy value to indicate to use the __real_xxx variant of
+the mocked function. This doesn't work when FILE is opaque as the
+compiler cannot figure out how much storage space is needed for a FILE
+struct.
+
+Fix this by passing a dummy pointer to a data type the compiler knows
+about and casting it to FILE pointer.
+
+Fixes: #2419
+
+Signed-off-by: William Roberts <william.c.roberts@intel.com>
+---
+ test/unit/fapi-io.c | 30 ++++++++++++++++--------------
+ 1 file changed, 16 insertions(+), 14 deletions(-)
+
+diff --git a/test/unit/fapi-io.c b/test/unit/fapi-io.c
+index dbadcb47..8a883a43 100644
+--- a/test/unit/fapi-io.c
++++ b/test/unit/fapi-io.c
+@@ -38,7 +38,9 @@
+ bool wrap_fcntl_test = false;
+ bool wrap_malloc_test = false;
+ bool wrap_read_test = false;
+-FILE mock_stream; /**< stream will be used to activate wrapper.*/
++char _mock_stream; /**< stream will be used to activate wrapper.*/
++
++#define MOCK_STREAM ((FILE *)(&_mock_stream))
+
+ /*
+ * Wrapper functions for file system io.
+@@ -74,7 +76,7 @@ __real_fclose(FILE *stream, ...);
+ int
+ __wrap_fclose(FILE *stream, ...)
+ {
+- if (stream != &mock_stream) {
++ if (stream != MOCK_STREAM) {
+ return __real_fclose(stream);
+ }
+ return mock_type(int);
+@@ -86,7 +88,7 @@ __real_fseek(FILE *stream, long offset, int whence, ...);
+ int
+ __wrap_fseek(FILE *stream, long offset, int whence, ...)
+ {
+- if (stream != &mock_stream) {
++ if (stream != MOCK_STREAM) {
+ return __real_fseek(stream, offset, whence);
+ }
+ return mock_type(int);
+@@ -98,7 +100,7 @@ __real_ftell(FILE *stream, ...);
+ long
+ __wrap_ftell(FILE *stream, ...)
+ {
+- if (stream != &mock_stream) {
++ if (stream != MOCK_STREAM) {
+ return __real_ftell(stream);
+ }
+ return mock_type(int);
+@@ -135,7 +137,7 @@ __real_fileno(FILE *stream, ...);
+ int
+ __wrap_fileno(FILE *stream, ...)
+ {
+- if (stream != &mock_stream) {
++ if (stream != MOCK_STREAM) {
+ return __real_fileno(stream);
+ }
+ return 1;
+@@ -179,7 +181,7 @@ check_io_read_async(void **state) {
+ assert_int_equal(r, TSS2_FAPI_RC_IO_ERROR);
+
+ wrap_fcntl_test = true;
+- will_return(__wrap_fopen, &mock_stream);
++ will_return(__wrap_fopen, MOCK_STREAM);
+ will_return(__wrap_fcntl, -1);
+ will_return_always(__wrap_fclose, 0);
+ errno = EAGAIN;
+@@ -187,8 +189,8 @@ check_io_read_async(void **state) {
+ r = ifapi_io_read_async(&io, "tss_unit_dummyf");
+ assert_int_equal(r, TSS2_FAPI_RC_IO_ERROR);
+
+- will_return(__wrap_fopen, &mock_stream);
+- will_return(__wrap_fopen, &mock_stream);
++ will_return(__wrap_fopen, MOCK_STREAM);
++ will_return(__wrap_fopen, MOCK_STREAM);
+ will_return(__wrap_fcntl, 0);
+ will_return(__wrap_fseek, 0);
+ will_return(__wrap_ftell, 1);
+@@ -202,8 +204,8 @@ check_io_read_async(void **state) {
+
+ wrap_malloc_test = false;
+
+- will_return(__wrap_fopen, &mock_stream);
+- will_return(__wrap_fopen, &mock_stream);
++ will_return(__wrap_fopen, MOCK_STREAM);
++ will_return(__wrap_fopen, MOCK_STREAM);
+ will_return(__wrap_fcntl, 0);
+ will_return(__wrap_fseek, 0);
+ will_return(__wrap_ftell, 1);
+@@ -236,7 +238,7 @@ check_io_read_finish(void **state) {
+ will_return_always(__wrap_fclose, 0);
+ io.char_buffer = &io_char_buffer[0];
+ io.buffer_length = 10;
+- io.stream = &mock_stream;
++ io.stream = MOCK_STREAM;
+ errno = EAGAIN;
+ r = ifapi_io_read_finish(&io, &buffer[0], &count);
+ assert_int_equal(r, TSS2_FAPI_RC_TRY_AGAIN);
+@@ -298,7 +300,7 @@ check_io_write_async(void **state) {
+ assert_int_equal(r, TSS2_FAPI_RC_IO_ERROR);
+
+ wrap_fcntl_test = true;
+- will_return(__wrap_fopen, &mock_stream);
++ will_return(__wrap_fopen, MOCK_STREAM);
+ will_return(__wrap_fcntl, -1);
+
+ errno = EAGAIN;
+@@ -306,7 +308,7 @@ check_io_write_async(void **state) {
+ assert_int_equal(r, TSS2_FAPI_RC_IO_ERROR);
+
+ io.char_rbuffer = NULL;
+- will_return(__wrap_fopen, &mock_stream);
++ will_return(__wrap_fopen, MOCK_STREAM);
+ will_return(__wrap_fcntl, 0);
+ will_return(__wrap_fcntl, 0);
+ will_return(__wrap_fcntl, -1);
+@@ -345,7 +347,7 @@ check_io_write_finish(void **state) {
+ will_return_always(__wrap_fclose, 0);
+
+ wrap_write_test = true;
+- io.stream = &mock_stream;
++ io.stream = MOCK_STREAM;
+ will_return(__wrap_write, -1);
+ errno = EAGAIN;
+ r = ifapi_io_write_finish(&io);
+--
+2.35.1
+
diff --git a/app-crypt/tpm2-tss/tpm2-tss-3.2.0-r4.ebuild b/app-crypt/tpm2-tss/tpm2-tss-3.2.0-r4.ebuild
new file mode 100644
index 0000000..adb5298
--- /dev/null
+++ b/app-crypt/tpm2-tss/tpm2-tss-3.2.0-r4.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic linux-info multilib-minimal tmpfiles udev
+
+DESCRIPTION="TCG Trusted Platform Module 2.0 Software Stack"
+HOMEPAGE="https://github.com/tpm2-software/tpm2-tss"
+SRC_URI="https://github.com/tpm2-software/${PN}/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0/3"
+KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86"
+IUSE="doc +fapi +openssl mbedtls static-libs test"
+
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="^^ ( mbedtls openssl )
+ fapi? ( openssl !mbedtls )"
+
+RDEPEND="acct-group/tss
+ acct-user/tss
+ fapi? ( dev-libs/json-c:=[${MULTILIB_USEDEP}]
+ >=net-misc/curl-7.80.0[${MULTILIB_USEDEP}] )
+ mbedtls? ( net-libs/mbedtls:=[${MULTILIB_USEDEP}] )
+ openssl? ( dev-libs/openssl:=[${MULTILIB_USEDEP}] )"
+
+DEPEND="${RDEPEND}
+ test? ( app-crypt/swtpm
+ dev-libs/uthash
+ dev-util/cmocka
+ fapi? ( >=net-misc/curl-7.80.0 ) )"
+BDEPEND="sys-apps/acl
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-3.2.0-Dont-run-systemd-sysusers-in-Makefile.patch"
+ "${FILESDIR}/${PN}-3.2.0-slibtool.patch" # 858674
+ "${FILESDIR}/${PN}-3.2.0-test-fix-usage-of-FILE-in-unit-test-fapi-io.patch"
+ "${FILESDIR}/${PN}-3.2.0-libressl.patch"
+)
+
+pkg_setup() {
+ local CONFIG_CHECK=" \
+ ~TCG_TPM
+ "
+ linux-info_pkg_setup
+ kernel_is ge 4 12 0 || ewarn "At least kernel 4.12.0 is required"
+}
+
+src_prepare() {
+ default
+
+ # See bug #833887 (and similar); eautoreconf means .pc file gets wrong version.
+ sed -i \
+ "s/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/" \
+ "configure.ac" || die
+
+ eautoreconf
+}
+
+multilib_src_configure() {
+ # tests fail with LTO enabbled. See bug 865275 and 865279
+ filter-lto
+
+ ECONF_SOURCE=${S} econf \
+ --localstatedir=/var \
+ $(multilib_native_use_enable doc doxygen-doc) \
+ $(use_enable fapi) \
+ $(use_enable static-libs static) \
+ $(multilib_native_use_enable test unit) \
+ $(multilib_native_use_enable test integration) \
+ $(multilib_native_use_enable test self-generated-certificate) \
+ --disable-tcti-libtpms \
+ --disable-defaultflags \
+ --disable-weakcrypto \
+ --with-crypto="$(usex mbedtls mbed ossl)" \
+ --with-runstatedir=/run \
+ --with-udevrulesdir="$(get_udevdir)/rules.d" \
+ --with-udevrulesprefix=60- \
+ --with-sysusersdir="/usr/lib/sysusers.d" \
+ --with-tmpfilesdir="/usr/lib/tmpfiles.d"
+}
+
+multilib_src_install() {
+ default
+
+ if [[ ${PV} != $(sed -n -e 's/^Version: //p' "${ED}/usr/$(get_libdir)/pkgconfig/tss2-sys.pc" || die) ]] ; then
+ # Safeguard for bug #833887
+ die "pkg-config file version doesn't match ${PV}! Please report a bug!"
+ fi
+
+ find "${D}" -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+ tmpfiles_process tpm2-tss-fapi.conf
+ udev_reload
+}
+
+pkg_postrm() {
+ udev_reload
+}