]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add TPM2 definition in trusted computing group.
authorYao, Jiewen <Jiewen.Yao@intel.com>
Thu, 13 Aug 2015 08:22:05 +0000 (08:22 +0000)
committerjyao1 <jyao1@Edk2>
Thu, 13 Aug 2015 08:22:05 +0000 (08:22 +0000)
1) TCG Physical Presence Interface Specification 1.30 at http://www.trustedcomputinggroup.org/resources/tcg_physical_presence_interface_specification
2) TCG EFI Protocol Specification for TPM 2.0 at http://www.trustedcomputinggroup.org/resources/tcg_efi_protocol_specification
3) Update TPM2.0 header file to include Hash Algo definition.
4) Update UEFI TCG platform header file to include more TCG event structure.

Test Win8/Win10 with secure boot enabled, PCR7 shows bound.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <Jiewen.Yao@intel.com>
Reviewed-by: "Zhang, Chao B" <chao.b.zhang@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18218 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/IndustryStandard/TcgPhysicalPresence.h [new file with mode: 0644]
MdePkg/Include/IndustryStandard/Tpm20.h
MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
MdePkg/Include/Protocol/Tcg2Protocol.h [new file with mode: 0644]
MdePkg/Include/Protocol/TrEEProtocol.h
MdePkg/MdePkg.dec

