Make TPM errors less fatal
Handle TPM errors, and stop trying to use the TPM once we hit one.
This commit is contained in:
parent
5962f7d5e7
commit
bf25cda14e
11 changed files with 29 additions and 4 deletions
|
@ -725,6 +725,7 @@ grub_dl_load_file (const char *filename)
|
|||
grub_file_close (file);
|
||||
|
||||
grub_tpm_measure(core, size, GRUB_BINARY_PCR, "grub_module", filename);
|
||||
grub_print_error();
|
||||
|
||||
mod = grub_dl_load_core (core, size);
|
||||
grub_free (core);
|
||||
|
|
|
@ -7,21 +7,28 @@
|
|||
|
||||
#define TCPA_MAGIC 0x41504354
|
||||
|
||||
static int tpm_presence = -1;
|
||||
|
||||
int tpm_present(void);
|
||||
|
||||
int tpm_present(void)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
||||
if (tpm_presence != -1)
|
||||
return tpm_presence;
|
||||
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
regs.eax = 0xbb00;
|
||||
regs.ebx = TCPA_MAGIC;
|
||||
grub_bios_interrupt (0x1a, ®s);
|
||||
|
||||
if (regs.eax == 0)
|
||||
return 1;
|
||||
tpm_presence = 1;
|
||||
else
|
||||
tpm_presence = 0;
|
||||
|
||||
return 0;
|
||||
return tpm_presence;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
|
@ -49,7 +56,10 @@ grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf,
|
|||
grub_bios_interrupt (0x1a, ®s);
|
||||
|
||||
if (regs.eax)
|
||||
return grub_error (GRUB_ERR_IO, N_("TPM error %x\n"), regs.eax);
|
||||
{
|
||||
tpm_presence = 0;
|
||||
return grub_error (GRUB_ERR_IO, N_("TPM error %x, disabling TPM"), regs.eax);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -126,7 +136,10 @@ grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
|
|||
grub_free(event);
|
||||
|
||||
if (regs.eax)
|
||||
return grub_error (GRUB_ERR_IO, N_("TPM error %x\n"), regs.eax);
|
||||
{
|
||||
tpm_presence = 0;
|
||||
return grub_error (GRUB_ERR_IO, N_("TPM error %x, disabling TPM"), regs.eax);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue