]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pcrlock: also refuse lacking SHA-256 support early when creating policy
authorLennart Poettering <lennart@poettering.net>
Mon, 2 Jun 2025 10:32:33 +0000 (12:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Jun 2025 14:12:45 +0000 (16:12 +0200)
This will fail eventually, but let's be explicit early here.

src/pcrlock/pcrlock.c

index 652692ea812d64325a4f6ccc2d330df5620561fd..4232d99e0c26ff13298c4b6dd32e5c441586bd19 100644 (file)
@@ -4511,6 +4511,8 @@ static int make_policy(bool force, RecoveryPinMode recovery_pin_mode) {
 
         if (!tpm2_supports_command(tc, TPM2_CC_PolicyAuthorizeNV))
                 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "TPM2 does not support PolicyAuthorizeNV command, refusing.");
+        if (!tpm2_supports_alg(tc, TPM2_ALG_SHA256))
+                return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "TPM2 does not support SHA-256 hash algorithm, refusing.");
 
         _cleanup_(tpm2_handle_freep) Tpm2Handle *srk_handle = NULL;