Skip to content

Commit 78f17b1

Browse files
committed
kexec-save-default kexec-select-boot: fix primary handle once more. Can't wait we get rid of this... file must exist and not be empty, and hash output to console must not be silenced
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 6f5f826 commit 78f17b1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

initrd/bin/kexec-save-default

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,9 @@ fi
279279
if [ "$CONFIG_TPM2_TOOLS" = "y" ]; then
280280
if [ -f /tmp/secret/primary.handle ]; then
281281
DEBUG "Hashing TPM2 primary key handle..."
282-
sha256sum /tmp/secret/primary.handle >"$PRIMHASH_FILE" 2>/dev/null ||
282+
sha256sum /tmp/secret/primary.handle > "$PRIMHASH_FILE" ||
283283
die "ERROR: Failed to Hash TPM2 primary key handle!"
284284
DEBUG "TPM2 primary key handle hash saved to $PRIMHASH_FILE"
285-
DEBUG "Hash content: $(cat $PRIMHASH_FILE)"
286285
else
287286
die "ERROR: TPM2 primary key handle file does not exist!"
288287
fi

initrd/bin/kexec-select-boot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ paramsdir="${paramsdir%%/}"
6060

6161
PRIMHASH_FILE="$paramsdir/kexec_primhdl_hash.txt"
6262
if [ "$CONFIG_TPM2_TOOLS" = "y" ]; then
63-
if [ -r "$PRIMHASH_FILE" ]; then
63+
if [ -s "$PRIMHASH_FILE" ]; then
64+
#PRIMHASH_FILE (normally /boot/kexec_primhdl_hash.txt) exists and is not empty
6465
sha256sum -c "$PRIMHASH_FILE" >/dev/null 2>&1 ||
6566
{
6667
echo "FATAL: Hash of TPM2 primary key handle mismatch!"

0 commit comments

Comments
 (0)