]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
measure: also measure forgotten .efifw section
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 23 Apr 2026 09:48:56 +0000 (11:48 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 23 Apr 2026 17:29:47 +0000 (19:29 +0200)
src/measure/measure-tool.c
test/units/TEST-70-TPM2.measure.sh

index af52e5aeb86de33df7eedc6bf5487f63462b8cd7..09c04d888c8338abb7e341f9917f7927281b175c 100644 (file)
@@ -292,9 +292,11 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
                 OPTION_LONG_DATA("profile", "PATH", UNIFIED_SECTION_PROFILE,
                                  "Path to profile file (→ .profile)"): {}
                 OPTION_LONG_DATA("hwids", "PATH", UNIFIED_SECTION_HWIDS,
-                                 "Path to HWIDs file (→ .hwids)"):
+                                 "Path to HWIDs file (→ .hwids)"): {}
+                OPTION_LONG_DATA("efifw", "PATH", UNIFIED_SECTION_EFIFW,
+                                 "Path to EFI firmware file (→ .efifw)"): {}
                         /* Make sure that if new sections are added, the list here is updated. */
-                        assert_cc(UNIFIED_SECTION_HWIDS + 1 + 1 /* FIXME */ == _UNIFIED_SECTION_MAX);
+                        assert_cc(UNIFIED_SECTION_EFIFW + 1 == _UNIFIED_SECTION_MAX);
                         assert(opt->data < _UNIFIED_SECTION_MAX);
 
                         r = parse_path_argument(arg, /* suppress_root= */ false, arg_sections + opt->data);
index bf30bd57b3340dcfcdd31184290fb930c589672d..30fa51e52137c2077623f2cf5542bf14e00408e6 100755 (executable)
@@ -45,6 +45,12 @@ cat >/tmp/result.json <<EOF
 EOF
 "$SD_MEASURE" calculate --linux=/tmp/tpmdata1 --initrd=/tmp/tpmdata2 --bank=sha1 --bank=sha256 --bank=sha384 --bank=sha512 --phase=foo -j | diff -u - /tmp/result.json
 
+cat >/tmp/result <<EOF
+11:sha1=8a625cbc3c497b9a86dcf4f6a32582895ce969bb
+EOF
+"$SD_MEASURE" calculate \
+              --{linux,osrel,cmdline,initrd,ucode,splash,dtb,dtbauto,uname,sbat,pcrpkey,profile,hwids,efifw}=/tmp/tpmdata1 \
+              --bank=sha1 --phase=foo | cmp - /tmp/result
 rm /tmp/result /tmp/result.json
 
 # Generate key pair