Blame SOURCES/0128-Measure-kernel-initrd.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Matthew Garrett <mjg59@coreos.com>
d9d99f
Date: Thu, 16 Jul 2015 15:22:34 -0700
d9d99f
Subject: [PATCH] Measure kernel + initrd
d9d99f
d9d99f
Measure the kernel and initrd when loaded on UEFI systems
d9d99f
---
d9d99f
 grub-core/loader/i386/efi/linux.c | 4 ++++
d9d99f
 1 file changed, 4 insertions(+)
d9d99f
d9d99f
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
d9d99f
index 800c3e54022..d837249b4a1 100644
d9d99f
--- a/grub-core/loader/i386/efi/linux.c
d9d99f
+++ b/grub-core/loader/i386/efi/linux.c
d9d99f
@@ -27,6 +27,7 @@
d9d99f
 #include <grub/lib/cmdline.h>
d9d99f
 #include <grub/efi/efi.h>
d9d99f
 #include <grub/efi/linux.h>
d9d99f
+#include <grub/tpm.h>
d9d99f
 
d9d99f
 GRUB_MOD_LICENSE ("GPLv3+");
d9d99f
 
d9d99f
@@ -131,6 +132,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
d9d99f
                         argv[i]);
d9d99f
           goto fail;
d9d99f
         }
d9d99f
+      grub_tpm_measure (ptr, cursize, GRUB_INITRD_PCR, "UEFI Linux initrd");
d9d99f
       ptr += cursize;
d9d99f
       grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
d9d99f
       ptr += ALIGN_UP_OVERHEAD (cursize, 4);
d9d99f
@@ -195,6 +197,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
d9d99f
       goto fail;
d9d99f
     }
d9d99f
 
d9d99f
+  grub_tpm_measure (kernel, filelen, GRUB_KERNEL_PCR, "UEFI Linux kernel");
d9d99f
+
d9d99f
   rc = grub_linuxefi_secure_validate (kernel, filelen);
d9d99f
   if (rc < 0)
d9d99f
     {