]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: test the new srk extraction functionality 29947/head
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Nov 2023 21:46:44 +0000 (22:46 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Nov 2023 11:50:20 +0000 (12:50 +0100)
test/units/testsuite-70.cryptsetup.sh

index a1c6035e45b054e0f434b6bcc82dd8687134d9dd..1db425dfe8dfb5e5c14c319b65bb772064f2fc8c 100755 (executable)
@@ -135,6 +135,12 @@ if tpm_has_pcr sha256 12; then
     tpm2_pcrread -Q -o /tmp/pcr.dat sha256:12
     CURRENT_PCR_VALUE=$(cat /sys/class/tpm/tpm0/pcr-sha256/12)
     tpm2_readpublic -c 0x81000001 -o /tmp/srk.pub
+    systemd-analyze srk > /tmp/srk2.pub
+    cmp /tmp/srk.pub /tmp/srk2.pub
+    if [ -f /run/systemd/tpm2-srk-public-key.tpm2b_public ] ; then
+        cmp /tmp/srk.pub /run/systemd/tpm2-srk-public-key.tpm2b_public
+    fi
+
     PASSWORD=passphrase systemd-cryptenroll --tpm2-device-key=/tmp/srk.pub --tpm2-pcrs="12:sha256=$CURRENT_PCR_VALUE" "$IMAGE"
     systemd-cryptsetup attach test-volume "$IMAGE" - tpm2-device=auto,headless=1
     systemd-cryptsetup detach test-volume