diff --git a/MdePkg/Include/IndustryStandard/TcgPhysicalPresence.h b/MdePkg/Include/IndustryStandard/TcgPhysicalPresence.h
new file mode 100644 (file)
index 0000000..80ae7d3
--- /dev/null
@@ -0,0 +1,129 @@
+/** @file\r
+  TCG Physical Presence definition.\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution.  The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _TCG_PHYSICAL_PRESENCE_H_\r
+#define _TCG_PHYSICAL_PRESENCE_H_\r
+\r
+//\r
+// TCG PP definition for physical presence ACPI function\r
+//\r
+#define TCG_ACPI_FUNCTION_GET_PHYSICAL_PRESENCE_INTERFACE_VERSION      1\r
+#define TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS                       2\r
+#define TCG_ACPI_FUNCTION_GET_PENDING_REQUEST_BY_OS                    3\r
+#define TCG_ACPI_FUNCTION_GET_PLATFORM_ACTION_TO_TRANSITION_TO_BIOS    4\r
+#define TCG_ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS                5\r
+#define TCG_ACPI_FUNCTION_SUBMIT_PREFERRED_USER_LANGUAGE               6\r
+#define TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2                     7\r
+#define TCG_ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST     8\r
+\r
+//\r
+// TCG PP definition for TPM Operation Response to OS Environment\r
+//\r
+#define TCG_PP_OPERATION_RESPONSE_SUCCESS              0x0\r
+#define TCG_PP_OPERATION_RESPONSE_USER_ABORT           0xFFFFFFF0\r
+#define TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE         0xFFFFFFF1\r
+\r
+//\r
+// TCG PP definition of return code for Return TPM Operation Response to OS Environment\r
+//\r
+#define TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS                   0\r
+#define TCG_PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE                   1\r
+\r
+//\r
+// TCG PP definition of return code for Sumbit TPM Request to Pre-OS Environment\r
+// and Sumbit TPM Request to Pre-OS Environment 2\r
+//\r
+#define TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS                                  0\r
+#define TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED                          1\r
+#define TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE                          2\r
+#define TCG_PP_SUBMIT_REQUEST_TO_PREOS_BLOCKED_BY_BIOS_SETTINGS                 3\r
+\r
+//\r
+// TCG PP definition of return code for Get User Confirmation Status for Operation\r
+//\r
+#define TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED                                 0\r
+#define TCG_PP_GET_USER_CONFIRMATION_BIOS_ONLY                                       1\r
+#define TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION                   2\r
+#define TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_REQUIRED                     3\r
+#define TCG_PP_GET_USER_CONFIRMATION_ALLOWED_AND_PPUSER_NOT_REQUIRED                 4\r
+\r
+//\r
+// TCG PP definition of physical presence operation actions for TPM12\r
+//\r
+#define TCG_PHYSICAL_PRESENCE_NO_ACTION                               0\r
+#define TCG_PHYSICAL_PRESENCE_ENABLE                                  1\r
+#define TCG_PHYSICAL_PRESENCE_DISABLE                                 2\r
+#define TCG_PHYSICAL_PRESENCE_ACTIVATE                                3\r
+#define TCG_PHYSICAL_PRESENCE_DEACTIVATE                              4 \r
+#define TCG_PHYSICAL_PRESENCE_CLEAR                                   5\r
+#define TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE                         6\r
+#define TCG_PHYSICAL_PRESENCE_DEACTIVATE_DISABLE                      7\r
+#define TCG_PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE                  8\r
+#define TCG_PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE                 9\r
+#define TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_OWNER_TRUE              10\r
+#define TCG_PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE          11\r
+#define TCG_PHYSICAL_PRESENCE_DEFERRED_PP_UNOWNERED_FIELD_UPGRADE     12\r
+#define TCG_PHYSICAL_PRESENCE_SET_OPERATOR_AUTH                       13\r
+#define TCG_PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE                   14\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_FALSE              15\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_PROVISION_TRUE               16\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE                  17\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE                   18\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_MAINTENANCE_FALSE            19\r
+#define TCG_PHYSICAL_PRESENCE_SET_NO_PPI_MAINTENANCE_TRUE             20\r
+#define TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR                   21\r
+#define TCG_PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE   22\r
+\r
+#define TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION               128\r
+\r
+//\r
+// TCG PP definition of physical presence operation actions for TPM2\r
+//\r
+#define TCG2_PHYSICAL_PRESENCE_NO_ACTION                                         0\r
+#define TCG2_PHYSICAL_PRESENCE_ENABLE                                            1\r
+#define TCG2_PHYSICAL_PRESENCE_DISABLE                                           2\r
+#define TCG2_PHYSICAL_PRESENCE_CLEAR                                             5\r
+#define TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR                                      14\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_TRUE                    17\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CLEAR_FALSE                   18\r
+#define TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_2                                    21\r
+#define TCG2_PHYSICAL_PRESENCE_ENABLE_CLEAR_3                                    22\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS                                     23\r
+#define TCG2_PHYSICAL_PRESENCE_CHANGE_EPS                                        24\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CHANGE_PCRS_FALSE             25\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CHANGE_PCRS_TRUE              26\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_TURN_ON_FALSE                 27\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_TURN_ON_TRUE                  28\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_TURN_OFF_FALSE                29\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_TURN_OFF_TRUE                 30\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CHANGE_EPS_FALSE              31\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_CHANGE_EPS_TRUE               32\r
+#define TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS                                   33\r
+#define TCG2_PHYSICAL_PRESENCE_DISABLE_ENDORSEMENT_ENABLE_STORAGE_HIERARCHY      34\r
+#define TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX                                     34\r
+\r
+//\r
+// TCG PP definition of physical presence operation actions for storage management\r
+//\r
+#define TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN                          96\r
+#define TCG2_PHYSICAL_PRESENCE_ENABLE_BLOCK_SID                                  96\r
+#define TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID                                 97\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_TRUE    98\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_FALSE   99\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_TRUE   100\r
+#define TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_DISABLE_BLOCK_SID_FUNC_FALSE  101\r
+\r
+#define TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION                         128\r
+\r
+#endif
\ No newline at end of file
index 5074d899d06e98f7fb6bdfa7f6505a9e68efc979..2abfc57df8fd49888345708044e0e9e0fb73414f 100644 (file)
@@ -5,7 +5,7 @@
 \r
   Check http://trustedcomputinggroup.org for latest specification updates.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved. <BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1806,4 +1806,13 @@ typedef struct {
 \r
 #pragma pack ()\r
 \r
+//\r
+// TCG Algorithm Registry\r
+//\r
+#define HASH_ALG_SHA1    0x00000001\r
+#define HASH_ALG_SHA256  0x00000002\r
+#define HASH_ALG_SHA384  0x00000004\r
+#define HASH_ALG_SHA512  0x00000008\r
+#define HASH_ALG_SM3_256 0x00000010\r
+\r
 #endif\r
index 8db86a137cb8ac9662bf77f69ef587afde3b5ef7..23eaa53acdc5e7788a6aeae0012103ef171d02d2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final\r
 \r
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #define __UEFI_TCG_PLATFORM_H__\r
 \r
 #include <IndustryStandard/Tpm12.h>\r
+#include <IndustryStandard/Tpm20.h>\r
 #include <Uefi.h>\r
 \r
 //\r
 // Standard event types\r
 //\r
 #define EV_POST_CODE                ((TCG_EVENTTYPE) 0x00000001)\r
+#define EV_NO_ACTION                ((TCG_EVENTTYPE) 0x00000003)\r
 #define EV_SEPARATOR                ((TCG_EVENTTYPE) 0x00000004)\r
 #define EV_S_CRTM_CONTENTS          ((TCG_EVENTTYPE) 0x00000007)\r
 #define EV_S_CRTM_VERSION           ((TCG_EVENTTYPE) 0x00000008)\r
@@ -41,6 +43,7 @@
 #define EV_EFI_ACTION                       (EV_EFI_EVENT_BASE + 7)\r
 #define EV_EFI_PLATFORM_FIRMWARE_BLOB       (EV_EFI_EVENT_BASE + 8)\r
 #define EV_EFI_HANDOFF_TABLES               (EV_EFI_EVENT_BASE + 9)\r
+#define EV_EFI_VARIABLE_AUTHORITY           (EV_EFI_EVENT_BASE + 0xE0)\r
 \r
 #define EFI_CALLING_EFI_APPLICATION         \\r
   "Calling EFI Application from Boot Option"\r
@@ -72,6 +75,9 @@
 #define EV_POSTCODE_INFO_OPROM        "Embedded Option ROM"\r
 #define OPROM_LEN                     (sizeof(EV_POSTCODE_INFO_OPROM) - 1)\r
 \r
+#define FIRMWARE_DEBUGGER_EVENT_STRING      "UEFI Debug Mode"\r
+#define FIRMWARE_DEBUGGER_EVENT_STRING_LEN  (sizeof(FIRMWARE_DEBUGGER_EVENT_STRING) - 1)\r
+\r
 //\r
 // Set structure alignment to 1-byte\r
 //\r
@@ -154,12 +160,114 @@ typedef struct tdEFI_VARIABLE_DATA {
   INT8                              VariableData[1];  ///< Driver or platform-specific data\r
 } EFI_VARIABLE_DATA;\r
 \r
+//\r
+// For TrEE1.0 compatibility\r
+//\r
+typedef struct {\r
+  EFI_GUID                          VariableName;\r
+  UINT64                            UnicodeNameLength;   // The TCG Definition used UINTN\r
+  UINT64                            VariableDataLength;  // The TCG Definition used UINTN\r
+  CHAR16                            UnicodeName[1];\r
+  INT8                              VariableData[1];\r
+} EFI_VARIABLE_DATA_TREE;\r
+\r
 typedef struct tdEFI_GPT_DATA {\r
   EFI_PARTITION_TABLE_HEADER  EfiPartitionHeader;\r
   UINTN                       NumberOfPartitions; \r
   EFI_PARTITION_ENTRY         Partitions[1];\r
 } EFI_GPT_DATA;\r
 \r
+//\r
+// Crypto Agile Log Entry Format\r
+//\r
+typedef struct tdTCG_PCR_EVENT2 {\r
+  TCG_PCRINDEX        PCRIndex;\r
+  TCG_EVENTTYPE       EventType;\r
+  TPML_DIGEST_VALUES  Digest;\r
+  UINT32              EventSize;\r
+  UINT8               Event[1];\r
+} TCG_PCR_EVENT2;\r
+\r
+//\r
+// Log Header Entry Data\r
+//\r
+typedef struct {\r
+  //\r
+  // TCG defined hashing algorithm ID.\r
+  //\r
+  UINT16              algorithmId;\r
+  //\r
+  // The size of the digest for the respective hashing algorithm.\r
+  //\r
+  UINT16              digestSize;\r
+} TCG_EfiSpecIdEventAlgorithmSize;\r
+\r
+#define TCG_EfiSpecIDEventStruct_SIGNATURE_02 "Spec ID Event02"\r
+#define TCG_EfiSpecIDEventStruct_SIGNATURE_03 "Spec ID Event03"\r
+\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM12   1\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM12   2\r
+#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM12          2\r
+\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2   2\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2   0\r
+#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2          0\r
+\r
+typedef struct {\r
+  UINT8               signature[16];\r
+  //\r
+  // The value for the Platform Class.\r
+  // The enumeration is defined in the TCG ACPI Specification Client Common Header.\r
+  //\r
+  UINT32              platformClass;\r
+  //\r
+  // The TCG EFI Platform Specification minor version number this BIOS supports.\r
+  // Any BIOS supporting version (1.22) MUST set this value to 02h.\r
+  // Any BIOS supporting version (2.0) SHALL set this value to 0x00.\r
+  //\r
+  UINT8               specVersionMinor;\r
+  //\r
+  // The TCG EFI Platform Specification major version number this BIOS supports.\r
+  // Any BIOS supporting version (1.22) MUST set this value to 01h.\r
+  // Any BIOS supporting version (2.0) SHALL set this value to 0x02.\r
+  //\r
+  UINT8               specVersionMajor;\r
+  //\r
+  // The TCG EFI Platform Specification errata for this specification this BIOS supports.\r
+  // Any BIOS supporting version and errata (1.22) MUST set this value to 02h.\r
+  // Any BIOS supporting version and errata (2.0) SHALL set this value to 0x00.\r
+  //\r
+  UINT8               specErrata;\r
+  //\r
+  // Specifies the size of the UINTN fields used in various data structures used in this specification.\r
+  // 0x01 indicates UINT32 and 0x02 indicates UINT64.\r
+  //\r
+  UINT8               uintnSize;\r
+  //\r
+  // This field is added in "Spec ID Event03".\r
+  // The number of hashing algorithms used in this event log (except the first event).\r
+  // All events in this event log use all hashing algorithms defined here.\r
+  //\r
+//UINT32              numberOfAlgorithms;\r
+  //\r
+  // This field is added in "Spec ID Event03".\r
+  // An array of size numberOfAlgorithms of value pairs.\r
+  //\r
+//TCG_EfiSpecIdEventAlgorithmSize digestSize[numberOfAlgorithms];\r
+  //\r
+  // Size in bytes of the VendorInfo field.\r
+  // Maximum value SHALL be FFh bytes.\r
+  //\r
+//UINT8               vendorInfoSize;\r
+  //\r
+  // Provided for use by the BIOS implementer.\r
+  // The value might be used, for example, to provide more detailed information about the specific BIOS such as BIOS revision numbers, etc.\r
+  // The values within this field are not standardized and are implementer-specific.\r
+  // Platform-specific or -unique information SHALL NOT be provided in this field.\r
+  //\r
+//UINT8               vendorInfo[vendorInfoSize];\r
+} TCG_EfiSpecIDEventStruct;\r
+\r
 //\r
 // Restore original structure alignment\r
 //\r
diff --git a/MdePkg/Include/Protocol/Tcg2Protocol.h b/MdePkg/Include/Protocol/Tcg2Protocol.h
new file mode 100644 (file)
index 0000000..0bda105
--- /dev/null
@@ -0,0 +1,341 @@
+/** @file\r
+  TPM2 Protocol as defined in TCG PC Client Platform EFI Protocol Specification Family "2.0".\r
+  See http://trustedcomputinggroup.org for the latest specification\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution.  The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __TCG2_PROTOCOL_H__\r
+#define __TCG2_PROTOCOL_H__\r
+\r
+#include <IndustryStandard/UefiTcgPlatform.h>\r
+#include <IndustryStandard/Tpm20.h>\r
+\r
+#define EFI_TCG2_PROTOCOL_GUID \\r
+  {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}\r
+\r
+typedef struct tdEFI_TCG2_PROTOCOL EFI_TCG2_PROTOCOL;\r
+\r
+typedef struct tdEFI_TCG2_VERSION {\r
+  UINT8 Major;\r
+  UINT8 Minor;\r
+} EFI_TCG2_VERSION;\r
+\r
+typedef UINT32 EFI_TCG2_EVENT_LOG_BITMAP;\r
+typedef UINT32 EFI_TCG2_EVENT_LOG_FORMAT;\r
+typedef UINT32 EFI_TCG2_EVENT_ALGORITHM_BITMAP;\r
+\r
+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2       0x00000001\r
+#define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2         0x00000002\r
+\r
+typedef struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY {\r
+  //\r
+  // Allocated size of the structure\r
+  //\r
+  UINT8                            Size;\r
+  //\r
+  // Version of the EFI_TCG2_BOOT_SERVICE_CAPABILITY structure itself.\r
+  // For this version of the protocol, the Major version shall be set to 1\r
+  // and the Minor version shall be set to 1. \r
+  //\r
+  EFI_TCG2_VERSION                 StructureVersion;\r
+  //\r
+  // Version of the EFI TCG2 protocol.\r
+  // For this version of the protocol, the Major version shall be set to 1\r
+  // and the Minor version shall be set to 1. \r
+  //\r
+  EFI_TCG2_VERSION                 ProtocolVersion;\r
+  //\r
+  // Supported hash algorithms (this bitmap is determined by the supported PCR\r
+  // banks in the TPM and the hashing algorithms supported by the firmware)\r
+  //\r
+  EFI_TCG2_EVENT_ALGORITHM_BITMAP  HashAlgorithmBitmap;\r
+  //\r
+  // Bitmap of supported event log formats\r
+  //\r
+  EFI_TCG2_EVENT_LOG_BITMAP        SupportedEventLogs;\r
+  //\r
+  // False = TPM not present\r
+  //\r
+  BOOLEAN                          TPMPresentFlag;\r
+  //\r
+  // Max size (in bytes) of a command that can be sent to the TPM\r
+  //\r
+  UINT16                           MaxCommandSize;\r
+  //\r
+  // Max size (in bytes) of a response that can be provided by the TPM\r
+  //\r
+  UINT16                           MaxResponseSize;\r
+  //\r
+  // 4-byte Vendor ID\r
+  // (see TCG Vendor ID registry, Section "TPM Capabilities Vendor ID")\r
+  //\r
+  UINT32                           ManufacturerID;\r
+  //\r
+  // Maximum number of PCR banks (hashing algorithms) supported.\r
+  // No granularity is provided to support a specific set of algorithms.\r
+  // Minimum value is 1.\r
+  //\r
+  UINT32                           NumberOfPCRBanks;\r
+  //\r
+  // A bitmap of currently active PCR banks (hashing algorithms).\r
+  // This is a subset of the supported hashing algorithms reported in HashAlgorithmBitMap.\r
+  // NumberOfPcrBanks defines the number of bits that are set.\r
+  //\r
+  EFI_TCG2_EVENT_ALGORITHM_BITMAP  ActivePcrBanks;\r
+} EFI_TCG2_BOOT_SERVICE_CAPABILITY;\r
+\r
+#define EFI_TCG2_BOOT_HASH_ALG_SHA1    0x00000001\r
+#define EFI_TCG2_BOOT_HASH_ALG_SHA256  0x00000002\r
+#define EFI_TCG2_BOOT_HASH_ALG_SHA384  0x00000004\r
+#define EFI_TCG2_BOOT_HASH_ALG_SHA512  0x00000008\r
+#define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x00000010\r
+\r
+//\r
+// This bit is shall be set when an event shall be extended but not logged.\r
+//\r
+#define EFI_TCG2_EXTEND_ONLY  0x0000000000000001\r
+//\r
+// This bit shall be set when the intent is to measure a PE/COFF image.\r
+//\r
+#define PE_COFF_IMAGE     0x0000000000000010\r
+\r
+#define MAX_PCR_INDEX  23\r
+\r
+#pragma pack(1)\r
+\r
+#define EFI_TCG2_EVENT_HEADER_VERSION  1\r
+\r
+typedef struct {\r
+  //\r
+  // Size of the event header itself (sizeof(EFI_TCG2_EVENT_HEADER)). \r
+  //\r
+  UINT32            HeaderSize;\r
+  //\r
+  // Header version. For this version of this specification, the value shall be 1.\r
+  //\r
+  UINT16            HeaderVersion;\r
+  //\r
+  // Index of the PCR that shall be extended (0 - 23). \r
+  //\r
+  TCG_PCRINDEX      PCRIndex;\r
+  //\r
+  // Type of the event that shall be extended (and optionally logged). \r
+  //\r
+  TCG_EVENTTYPE     EventType;\r
+} EFI_TCG2_EVENT_HEADER;\r
+\r
+typedef struct tdEFI_TCG2_EVENT {\r
+  //\r
+  // Total size of the event including the Size component, the header and the Event data. \r
+  //\r
+  UINT32                Size;\r
+  EFI_TCG2_EVENT_HEADER Header;\r
+  UINT8                 Event[1];\r
+} EFI_TCG2_EVENT;\r
+\r
+#pragma pack()\r
+\r
+/**\r
+  The EFI_TCG2_PROTOCOL GetCapability function call provides protocol\r
+  capability information and state information.\r
+\r
+  @param[in]      This               Indicates the calling context\r
+  @param[in, out] ProtocolCapability The caller allocates memory for a EFI_TCG2_BOOT_SERVICE_CAPABILITY\r
+                                     structure and sets the size field to the size of the structure allocated.\r
+                                     The callee fills in the fields with the EFI protocol capability information\r
+                                     and the current EFI TCG2 state information up to the number of fields which\r
+                                     fit within the size of the structure passed in.\r
+\r
+  @retval EFI_SUCCESS            Operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
+                                 The ProtocolCapability variable will not be populated. \r
+  @retval EFI_INVALID_PARAMETER  One or more of the parameters are incorrect.\r
+                                 The ProtocolCapability variable will not be populated.\r
+  @retval EFI_BUFFER_TOO_SMALL   The ProtocolCapability variable is too small to hold the full response.\r
+                                 It will be partially populated (required Size field will be set). \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_GET_CAPABILITY) (\r
+  IN EFI_TCG2_PROTOCOL                    *This,\r
+  IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability\r
+  );\r
+\r
+/**\r
+  The EFI_TCG2_PROTOCOL Get Event Log function call allows a caller to\r
+  retrieve the address of a given event log and its last entry. \r
+\r
+  @param[in]  This               Indicates the calling context\r
+  @param[in]  EventLogFormat     The type of the event log for which the information is requested.\r
+  @param[out] EventLogLocation   A pointer to the memory address of the event log.\r
+  @param[out] EventLogLastEntry  If the Event Log contains more than one entry, this is a pointer to the\r
+                                 address of the start of the last entry in the event log in memory.\r
+  @param[out] EventLogTruncated  If the Event Log is missing at least one entry because an event would\r
+                                 have exceeded the area allocated for events, this value is set to TRUE.\r
+                                 Otherwise, the value will be FALSE and the Event Log will be complete.\r
+\r
+  @retval EFI_SUCCESS            Operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the parameters are incorrect\r
+                                 (e.g. asking for an event log whose format is not supported).\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_GET_EVENT_LOG) (\r
+  IN EFI_TCG2_PROTOCOL         *This,\r
+  IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,\r
+  OUT EFI_PHYSICAL_ADDRESS     *EventLogLocation,\r
+  OUT EFI_PHYSICAL_ADDRESS     *EventLogLastEntry,\r
+  OUT BOOLEAN                  *EventLogTruncated\r
+  );\r
+\r
+/**\r
+  The EFI_TCG2_PROTOCOL HashLogExtendEvent function call provides callers with\r
+  an opportunity to extend and optionally log events without requiring\r
+  knowledge of actual TPM commands. \r
+  The extend operation will occur even if this function cannot create an event\r
+  log entry (e.g. due to the event log being full). \r
+\r
+  @param[in]  This               Indicates the calling context\r
+  @param[in]  Flags              Bitmap providing additional information.\r
+  @param[in]  DataToHash         Physical address of the start of the data buffer to be hashed. \r
+  @param[in]  DataToHashLen      The length in bytes of the buffer referenced by DataToHash.\r
+  @param[in]  EfiTcgEvent        Pointer to data buffer containing information about the event.\r
+\r
+  @retval EFI_SUCCESS            Operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR       The command was unsuccessful.\r
+  @retval EFI_VOLUME_FULL        The extend operation occurred, but the event could not be written to one or more event logs.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the parameters are incorrect.\r
+  @retval EFI_UNSUPPORTED        The PE/COFF image type is not supported.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_TCG2_HASH_LOG_EXTEND_EVENT) (\r
+  IN EFI_TCG2_PROTOCOL    *This,\r
+  IN UINT64               Flags,\r
+  IN EFI_PHYSICAL_ADDRESS DataToHash,\r
+  IN UINT64               DataToHashLen,\r
+  IN EFI_TCG2_EVENT       *EfiTcgEvent\r
+  );\r
+\r
+/**\r
+  This service enables the sending of commands to the TPM.\r
+\r
+  @param[in]  This                     Indicates the calling context\r
+  @param[in]  InputParameterBlockSize  Size of the TPM input parameter block.\r
+  @param[in]  InputParameterBlock      Pointer to the TPM input parameter block.\r
+  @param[in]  OutputParameterBlockSize Size of the TPM output parameter block.\r
+  @param[in]  OutputParameterBlock     Pointer to the TPM output parameter block.\r
+\r
+  @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.\r
+  @retval EFI_DEVICE_ERROR       The command was not successfully sent to the device or a response was not successfully received from the device.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the parameters are incorrect.\r
+  @retval EFI_BUFFER_TOO_SMALL   The output parameter block is too small. \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_SUBMIT_COMMAND) (\r
+  IN EFI_TCG2_PROTOCOL *This,\r
+  IN UINT32            InputParameterBlockSize,\r
+  IN UINT8             *InputParameterBlock,\r
+  IN UINT32            OutputParameterBlockSize,\r
+  IN UINT8             *OutputParameterBlock\r
+  );\r
+\r
+/**\r
+  This service returns the currently active PCR banks.\r
+\r
+  @param[in]  This            Indicates the calling context\r
+  @param[out] ActivePcrBanks  Pointer to the variable receiving the bitmap of currently active PCR banks.\r
+\r
+  @retval EFI_SUCCESS           The bitmap of active PCR banks was stored in the ActivePcrBanks parameter.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_GET_ACTIVE_PCR_BANKS) (\r
+  IN  EFI_TCG2_PROTOCOL *This,\r
+  OUT UINT32            *ActivePcrBanks\r
+  );\r
+\r
+/**\r
+  This service sets the currently active PCR banks.\r
+\r
+  @param[in]  This            Indicates the calling context\r
+  @param[in]  ActivePcrBanks  Bitmap of the requested active PCR banks. At least one bit SHALL be set.\r
+\r
+  @retval EFI_SUCCESS           The bitmap in ActivePcrBank parameter is already active.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_SET_ACTIVE_PCR_BANKS) (\r
+  IN EFI_TCG2_PROTOCOL *This,\r
+  IN UINT32            ActivePcrBanks\r
+  );\r
+\r
+/**\r
+  This service retrieves the result of a previous invocation of SetActivePcrBanks.\r
+\r
+  @param[in]  This              Indicates the calling context\r
+  @param[out] OperationPresent  Non-zero value to indicate a SetActivePcrBank operation was invoked during the last boot.\r
+  @param[out] Response          The response from the SetActivePcrBank request.\r
+\r
+  @retval EFI_SUCCESS           The result value could be returned.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS) (\r
+  IN  EFI_TCG2_PROTOCOL  *This,\r
+  OUT UINT32             *OperationPresent,\r
+  OUT UINT32             *Response\r
+  );\r
+\r
+struct tdEFI_TCG2_PROTOCOL {\r
+  EFI_TCG2_GET_CAPABILITY                     GetCapability;\r
+  EFI_TCG2_GET_EVENT_LOG                      GetEventLog;\r
+  EFI_TCG2_HASH_LOG_EXTEND_EVENT              HashLogExtendEvent;\r
+  EFI_TCG2_SUBMIT_COMMAND                     SubmitCommand;\r
+  EFI_TCG2_GET_ACTIVE_PCR_BANKS               GetActivePcrBanks;\r
+  EFI_TCG2_SET_ACTIVE_PCR_BANKS               SetActivePcrBanks;\r
+  EFI_TCG2_GET_RESULT_OF_SET_ACTIVE_PCR_BANKS GetResultOfSetActivePcrBanks;\r
+};\r
+\r
+extern EFI_GUID gEfiTcg2ProtocolGuid;\r
+\r
+//\r
+// Log entries after Get Event Log service\r
+//\r
+\r
+#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID \\r
+  {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }}\r
+\r
+extern EFI_GUID gEfiTcg2FinalEventsTableGuid;\r
+\r
+typedef struct tdEFI_TCG2_FINAL_EVENTS_TABLE {\r
+  //\r
+  // The version of this structure.\r
+  //\r
+  UINT64                  Version;\r
+  //\r
+  // Number of events recorded after invocation of GetEventLog API\r
+  //\r
+  UINT64                  NumberOfEvents;\r
+  //\r
+  // List of events of type TCG_PCR_EVENT2.\r
+  //\r
+//TCG_PCR_EVENT2          Event[1];\r
+} EFI_TCG2_FINAL_EVENTS_TABLE;\r
+\r
+#define EFI_TCG2_FINAL_EVENTS_TABLE_VERSION   1\r
+\r
+#endif\r
index 2f535348ff32e5515928ed7c29250000a4577d83..96eadc23a9bc8b39c6fb767f43180783d8ee30a6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Ihis protocol is defined to abstract TPM2 hardware access in boot phase.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -93,22 +93,6 @@ typedef TREE_BOOT_SERVICE_CAPABILITY_1_0 TREE_BOOT_SERVICE_CAPABILITY;
 //\r
 #define PE_COFF_IMAGE     0x0000000000000010\r
 \r
-//#define EV_EFI_VARIABLE_DRIVER_CONFIG 0x80000001  // Defined in TCG\r
-//#define EV_EFI_ACTION                 0x80000007  // Defined in TCG\r
-#define EV_EFI_VARIABLE_AUTHORITY     0x800000E0\r
-\r
-#define  FIRMWARE_DEBUGGER_EVENT_STRING  "UEFI Debug Mode"\r
-\r
-#pragma pack(1)\r
-typedef struct {\r
-  EFI_GUID                          VariableName;\r
-  UINT64                            UnicodeNameLength;   // The TCG Definition used UINTN\r
-  UINT64                            VariableDataLength;  // The TCG Definition used UINTN\r
-  CHAR16                            UnicodeName[1];\r
-  INT8                              VariableData[1];\r
-} EFI_VARIABLE_DATA_TREE;\r
-#pragma pack()\r
-\r
 typedef UINT32 TrEE_PCRINDEX;\r
 typedef UINT32 TrEE_EVENTTYPE;\r
 \r
index 7d74b69769584da81e37956b07c6a48ac3b67e1e..64dc5f903af2a05207dedc7dc5277ea92929e0eb 100644 (file)
 \r
   ## Include/Protocol/TrEEProtocol.h\r
   gEfiTrEEProtocolGuid           = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}\r
+  \r
+  ## Include/Protocol/Tcg2Protocol.h\r
+  gEfiTcg2ProtocolGuid           = {0x607f766c, 0x7455, 0x42be, { 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}\r
+  gEfiTcg2FinalEventsTableGuid   = {0x1e2ed096, 0x30e2, 0x4254, { 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25 }}\r
 \r
   ## Include/Protocol/FormBrowser2.h\r
   gEfiFormBrowser2ProtocolGuid   =   {0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58}}\r