加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0156-TPM-Fix-hash_log_extend_event-function-prototype.patch 2.02 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 15 Jun 2018 09:25:00 +0200
Subject: [PATCH] TPM: Fix hash_log_extend_event function prototype
The DataToHash argument is a efi_physical_address, not a *pointer* to
a efi_physical_address.
This distinction is important for 32 bits builds, where the pointer is
only 32 bits where as an efi_physical_address is 64 bits.
Fixing this fixes the tpm code not working with 32 bits build and grub
showing multiple:
error: Invalid parameter
Messages during boot, followed by a "press any key to continue" message.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
grub-core/kern/efi/tpm.c | 2 +-
include/grub/efi/tpm.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/kern/efi/tpm.c b/grub-core/kern/efi/tpm.c
index c9fb3c133..36e1f69df 100644
--- a/grub-core/kern/efi/tpm.c
+++ b/grub-core/kern/efi/tpm.c
@@ -245,7 +245,7 @@ grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
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, (unsigned long) buf,
(grub_uint64_t) size, event);
switch (status) {
diff --git a/include/grub/efi/tpm.h b/include/grub/efi/tpm.h
index e2aff4a3c..63d8a0fe7 100644
--- a/include/grub/efi/tpm.h
+++ b/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,
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化