dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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