]> git.ipfire.org Git - thirdparty/grub.git/commit
util/grub-protect: Fix the hash algorithm of PCR digest
authorGary Lin <glin@suse.com>
Fri, 13 Jun 2025 07:02:33 +0000 (15:02 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 17 Jun 2025 12:10:37 +0000 (14:10 +0200)
commit11caacdb22599fcd448d92dcf4367032f661a23a
tree8fcf7525bd8260e9c3d0728791afa2ad2f8a79e1
parentce23919cac1bee0a9aa73611da66496bf5db57ac
util/grub-protect: Fix the hash algorithm of PCR digest

For tpm2_key_protector and grub-protect, SHA-256 is chosen as the hash
algorithm for the TPM session. However, grub-protect mistakenly used the
hash algorithm of the PCR bank to calculate PCR digest. If the user
chose a PCR bank other than SHA-256, grub-protect created a non-SHA-256
PCR digest to seal the key. But, tpm2_key_protector expects a SHA-256
PCR digest to the TPM unsealing session, so it would fail due to digest
mismatch.

This commit fixes the hash algorithm of PCR digest in grub-protect to
avoid the potential unsealing failure.

Fixes: https://github.com/lcp/grub2/issues/4
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub-protect.c