Skip to content

Commit

Permalink
kexec-save-default kexec-select-boot: fix primary handle once more. C…
Browse files Browse the repository at this point in the history
…an'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>
  • Loading branch information
tlaurion committed Dec 18, 2024
1 parent 6f5f826 commit 78f17b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions initrd/bin/kexec-save-default
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,9 @@ fi
if [ "$CONFIG_TPM2_TOOLS" = "y" ]; then
if [ -f /tmp/secret/primary.handle ]; then
DEBUG "Hashing TPM2 primary key handle..."
sha256sum /tmp/secret/primary.handle >"$PRIMHASH_FILE" 2>/dev/null ||
sha256sum /tmp/secret/primary.handle > "$PRIMHASH_FILE" ||
die "ERROR: Failed to Hash TPM2 primary key handle!"
DEBUG "TPM2 primary key handle hash saved to $PRIMHASH_FILE"
DEBUG "Hash content: $(cat $PRIMHASH_FILE)"
else
die "ERROR: TPM2 primary key handle file does not exist!"
fi
Expand Down
3 changes: 2 additions & 1 deletion initrd/bin/kexec-select-boot
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ paramsdir="${paramsdir%%/}"

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

0 comments on commit 78f17b1

Please sign in to comment.