|
|
2ae5c1e |
From 85e100453d04e56088e4b9782d2f06dc0122587f Mon Sep 17 00:00:00 2001
|
|
|
b9efc54 |
From: Matthew Garrett <mjg59@coreos.com>
|
|
|
b9efc54 |
Date: Tue, 1 Sep 2015 16:02:55 -0700
|
|
|
2ae5c1e |
Subject: [PATCH 85/85] Measure multiboot images and modules
|
|
|
b9efc54 |
|
|
|
b9efc54 |
---
|
|
|
b9efc54 |
grub-core/loader/i386/multiboot_mbi.c | 3 +++
|
|
|
b9efc54 |
grub-core/loader/multiboot.c | 2 ++
|
|
|
b9efc54 |
grub-core/loader/multiboot_mbi2.c | 3 +++
|
|
|
b9efc54 |
3 files changed, 8 insertions(+)
|
|
|
b9efc54 |
|
|
|
b9efc54 |
diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
|
|
|
b9efc54 |
index f60b702..43a08e4 100644
|
|
|
b9efc54 |
--- a/grub-core/loader/i386/multiboot_mbi.c
|
|
|
b9efc54 |
+++ b/grub-core/loader/i386/multiboot_mbi.c
|
|
|
b9efc54 |
@@ -36,6 +36,7 @@
|
|
|
b9efc54 |
#include <grub/net.h>
|
|
|
b9efc54 |
#include <grub/i18n.h>
|
|
|
b9efc54 |
#include <grub/lib/cmdline.h>
|
|
|
b9efc54 |
+#include <grub/tpm.h>
|
|
|
b9efc54 |
|
|
|
b9efc54 |
#ifdef GRUB_MACHINE_EFI
|
|
|
b9efc54 |
#include <grub/efi/efi.h>
|
|
|
b9efc54 |
@@ -164,6 +165,8 @@ grub_multiboot_load (grub_file_t file, const char *filename)
|
|
|
b9efc54 |
return grub_errno;
|
|
|
b9efc54 |
}
|
|
|
b9efc54 |
|
|
|
b9efc54 |
+ grub_tpm_measure((unsigned char*)buffer, len, GRUB_KERNEL_PCR, filename);
|
|
|
b9efc54 |
+
|
|
|
b9efc54 |
header = find_header (buffer, len);
|
|
|
b9efc54 |
|
|
|
b9efc54 |
if (header == 0)
|
|
|
b9efc54 |
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
|
|
|
b9efc54 |
index 64a6513..58e6329 100644
|
|
|
b9efc54 |
--- a/grub-core/loader/multiboot.c
|
|
|
b9efc54 |
+++ b/grub-core/loader/multiboot.c
|
|
|
b9efc54 |
@@ -43,6 +43,7 @@
|
|
|
b9efc54 |
#include <grub/memory.h>
|
|
|
b9efc54 |
#include <grub/i18n.h>
|
|
|
b9efc54 |
#include <grub/efi/sb.h>
|
|
|
b9efc54 |
+#include <grub/tpm.h>
|
|
|
b9efc54 |
|
|
|
b9efc54 |
GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
b9efc54 |
|
|
|
b9efc54 |
@@ -385,6 +386,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
|
|
|
b9efc54 |
}
|
|
|
b9efc54 |
|
|
|
b9efc54 |
grub_file_close (file);
|
|
|
b9efc54 |
+ grub_tpm_measure (module, size, GRUB_KERNEL_PCR, argv[0]);
|
|
|
b9efc54 |
return GRUB_ERR_NONE;
|
|
|
b9efc54 |
}
|
|
|
b9efc54 |
|
|
|
b9efc54 |
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
|
|
b9efc54 |
index f147d67..8f163ea 100644
|
|
|
b9efc54 |
--- a/grub-core/loader/multiboot_mbi2.c
|
|
|
b9efc54 |
+++ b/grub-core/loader/multiboot_mbi2.c
|
|
|
b9efc54 |
@@ -36,6 +36,7 @@
|
|
|
b9efc54 |
#include <grub/i18n.h>
|
|
|
b9efc54 |
#include <grub/net.h>
|
|
|
b9efc54 |
#include <grub/lib/cmdline.h>
|
|
|
b9efc54 |
+#include <grub/tpm.h>
|
|
|
b9efc54 |
|
|
|
b9efc54 |
#if defined (GRUB_MACHINE_EFI)
|
|
|
b9efc54 |
#include <grub/efi/efi.h>
|
|
|
b9efc54 |
@@ -126,6 +127,8 @@ grub_multiboot_load (grub_file_t file, const char *filename)
|
|
|
b9efc54 |
|
|
|
b9efc54 |
COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0);
|
|
|
b9efc54 |
|
|
|
b9efc54 |
+ grub_tpm_measure ((unsigned char *)buffer, len, GRUB_KERNEL_PCR, filename);
|
|
|
b9efc54 |
+
|
|
|
b9efc54 |
header = find_header (buffer, len);
|
|
|
b9efc54 |
|
|
|
b9efc54 |
if (header == 0)
|
|
|
b9efc54 |
--
|
|
|
b9efc54 |
2.5.0
|
|
|
b9efc54 |
|