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