Fix the build issue in TPM module

The original code use deprecated 'Event' data structure with the wrong
member variable names, which result in the build error. This patch
fix it by using 'TCG_PCR_EVENT'.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
This commit is contained in:
Dennis Chen 2017-11-08 09:28:49 +00:00 committed by David Michael
parent 0f7291e018
commit 1e08408cde
1 changed files with 8 additions and 8 deletions

View File

@ -175,7 +175,7 @@ grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
grub_size_t size, grub_uint8_t pcr, grub_size_t size, grub_uint8_t pcr,
const char *description) const char *description)
{ {
Event *event; TCG_PCR_EVENT *event;
grub_efi_status_t status; grub_efi_status_t status;
grub_efi_tpm_protocol_t *tpm; grub_efi_tpm_protocol_t *tpm;
grub_efi_physical_address_t lastevent; grub_efi_physical_address_t lastevent;
@ -188,18 +188,18 @@ grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf,
if (!grub_tpm_present(tpm)) if (!grub_tpm_present(tpm))
return 0; return 0;
event = grub_zalloc(sizeof (Event) + grub_strlen(description) + 1); event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1);
if (!event) if (!event)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
N_("cannot allocate TPM event buffer")); N_("cannot allocate TPM event buffer"));
event->pcrindex = pcr; event->PCRIndex = pcr;
event->eventtype = EV_IPL; event->EventType = EV_IPL;
event->eventsize = grub_strlen(description) + 1; event->EventSize = grub_strlen(description) + 1;
grub_memcpy(event->event, description, event->eventsize); grub_memcpy(event->Event, description, event->EventSize);
algorithm = TCG_ALG_SHA; 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)buf, (grub_uint64_t) size,
algorithm, event, &eventnum, &lastevent); algorithm, event, &eventnum, &lastevent);
switch (status) { switch (status) {
@ -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; event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1;
grub_memcpy(event->Event, description, 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)buf,
(grub_uint64_t) size, event); (grub_uint64_t) size, event);
switch (status) { switch (status) {