15a207
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
15a207
From: Matthew Garrett <mjg59@coreos.com>
15a207
Date: Sun, 9 Aug 2015 16:32:29 -0700
15a207
Subject: [PATCH] Measure the kernel commandline
15a207
15a207
Measure the kernel commandline to ensure that it hasn't been modified
15a207
---
15a207
 grub-core/lib/cmdline.c | 6 +++++-
15a207
 1 file changed, 5 insertions(+), 1 deletion(-)
15a207
15a207
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
15a207
index 970ea868c14..6b56304d4a7 100644
15a207
--- a/grub-core/lib/cmdline.c
15a207
+++ b/grub-core/lib/cmdline.c
15a207
@@ -19,6 +19,7 @@
15a207
 
15a207
 #include <grub lib="" cmdline.h="">
15a207
 #include <grub misc.h="">
15a207
+#include <grub tpm.h="">
15a207
 
15a207
 static int
15a207
 is_hex(char c)
15a207
@@ -79,7 +80,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
15a207
 {
15a207
   int i, space;
15a207
   unsigned int arg_size;
15a207
-  char *c;
15a207
+  char *c, *orig = buf;
15a207
 
15a207
   for (i = 0; i < argc; i++)
15a207
     {
15a207
@@ -125,5 +126,8 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
15a207
 
15a207
   *buf = 0;
15a207
 
15a207
+  grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_CMDLINE_PCR,
15a207
+		    "Kernel Commandline");
15a207
+
15a207
   return i;
15a207
 }