summaryrefslogtreecommitdiff
path: root/tpm.h
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@google.com>2017-07-12 15:29:24 -0700
committerPeter Jones <pjones@redhat.com>2017-08-03 11:00:58 -0400
commit22f2737535ca09faf48762df89b61e81b8d4a2f8 (patch)
treeb5eb822e051e2b302b4485a206562ad4a875872a /tpm.h
parent8af7c4cacaf753f38f2564b26b962a7a2942d664 (diff)
downloadefi-boot-shim-22f2737535ca09faf48762df89b61e81b8d4a2f8.tar.gz
efi-boot-shim-22f2737535ca09faf48762df89b61e81b8d4a2f8.zip
Measure stage 2 according to spec
We're currently measuring the raw second stage loader into PCR 9, but we're closer to spec if we measure the semi-parsed PE into PCR 4. The hash that's logged is the same as the hash used for the Authenticode validation, so refactor shim.c a little to separate out the hash generation.
Diffstat (limited to 'tpm.h')
-rw-r--r--tpm.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tpm.h b/tpm.h
index 3769a1d4..e3c2b923 100644
--- a/tpm.h
+++ b/tpm.h
@@ -1,3 +1,5 @@
+#include <efilib.h>
+
#define EFI_TPM_GUID {0xf541796d, 0xa62e, 0x4954, {0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }};
#define EFI_TPM2_GUID {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }};
@@ -7,6 +9,9 @@
EFI_STATUS tpm_log_event(EFI_PHYSICAL_ADDRESS buf, UINTN size, UINT8 pcr,
const CHAR8 *description);
+EFI_STATUS tpm_log_pe(EFI_PHYSICAL_ADDRESS buf, UINTN size, UINT8 *sha1hash,
+ UINT8 pcr);
+
EFI_STATUS tpm_measure_variable(CHAR16 *dbname, EFI_GUID guid, UINTN size, void *data);
typedef struct {
@@ -33,6 +38,14 @@ typedef struct _TCG_PCR_EVENT {
uint8_t Event[1];
} TCG_PCR_EVENT;
+typedef struct _EFI_IMAGE_LOAD_EVENT {
+ EFI_PHYSICAL_ADDRESS ImageLocationInMemory;
+ UINTN ImageLengthInMemory;
+ UINTN ImageLinkTimeAddress;
+ UINTN LengthOfDevicePath;
+ EFI_DEVICE_PATH DevicePath[1];
+} EFI_IMAGE_LOAD_EVENT;
+
struct efi_tpm_protocol
{
EFI_STATUS (EFIAPI *status_check) (struct efi_tpm_protocol *this,
@@ -170,3 +183,5 @@ typedef UINT32 TCG_EVENTTYPE;
#define EV_EFI_PLATFORM_FIRMWARE_BLOB (EV_EFI_EVENT_BASE + 8)
#define EV_EFI_HANDOFF_TABLES (EV_EFI_EVENT_BASE + 9)
#define EV_EFI_VARIABLE_AUTHORITY (EV_EFI_EVENT_BASE + 0xE0)
+
+#define PE_COFF_IMAGE 0x0000000000000010