|
|
d9d99f |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
d9d99f |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
d9d99f |
Date: Fri, 15 Jun 2018 09:58:50 +0200
|
|
|
d9d99f |
Subject: [PATCH] TPM: Fix compiler warnings
|
|
|
d9d99f |
|
|
|
d9d99f |
Stop defining our own Event type in tpm.c instead use the one from
|
|
|
d9d99f |
the header, so that it matches the function prototype.
|
|
|
d9d99f |
Note this requires some further code changes to go from all lowercaps
|
|
|
d9d99f |
of the private Event type to the CamelCaps from the header.
|
|
|
d9d99f |
|
|
|
d9d99f |
Also cast buf, which gets passed as a efi_physicall_address_t to an
|
|
|
d9d99f |
integer, to avoid the compiler complaining about passing a pointer as
|
|
|
d9d99f |
an integer.
|
|
|
d9d99f |
|
|
|
d9d99f |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
d9d99f |
---
|
|
|
d9d99f |
grub-core/kern/efi/tpm.c | 24 ++++++++----------------
|
|
|
d9d99f |
1 file changed, 8 insertions(+), 16 deletions(-)
|
|
|
d9d99f |
|
|
|
d9d99f |
diff --git a/grub-core/kern/efi/tpm.c b/grub-core/kern/efi/tpm.c
|
|
|
b71686 |
index 36e1f69df..0d3ebe22e 100644
|
|
|
d9d99f |
--- a/grub-core/kern/efi/tpm.c
|
|
|
d9d99f |
+++ b/grub-core/kern/efi/tpm.c
|
|
|
d9d99f |
@@ -161,21 +161,12 @@ grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf,
|
|
|
d9d99f |
}
|
|
|
d9d99f |
}
|
|
|
d9d99f |
|
|
|
d9d99f |
-typedef struct {
|
|
|
d9d99f |
- grub_uint32_t pcrindex;
|
|
|
d9d99f |
- grub_uint32_t eventtype;
|
|
|
d9d99f |
- grub_uint8_t digest[20];
|
|
|
d9d99f |
- grub_uint32_t eventsize;
|
|
|
d9d99f |
- grub_uint8_t event[1];
|
|
|
d9d99f |
-} Event;
|
|
|
d9d99f |
-
|
|
|
d9d99f |
-
|
|
|
d9d99f |
static grub_err_t
|
|
|
d9d99f |
grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
|
|
|
d9d99f |
grub_size_t size, grub_uint8_t pcr,
|
|
|
d9d99f |
const char *description)
|
|
|
d9d99f |
{
|
|
|
d9d99f |
- Event *event;
|
|
|
d9d99f |
+ TCG_PCR_EVENT *event;
|
|
|
d9d99f |
grub_efi_status_t status;
|
|
|
d9d99f |
grub_efi_tpm_protocol_t *tpm;
|
|
|
d9d99f |
grub_efi_physical_address_t lastevent;
|
|
|
d9d99f |
@@ -188,18 +179,19 @@ grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
|
|
|
d9d99f |
if (!grub_tpm_present(tpm))
|
|
|
d9d99f |
return 0;
|
|
|
d9d99f |
|
|
|
d9d99f |
- event = grub_zalloc(sizeof (Event) + grub_strlen(description) + 1);
|
|
|
d9d99f |
+ event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1);
|
|
|
d9d99f |
if (!event)
|
|
|
d9d99f |
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
|
|
d9d99f |
N_("cannot allocate TPM event buffer"));
|
|
|
d9d99f |
|
|
|
d9d99f |
- event->pcrindex = pcr;
|
|
|
d9d99f |
- event->eventtype = EV_IPL;
|
|
|
d9d99f |
- event->eventsize = grub_strlen(description) + 1;
|
|
|
d9d99f |
- grub_memcpy(event->event, description, event->eventsize);
|
|
|
d9d99f |
+ event->PCRIndex = pcr;
|
|
|
d9d99f |
+ event->EventType = EV_IPL;
|
|
|
d9d99f |
+ event->EventSize = grub_strlen(description) + 1;
|
|
|
d9d99f |
+ grub_memcpy(event->Event, description, event->EventSize);
|
|
|
d9d99f |
|
|
|
d9d99f |
algorithm = TCG_ALG_SHA;
|
|
|
d9d99f |
- status = efi_call_7 (tpm->log_extend_event, tpm, buf, (grub_uint64_t) size,
|
|
|
d9d99f |
+ status = efi_call_7 (tpm->log_extend_event, tpm,
|
|
|
d9d99f |
+ (unsigned long) buf, (grub_uint64_t) size,
|
|
|
d9d99f |
algorithm, event, &eventnum, &lastevent);
|
|
|
d9d99f |
|
|
|
d9d99f |
switch (status) {
|