grub2/0011-tpm-Fix-build-error.patch
Michael Chang 8e26f638e0 Accepting request 477882 from home:michael-chang:devel:tpm
- TPM Support (FATE#315831)
  * 0001-tpm-Core-TPM-support.patch
  * 0002-tpm-Measure-kernel-initrd.patch
  * 0003-tpm-Add-BIOS-boot-measurement.patch
  * 0004-tpm-Rework-linux-command.patch
  * 0005-tpm-Rework-linux16-command.patch
  * 0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch
  * 0007-tpm-Measure-the-kernel-commandline.patch
  * 0008-tpm-Measure-commands.patch
  * 0009-tpm-Measure-multiboot-images-and-modules.patch
  * 0010-tpm-Fix-boot-when-there-s-no-TPM.patch
  * 0011-tpm-Fix-build-error.patch
  * 0012-tpm-Build-tpm-as-module.patch
- grub2.spec : Add grub-tpm.efi for Secure Boot

OBS-URL: https://build.opensuse.org/request/show/477882
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=263
2017-03-09 06:19:36 +00:00

75 lines
2.9 KiB
Diff

Index: grub-2.02~rc1/grub-core/kern/efi/tpm.c
===================================================================
--- grub-2.02~rc1.orig/grub-core/kern/efi/tpm.c
+++ grub-2.02~rc1/grub-core/kern/efi/tpm.c
@@ -161,21 +161,12 @@ grub_tpm_execute(PassThroughToTPM_InputP
}
}
-typedef struct {
- grub_uint32_t pcrindex;
- grub_uint32_t eventtype;
- grub_uint8_t digest[20];
- grub_uint32_t eventsize;
- grub_uint8_t event[1];
-} Event;
-
-
static grub_err_t
grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
grub_size_t size, grub_uint8_t pcr,
const char *description)
{
- Event *event;
+ TCG_PCR_EVENT *event;
grub_efi_status_t status;
grub_efi_tpm_protocol_t *tpm;
grub_efi_physical_address_t lastevent;
@@ -188,18 +179,18 @@ grub_tpm1_log_event(grub_efi_handle_t tp
if (!grub_tpm_present(tpm))
return 0;
- event = grub_zalloc(sizeof (Event) + grub_strlen(description) + 1);
+ event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1);
if (!event)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
N_("cannot allocate TPM event buffer"));
- event->pcrindex = pcr;
- event->eventtype = EV_IPL;
- event->eventsize = grub_strlen(description) + 1;
- grub_memcpy(event->event, description, event->eventsize);
+ event->PCRIndex = pcr;
+ event->EventType = EV_IPL;
+ event->EventSize = grub_strlen(description) + 1;
+ grub_memcpy(event->Event, description, event->EventSize);
algorithm = TCG_ALG_SHA;
- status = efi_call_7 (tpm->log_extend_event, tpm, buf, (grub_uint64_t) size,
+ status = efi_call_7 (tpm->log_extend_event, tpm, (grub_efi_physical_address_t)(grub_addr_t) buf, (grub_uint64_t) size,
algorithm, event, &eventnum, &lastevent);
switch (status) {
@@ -245,7 +236,7 @@ grub_tpm2_log_event(grub_efi_handle_t tp
event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1;
grub_memcpy(event->Event, description, grub_strlen(description) + 1);
- status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, buf,
+ status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_efi_physical_address_t)(grub_addr_t) buf,
(grub_uint64_t) size, event);
switch (status) {
Index: grub-2.02~rc1/include/grub/efi/tpm.h
===================================================================
--- grub-2.02~rc1.orig/include/grub/efi/tpm.h
+++ grub-2.02~rc1/include/grub/efi/tpm.h
@@ -129,7 +129,7 @@ struct grub_efi_tpm2_protocol
grub_efi_boolean_t *EventLogTruncated);
grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this,
grub_efi_uint64_t Flags,
- grub_efi_physical_address_t *DataToHash,
+ grub_efi_physical_address_t DataToHash,
grub_efi_uint64_t DataToHashLen,
EFI_TCG2_EVENT *EfiTcgEvent);
grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this,