linux/include/linux/tpm_eventlog.h
<<
>>
Prefs
   1
   2#ifndef __LINUX_TPM_EVENTLOG_H__
   3#define __LINUX_TPM_EVENTLOG_H__
   4
   5#include <crypto/hash_info.h>
   6
   7#define TCG_EVENT_NAME_LEN_MAX  255
   8#define MAX_TEXT_EVENT          1000    /* Max event string length */
   9#define ACPI_TCPA_SIG           "TCPA"  /* 0x41504354 /'TCPA' */
  10#define TPM2_ACTIVE_PCR_BANKS   3
  11
  12#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x1
  13#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2   0x2
  14
  15#ifdef CONFIG_PPC64
  16#define do_endian_conversion(x) be32_to_cpu(x)
  17#else
  18#define do_endian_conversion(x) x
  19#endif
  20
  21enum bios_platform_class {
  22        BIOS_CLIENT = 0x00,
  23        BIOS_SERVER = 0x01,
  24};
  25
  26struct tcpa_event {
  27        u32 pcr_index;
  28        u32 event_type;
  29        u8 pcr_value[20];       /* SHA1 */
  30        u32 event_size;
  31        u8 event_data[0];
  32};
  33
  34enum tcpa_event_types {
  35        PREBOOT = 0,
  36        POST_CODE,
  37        UNUSED,
  38        NO_ACTION,
  39        SEPARATOR,
  40        ACTION,
  41        EVENT_TAG,
  42        SCRTM_CONTENTS,
  43        SCRTM_VERSION,
  44        CPU_MICROCODE,
  45        PLATFORM_CONFIG_FLAGS,
  46        TABLE_OF_DEVICES,
  47        COMPACT_HASH,
  48        IPL,
  49        IPL_PARTITION_DATA,
  50        NONHOST_CODE,
  51        NONHOST_CONFIG,
  52        NONHOST_INFO,
  53};
  54
  55struct tcpa_pc_event {
  56        u32 event_id;
  57        u32 event_size;
  58        u8 event_data[0];
  59};
  60
  61enum tcpa_pc_event_ids {
  62        SMBIOS = 1,
  63        BIS_CERT,
  64        POST_BIOS_ROM,
  65        ESCD,
  66        CMOS,
  67        NVRAM,
  68        OPTION_ROM_EXEC,
  69        OPTION_ROM_CONFIG,
  70        OPTION_ROM_MICROCODE = 10,
  71        S_CRTM_VERSION,
  72        S_CRTM_CONTENTS,
  73        POST_CONTENTS,
  74        HOST_TABLE_OF_DEVICES,
  75};
  76
  77/* http://www.trustedcomputinggroup.org/tcg-efi-protocol-specification/ */
  78
  79struct tcg_efi_specid_event_algs {
  80        u16 alg_id;
  81        u16 digest_size;
  82} __packed;
  83
  84struct tcg_efi_specid_event {
  85        u8 signature[16];
  86        u32 platform_class;
  87        u8 spec_version_minor;
  88        u8 spec_version_major;
  89        u8 spec_errata;
  90        u8 uintnsize;
  91        u32 num_algs;
  92        struct tcg_efi_specid_event_algs digest_sizes[TPM2_ACTIVE_PCR_BANKS];
  93        u8 vendor_info_size;
  94        u8 vendor_info[0];
  95} __packed;
  96
  97struct tcg_pcr_event {
  98        u32 pcr_idx;
  99        u32 event_type;
 100        u8 digest[20];
 101        u32 event_size;
 102        u8 event[0];
 103} __packed;
 104
 105struct tcg_event_field {
 106        u32 event_size;
 107        u8 event[0];
 108} __packed;
 109
 110struct tpm2_digest {
 111        u16 alg_id;
 112        u8 digest[SHA512_DIGEST_SIZE];
 113} __packed;
 114
 115struct tcg_pcr_event2 {
 116        u32 pcr_idx;
 117        u32 event_type;
 118        u32 count;
 119        struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS];
 120        struct tcg_event_field event;
 121} __packed;
 122
 123#endif
 124