pcrlock: skip make-policy tests if environment lacks TPM support

make-policy needs to write into an NVindex. For that we need an actual
TPM.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
This commit is contained in:
Ludwig Nussel
2024-04-29 14:34:25 +02:00
committed by Akarithos
parent 8ab0aaea3c
commit d2bb93565c

View File

@@ -117,10 +117,12 @@ if [[ -n "$SD_STUB" ]]; then
[[ "$uki_stdin" == "$uki_pipe" ]]
fi
PIN=huhu "$SD_PCRLOCK" make-policy --pcr="$PCRS" --recovery-pin=query
# Repeat immediately (this call will have to reuse the nvindex, rather than create it)
"$SD_PCRLOCK" make-policy --pcr="$PCRS"
"$SD_PCRLOCK" make-policy --pcr="$PCRS" --force
if "$SD_PCRLOCK" is-supported; then
PIN=huhu "$SD_PCRLOCK" make-policy --pcr="$PCRS" --recovery-pin=query
# Repeat immediately (this call will have to reuse the nvindex, rather than create it)
"$SD_PCRLOCK" make-policy --pcr="$PCRS"
"$SD_PCRLOCK" make-policy --pcr="$PCRS" --force
fi
img="/tmp/pcrlock.img"
truncate -s 20M "$img"