15a2072
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
15a2072
From: Hans de Goede <hdegoede@redhat.com>
15a2072
Date: Fri, 15 Jun 2018 09:25:00 +0200
15a2072
Subject: [PATCH] TPM: Fix hash_log_extend_event function prototype
15a2072
15a2072
The DataToHash argument is a efi_physical_address, not a *pointer* to
15a2072
a efi_physical_address.
15a2072
15a2072
This distinction is important for 32 bits builds, where the pointer is
15a2072
only 32 bits where as an efi_physical_address is 64 bits.
15a2072
15a2072
Fixing this fixes the tpm code not working with 32 bits build and grub
15a2072
showing multiple:
15a2072
15a2072
error: Invalid parameter
15a2072
15a2072
Messages during boot, followed by a "press any key to continue" message.
15a2072
15a2072
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
15a2072
---
15a2072
 grub-core/kern/efi/tpm.c | 2 +-
15a2072
 include/grub/efi/tpm.h   | 2 +-
15a2072
 2 files changed, 2 insertions(+), 2 deletions(-)
15a2072
15a2072
diff --git a/grub-core/kern/efi/tpm.c b/grub-core/kern/efi/tpm.c
15a2072
index c9fb3c133f3..36e1f69df16 100644
15a2072
--- a/grub-core/kern/efi/tpm.c
15a2072
+++ b/grub-core/kern/efi/tpm.c
15a2072
@@ -245,7 +245,7 @@ grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
15a2072
   event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1;
15a2072
   grub_memcpy(event->Event, description, grub_strlen(description) + 1);
15a2072
 
15a2072
-  status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, buf,
15a2072
+  status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (unsigned long) buf,
15a2072
 		       (grub_uint64_t) size, event);
15a2072
 
15a2072
   switch (status) {
15a2072
diff --git a/include/grub/efi/tpm.h b/include/grub/efi/tpm.h
15a2072
index e2aff4a3c22..63d8a0fe714 100644
15a2072
--- a/include/grub/efi/tpm.h
15a2072
+++ b/include/grub/efi/tpm.h
15a2072
@@ -129,7 +129,7 @@ struct grub_efi_tpm2_protocol
15a2072
 				      grub_efi_boolean_t *EventLogTruncated);
15a2072
   grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this,
15a2072
 					      grub_efi_uint64_t Flags,
15a2072
-					      grub_efi_physical_address_t *DataToHash,
15a2072
+					      grub_efi_physical_address_t DataToHash,
15a2072
 					      grub_efi_uint64_t DataToHashLen,
15a2072
 					      EFI_TCG2_EVENT *EfiTcgEvent);
15a2072
   grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this,