summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Byrne <salah.coronya@gmail.com>2021-07-02 23:02:04 -0500
committerJoonas Niilola <juippis@gentoo.org>2021-07-14 09:25:18 +0300
commiteabdf05da8ad3080e931873efc6833f58d0eed47 (patch)
tree10d47479751e565249de4289d31c468a9f19ddcb /app-crypt/tpm2-tools
parentdev-db/mariadb-connector-c: x86 stable wrt bug #802066 (diff)
downloadgentoo-eabdf05da8ad3080e931873efc6833f58d0eed47.tar.gz
gentoo-eabdf05da8ad3080e931873efc6833f58d0eed47.tar.bz2
gentoo-eabdf05da8ad3080e931873efc6833f58d0eed47.zip
app-crypt/tpm2-tools: Enable tests & fix bash completions
Closes: https://bugs.gentoo.org/797685 Package-Manager: Portage-3.0.20, Repoman-3.0.2 Signed-off-by: Christopher Byrne <salah.coronya@gmail.com> Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-crypt/tpm2-tools')
-rw-r--r--app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-fix-tpm-checkquote.patch34
-rw-r--r--app-crypt/tpm2-tools/tpm2-tools-5.1.1-r1.ebuild69
2 files changed, 103 insertions, 0 deletions
diff --git a/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-fix-tpm-checkquote.patch b/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-fix-tpm-checkquote.patch
new file mode 100644
index 000000000000..73fb0e3f487a
--- /dev/null
+++ b/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-fix-tpm-checkquote.patch
@@ -0,0 +1,34 @@
+From 3d7edb1c70cba6c34c71c9b856c07b8adcebb15c Mon Sep 17 00:00:00 2001
+From: Alberto Planas <aplanas@suse.com>
+Date: Thu, 17 Jun 2021 11:07:25 +0200
+Subject: [PATCH] tpm2_checkquote: fix uninitialized variable
+
+The variable `temp_pcrs` is uninitialized, and later partially
+uninitialized when reading the selection data from file.
+
+When activating lto optimizations, this bug presents itself showing an
+error during the read of the quote:
+
+ERROR: Malformed PCR file, pcr count cannot be greater than 32, got: ...
+
+Fixes: #2767
+
+Co-authored-by: Martin Liska <marxin.liska@gmail.com>
+Signed-off-by: Alberto Planas <aplanas@suse.com>
+---
+ tools/misc/tpm2_checkquote.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/misc/tpm2_checkquote.c b/tools/misc/tpm2_checkquote.c
+index 531508579..8d780f111 100644
+--- a/tools/misc/tpm2_checkquote.c
++++ b/tools/misc/tpm2_checkquote.c
+@@ -376,7 +376,7 @@ static tool_rc init(void) {
+ TPM2B_ATTEST *msg = NULL;
+ TPML_PCR_SELECTION pcr_select;
+ tpm2_pcrs *pcrs;
+- tpm2_pcrs temp_pcrs;
++ tpm2_pcrs temp_pcrs = {};
+ tool_rc return_value = tool_rc_general_error;
+
+ msg = message_from_file(ctx.msg_file_path);
diff --git a/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r1.ebuild b/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r1.ebuild
new file mode 100644
index 000000000000..9dde2c97d8e8
--- /dev/null
+++ b/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8,9} )
+inherit autotools bash-completion-r1 python-single-r1
+
+DESCRIPTION="Tools for the TPM 2.0 TSS"
+HOMEPAGE="https://github.com/tpm2-software/tpm2-tools"
+SRC_URI="https://github.com/tpm2-software/${PN}/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+fapi test"
+
+RDEPEND="net-misc/curl:=
+ >=app-crypt/tpm2-tss-3.0.1:=[fapi?]
+ dev-libs/openssl:=
+ ${PYTHON_DEPS}"
+DEPEND="${RDEPEND}
+ test? (
+ app-crypt/swtpm
+ app-crypt/tpm2-abrmd
+ app-editors/vim-core
+ dev-util/cmocka
+ dev-python/pyyaml
+ )"
+BDEPEND="virtual/pkgconfig
+ sys-devel/autoconf-archive"
+
+RESTRICT="!test? ( test )"
+REQUIRED_USE=" ${PYTHON_REQUIRED_USE} "
+
+# One of the tests fails without this patch. See
+# https://github.com/tpm2-software/tpm2-tools/issues/2767
+PATCHES=(
+ "${FILESDIR}/${PN}-5.1.1-fix-tpm-checkquote.patch"
+)
+
+src_prepare() {
+ sed -i \
+ "s/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/" \
+ "${S}/configure.ac" || die
+ "${S}/scripts/utils/man_to_bashcompletion.sh"
+ eautoreconf
+ default
+}
+
+src_configure() {
+ econf \
+ $(use_enable fapi) \
+ $(use_enable test unit) \
+ --with-bashcompdir=$(get_bashcompdir) \
+ --enable-hardening
+}
+
+src_install() {
+ default
+
+ mv "${D}/$(get_bashcompdir)/tpm2_completion.bash" \
+ "${D}/$(get_bashcompdir)/tpm2" || die
+ for B in "${D}"/usr/bin/tpm2_*
+ do
+ TPM2_UTILS="${TPM2_UTILS} $(basename ${B})"
+ done
+ bashcomp_alias tpm2 ${TPM2_UTILS}
+}