gitee.com/mirrors_u-root/u-root@v7.0.0+incompatible/pkg/txtlog/constants.go (about)

     1  // Copyright 2020 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  package txtlog
     5  
     6  // BIOSLogID is the legacy eventlog type
     7  type BIOSLogID uint32
     8  
     9  const (
    10  	// EvPrebootCert see [2] specification in tcpa_log.go
    11  	EvPrebootCert BIOSLogID = 0x0
    12  	// EvPostCode see [2] specification in tcpa_log.go
    13  	EvPostCode BIOSLogID = 0x1
    14  	// EvUnused see [2] specification in tcpa_log.go
    15  	EvUnused BIOSLogID = 0x2
    16  	// EvNoAction see [2] specification in tcpa_log.go
    17  	EvNoAction BIOSLogID = 0x3
    18  	// EvSeparator see [2] specification in tcpa_log.go
    19  	EvSeparator BIOSLogID = 0x4
    20  	// EvAction see [2] specification in tcpa_log.go
    21  	EvAction BIOSLogID = 0x5
    22  	// EvEventTag see [2] specification in tcpa_log.go
    23  	EvEventTag BIOSLogID = 0x6
    24  	// EvSCRTMContents see [2] specification in tcpa_log.go
    25  	EvSCRTMContents BIOSLogID = 0x7
    26  	// EvSCRTMVersion see [2] specification in tcpa_log.go
    27  	EvSCRTMVersion BIOSLogID = 0x8
    28  	// EvCPUMicrocode see [2] specification in tcpa_log.go
    29  	EvCPUMicrocode BIOSLogID = 0x9
    30  	// EvPlatformConfigFlags see [2] specification in tcpa_log.go
    31  	EvPlatformConfigFlags BIOSLogID = 0xA
    32  	// EvTableOfServices see [2] specification in tcpa_log.go
    33  	EvTableOfServices BIOSLogID = 0xB
    34  	// EvCompactHash see [2] specification in tcpa_log.go
    35  	EvCompactHash BIOSLogID = 0xC
    36  	// EvIPL see [2] specification in tcpa_log.go
    37  	EvIPL BIOSLogID = 0xD
    38  	// EvIPLPartitionData see [2] specification in tcpa_log.go
    39  	EvIPLPartitionData BIOSLogID = 0xE
    40  	// EvNonHostCode see [2] specification in tcpa_log.go
    41  	EvNonHostCode BIOSLogID = 0xF
    42  	// EvNonHostConfig see [2] specification in tcpa_log.go
    43  	EvNonHostConfig BIOSLogID = 0x10
    44  	// EvNonHostInfo see [2] specification in tcpa_log.go
    45  	EvNonHostInfo BIOSLogID = 0x11
    46  	// EvOmitBootDeviceEvents see [2] specification in tcpa_log.go
    47  	EvOmitBootDeviceEvents BIOSLogID = 0x12
    48  )
    49  
    50  // BIOSLogTypes are the BIOS eventlog types
    51  var BIOSLogTypes = map[BIOSLogID]string{
    52  	EvPrebootCert:          "EV_PREBOOT_CERT",
    53  	EvPostCode:             "EV_POST_CODE",
    54  	EvUnused:               "EV_UNUSED",
    55  	EvNoAction:             "EV_NO_ACTION",
    56  	EvSeparator:            "EV_SEPARATOR",
    57  	EvAction:               "EV_ACTION",
    58  	EvEventTag:             "EV_EVENT_TAG",
    59  	EvSCRTMContents:        "EV_S_CRTM_CONTENTS",
    60  	EvSCRTMVersion:         "EV_S_CRTM_VERSION",
    61  	EvCPUMicrocode:         "EV_CPU_MICROCODE",
    62  	EvPlatformConfigFlags:  "EV_PLATFORM_CONFIG_FLAGS",
    63  	EvTableOfServices:      "EV_TABLE_OF_DEVICES",
    64  	EvCompactHash:          "EV_COMPACT_HASH",
    65  	EvIPL:                  "EV_IPL",
    66  	EvIPLPartitionData:     "EV_IPL_PARTITION_DATA",
    67  	EvNonHostCode:          "EV_NONHOST_CODE",
    68  	EvNonHostConfig:        "EV_NONHOST_CONFIG",
    69  	EvNonHostInfo:          "EV_NONHOST_INFO",
    70  	EvOmitBootDeviceEvents: "EV_OMIT_BOOT_DEVICE_EVENTS",
    71  }
    72  
    73  // EFILogID is the EFI eventlog type
    74  type EFILogID uint32
    75  
    76  const (
    77  	// EvEFIEventBase is the base value for all EFI platform
    78  	EvEFIEventBase EFILogID = 0x80000000
    79  	// EvEFIVariableDriverConfig see [1] specification in tcpa_log.go
    80  	EvEFIVariableDriverConfig EFILogID = 0x80000001
    81  	// EvEFIVariableBoot see [1] specification in tcpa_log.go
    82  	EvEFIVariableBoot EFILogID = 0x80000002
    83  	// EvEFIBootServicesApplication see [1] specification in tcpa_log.go
    84  	EvEFIBootServicesApplication EFILogID = 0x80000003
    85  	// EvEFIBootServicesDriver see [1] specification in tcpa_log.go
    86  	EvEFIBootServicesDriver EFILogID = 0x80000004
    87  	// EvEFIRuntimeServicesDriver see [1] specification in tcpa_log.go
    88  	EvEFIRuntimeServicesDriver EFILogID = 0x80000005
    89  	// EvEFIGPTEvent see [1] specification in tcpa_log.go
    90  	EvEFIGPTEvent EFILogID = 0x80000006
    91  	// EvEFIAction see [1] specification in tcpa_log.go
    92  	EvEFIAction EFILogID = 0x80000007
    93  	// EvEFIPlatformFirmwareBlob see [1] specification in tcpa_log.go
    94  	EvEFIPlatformFirmwareBlob EFILogID = 0x80000008
    95  	// EvEFIHandoffTables see [1] specification in tcpa_log.go
    96  	EvEFIHandoffTables EFILogID = 0x80000009
    97  	// EvEFIHCRTMEvent see [1] specification in tcpa_log.go
    98  	EvEFIHCRTMEvent EFILogID = 0x80000010
    99  	// EvEFIVariableAuthority see [1] specification in tcpa_log.go
   100  	EvEFIVariableAuthority EFILogID = 0x800000E0
   101  )
   102  
   103  // EFILogTypes are the EFI eventlog types
   104  var EFILogTypes = map[EFILogID]string{
   105  	EvEFIEventBase:               "EV_EFI_EVENT_BASE",
   106  	EvEFIVariableDriverConfig:    "EV_EFI_VARIABLE_DRIVER_CONFIG",
   107  	EvEFIVariableBoot:            "EV_EFI_VARIABLE_BOOT",
   108  	EvEFIBootServicesApplication: "EV_EFI_BOOT_SERVICES_APPLICATION",
   109  	EvEFIBootServicesDriver:      "EV_EFI_BOOT_SERVICES_DRIVER",
   110  	EvEFIRuntimeServicesDriver:   "EV_EFI_RUNTIME_SERVICES_DRIVER",
   111  	EvEFIGPTEvent:                "EV_EFI_GPT_EVENT",
   112  	EvEFIAction:                  "EV_EFI_ACTION",
   113  	EvEFIPlatformFirmwareBlob:    "EV_EFI_PLATFORM_FIRMWARE_BLOB",
   114  	EvEFIHandoffTables:           "EV_EFI_HANDOFF_TABLES",
   115  	EvEFIHCRTMEvent:              "EV_EFI_HCRTM_EVENT",
   116  	EvEFIVariableAuthority:       "EV_EFI_VARIABLE_AUTHORITY",
   117  }
   118  
   119  // TCGAgileEventFormatID is the agile eventlog identifier for EV_NO_ACTION events
   120  const TCGAgileEventFormatID string = "Spec ID Event03"
   121  
   122  // TCGOldEfiFormatID is the legacy eventlog identifier for EV_NO_ACTION events
   123  const TCGOldEfiFormatID string = "Spec ID Event02"
   124  
   125  // HCRTM string for event type EV_EFI_HCRTM_EVENT
   126  const HCRTM string = "HCRTM"
   127  
   128  // FirmwareType (BIOS)
   129  type FirmwareType string
   130  
   131  const (
   132  	// Uefi is an Open Source UEFI implementation, www.tianocore.org
   133  	Uefi FirmwareType = "UEFI"
   134  	// Coreboot is an Open Source firmware, www.coreboot.org
   135  	Coreboot FirmwareType = "coreboot"
   136  	// UBoot is an Open Source firmware, www.denx.de/wiki/U-Boot
   137  	UBoot FirmwareType = "U-Boot"
   138  	// LinuxBoot is an Open Source firmware based on UEFI and a Linux runtime,
   139  	// www.linuxboot.org
   140  	LinuxBoot FirmwareType = "LinuxBoot"
   141  	// Bios is the legacy BIOS
   142  	Bios FirmwareType = "BIOS"
   143  	// TXT is Intel TXT launch
   144  	Txt FirmwareType = "TXT"
   145  )
   146  
   147  // TXT TPM1.2 log container signature
   148  const Txt12EvtLogSignature = "TXT Event Container\000"
   149  
   150  // TXT TPM1.2 log versions
   151  const (
   152  	Txt12EvtLog_Cntnr_Major_Ver = 1
   153  	Txt12EvtLog_Cntnr_Minor_Ver = 0
   154  	Txt12EvtLog_Evt_Major_Ver   = 1
   155  	Txt12EvtLog_Evt_Minor_Ver   = 0
   156  )
   157  
   158  type TxtLogID uint32
   159  
   160  const (
   161  	TxtEvTypeBase TxtLogID = iota + 0x400
   162  	TxtEvTypePcrMapping
   163  	TxtEvTypeHashStart
   164  	TxtEvTypeCombinedHash
   165  	TxtEvTypeMleHash
   166  	TxtEvTypeBiosAcRegData TxtLogID = iota + 0x405
   167  	TxtEvTypeCpuScrtmStat
   168  	TxtEvTypeLcpControlHash
   169  	TxtEvTypeElementsHash
   170  	TxtEvTypeStmHash
   171  	TxtEvTypeOsSinitDataCapHash
   172  	TxtEvTypeSinitPubKeyHash
   173  	TxtEvTypeLcpHash
   174  	TxtEvTypeLcpDetailsHash
   175  	TxtEvTypeLcpAuthoritiesHash
   176  	TxtEvTypeNvInfoHash
   177  	TxtEvTypeColdBootBiosHash
   178  	TxtEvTypeKmHash
   179  	TxtEvTypeBpmHash
   180  	TxtEvTypeKmInfoHash
   181  	TxtEvTypeBpmInfoHash
   182  	TxtEvTypeBootPolHash
   183  	TxtEvTypeRandValue TxtLogID = iota + 0x4e8
   184  	TxtEvTypeCapValue
   185  )
   186  
   187  // Txt12LogTypes are the Intel TXT eventlog types
   188  var TxtLogTypes = map[TxtLogID]string{
   189  	TxtEvTypeBase:               "EVTYPE_BASE",
   190  	TxtEvTypePcrMapping:         "EVTYPE_PCR_MAPPING",
   191  	TxtEvTypeHashStart:          "EVTYPE_HASH_START",
   192  	TxtEvTypeCombinedHash:       "EVTYPE_COMBINED_HASH",
   193  	TxtEvTypeMleHash:            "EVTYPE_MLE_HASH",
   194  	TxtEvTypeBiosAcRegData:      "EVTYPE_BIOSAC_REG_DATA",
   195  	TxtEvTypeCpuScrtmStat:       "EVTYPE_CPU_SCRTM_STAT",
   196  	TxtEvTypeLcpControlHash:     "EVTYPE_LCP_CONTROL_HASH",
   197  	TxtEvTypeElementsHash:       "EVTYPE_ELEMENTS_HASH",
   198  	TxtEvTypeStmHash:            "EVTYPE_STM_HASH",
   199  	TxtEvTypeOsSinitDataCapHash: "EVTYPE_OSSINITDATA_CAP_HASH",
   200  	TxtEvTypeSinitPubKeyHash:    "EVTYPE_SINIT_PUBKEY_ HASH",
   201  	TxtEvTypeLcpHash:            "EVTYPE_LCP_HASH",
   202  	TxtEvTypeLcpDetailsHash:     "EVTYPE_LCP_DETAILS_HASH",
   203  	TxtEvTypeLcpAuthoritiesHash: "EVTYPE_LCP_AUTHORITIES_HASH",
   204  	TxtEvTypeNvInfoHash:         "EVTYPE_NV_INFO_HASH",
   205  	TxtEvTypeColdBootBiosHash:   "EVTYPE_COLD_BOOT_BIOS_HASH",
   206  	TxtEvTypeKmHash:             "EVTYPE_KM_HASH",
   207  	TxtEvTypeBpmHash:            "EVTYPE_KM_HASH",
   208  	TxtEvTypeKmInfoHash:         "EVTYPE_KM_INFO_HASH",
   209  	TxtEvTypeBpmInfoHash:        "EVTYPE_BPM_INFO_HASH",
   210  	TxtEvTypeBootPolHash:        "EVTYPE_BOOT_POL_HASH",
   211  	TxtEvTypeRandValue:          "EVTYPE_RANDOM_VALUE",
   212  	TxtEvTypeCapValue:           "EVTYPE_CAP_VALUE",
   213  }