From 5224cf1327c697f6f6a2118a122d9152e7a288f3 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 22 Apr 2024 07:10:22 +0000 Subject: [PATCH] app-crypt/tpm2-tools: Sync with Gentoo It's from Gentoo commit 6012458803eaa9f9ae7617d26297b3f006c8dfae. --- ...eventlog.sh-Fix-accidental-deletions.patch | 68 +++++++++++++++++++ .../tpm2-tools/tpm2-tools-5.6-r1.ebuild | 4 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/files/tpm2-tools-5.6-test-eventlog.sh-Fix-accidental-deletions.patch diff --git a/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/files/tpm2-tools-5.6-test-eventlog.sh-Fix-accidental-deletions.patch b/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/files/tpm2-tools-5.6-test-eventlog.sh-Fix-accidental-deletions.patch new file mode 100644 index 0000000000..7274ee4082 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/files/tpm2-tools-5.6-test-eventlog.sh-Fix-accidental-deletions.patch @@ -0,0 +1,68 @@ +From 4dec5295361d753c3466bc9e8b0ae3a3cc58dff5 Mon Sep 17 00:00:00 2001 +From: Juergen Repp +Date: Thu, 4 Apr 2024 09:42:51 +0200 +Subject: [PATCH] test eventlog.sh Fix accidental deletions. + +* Accidental deletions made in commit 196e3d439407e81040ced054a8ed302489348a9d + are undone. +* python3 is used as default instead of python. + +Signed-off-by: Juergen Repp +--- + test/integration/tests/eventlog.sh | 33 ++++++++++++++++++++++++++++-- + 1 file changed, 31 insertions(+), 2 deletions(-) + +diff --git a/test/integration/tests/eventlog.sh b/test/integration/tests/eventlog.sh +index 9d5290f0..e7c13706 100755 +--- a/test/integration/tests/eventlog.sh ++++ b/test/integration/tests/eventlog.sh +@@ -3,7 +3,7 @@ + set -E + shopt -s expand_aliases + +-alias python=${PYTHON-python} ++alias python=${PYTHON-python3} + + yaml_validate() { + cmd=$1 +@@ -88,7 +88,36 @@ expect_pass() { + expect_fail + expect_fail foo + expect_fail foo bar +-expect_fail ${srcdir}/test/integration/fix ++expect_fail ${srcdir}/test/integration/fixtures/event-bad.bin ++ ++expect_pass ${srcdir}/test/integration/fixtures/specid-vendordata.bin ++expect_pass ${srcdir}/test/integration/fixtures/event.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-uefivar.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-uefiaction.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-uefiservices.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-uefi-sha1-log.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-bootorder.bin ++expect_pass ${srcdir}/test/integration/fixtures/event-postcode.bin ++ ++# Make sure that --eventlog-version=2 works on complete TPM2 logs ++expect_pass ${srcdir}/test/integration/fixtures/event-arch-linux.bin --eventlog-version=2 ++expect_pass ${srcdir}/test/integration/fixtures/event-gce-ubuntu-2104-log.bin --eventlog-version=2 ++expect_pass ${srcdir}/test/integration/fixtures/event-sd-boot-fedora37.bin --eventlog-version=2 ++expect_pass ${srcdir}/test/integration/fixtures/event-moklisttrusted.bin --eventlog-version=2 ++ ++# Pick an event with leading whitespace and validate we have ++# preserved it correctly after parsing the YAML ++event=$(yaml_validate "print(y['events'][80]['Event']['String'])" < ${srcdir}/test/integration/fixtures/event-moklisttrusted.bin.yaml | tr -d '\0') ++expect=$(echo -e "grub_cmd: menuentry UEFI Firmware Settings --id uefi-firmware {\n\t\tfwsetup\n\t}") ++if test "$event" != "$expect" ++then ++ echo "Got $event" ++ echo "Want $expect" ++ exit 1 ++fi ++ ++# Compare strings generated by tpm2_eventlog with binary data of the corresponding ++# events. + hex_file="${srcdir}/test/integration/fixtures/event-moklisttrusted-hex.yaml" + tool_file="${srcdir}/test/integration/fixtures/event-moklisttrusted.bin.yaml" + +-- +2.43.2 + diff --git a/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild b/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild index 04fb5536f1..ab59eed952 100644 --- a/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild +++ b/sdk_container/src/third_party/portage-stable/app-crypt/tpm2-tools/tpm2-tools-5.6-r1.ebuild @@ -42,6 +42,7 @@ PATCHES=( "${WORKDIR}/${PN}-5.6-tpm2_eventlog-Create-raw-and-pretty-print-format-for.patch" "${FILESDIR}/${PN}-5.6-Makefile-am-Dont-require-pandoc-for-tests.patch" "${FILESDIR}/${PN}-5.6-bashism.patch" + "${FILESDIR}/${PN}-5.6-test-eventlog.sh-Fix-accidental-deletions.patch" ) python_check_deps() { @@ -73,7 +74,8 @@ src_install() { local utils=( "${ED}"/usr/bin/tpm2_* ) utils=("${utils[@]##*/}") # these utiltites don't have bash completions - local nobashcomp=( tpm2_encodeobject tpm2_getpolicydigest tpm2_sessionconfig ) + local nobashcomp=( tpm2_encodeobject tpm2_getpolicydigest\ + tpm2_sessionconfig tpm2_tr_encode) mapfile -d $'\0' -t utils < <(printf '%s\0' "${utils[@]}" | grep -Ezvw "${nobashcomp[@]/#/-e}") bashcomp_alias tpm2 "${utils[@]}" }