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