Measure the kernel commandline

Measure the kernel commandline to ensure that it hasn't been modified
This commit is contained in:
Matthew Garrett 2015-08-09 16:32:29 -07:00
parent 20e355fd5a
commit 2d410729e9

View file

@ -19,6 +19,7 @@
#include <grub/lib/cmdline.h> #include <grub/lib/cmdline.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/tpm.h>
static unsigned int check_arg (char *c, int *has_space) static unsigned int check_arg (char *c, int *has_space)
{ {
@ -67,7 +68,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
{ {
int i, space; int i, space;
unsigned int arg_size; unsigned int arg_size;
char *c; char *c, *orig = buf;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
@ -104,5 +105,8 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
*buf = 0; *buf = 0;
grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_CMDLINE_PCR,
"Kernel Commandline");
return i; return i;
} }