Skip to content

Commit 1ac5229

Browse files
committed
kexec-save-default: 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 1ac5229

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

initrd/bin/kexec-save-default

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,13 @@ if [ ! -d $paramsdir ]; then
277277
fi
278278

279279
if [ "$CONFIG_TPM2_TOOLS" = "y" ]; then
280-
if [ -f /tmp/secret/primary.handle ]; then
280+
if [ -s /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
287-
die "ERROR: TPM2 primary key handle file does not exist!"
286+
die "ERROR: TPM2 primary key handle file does not exist or is empty!"
288287
fi
289288
fi
290289

0 commit comments

Comments
 (0)