2 This protocol is defined to abstract TPM2 hardware access in boot phase.
4 Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <IndustryStandard/UefiTcgPlatform.h>
19 #include <IndustryStandard/Tpm20.h>
21 #define EFI_TREE_PROTOCOL_GUID \
22 {0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f}
24 typedef struct _EFI_TREE_PROTOCOL EFI_TREE_PROTOCOL
;
26 typedef struct _TREE_VERSION
{
31 typedef UINT32 TREE_EVENT_LOG_BITMAP
;
32 typedef UINT32 TREE_EVENT_LOG_FORMAT
;
34 #define TREE_EVENT_LOG_FORMAT_TCG_1_2 0x00000001
36 typedef struct _TREE_BOOT_SERVICE_CAPABILITY
{
38 // Allocated size of the structure passed in
42 // Version of the TREE_BOOT_SERVICE_CAPABILITY structure itself.
43 // For this version of the protocol, the Major version shall be set to 1
44 // and the Minor version shall be set to 0.
46 TREE_VERSION StructureVersion
;
48 // Version of the TrEE protocol.
49 // For this version of the protocol, the Major version shall be set to 1
50 // and the Minor version shall be set to 0.
52 TREE_VERSION ProtocolVersion
;
54 // Supported hash algorithms
56 UINT32 HashAlgorithmBitmap
;
58 // Bitmap of supported event log formats
60 TREE_EVENT_LOG_BITMAP SupportedEventLogs
;
62 // False = TrEE not present
64 BOOLEAN TrEEPresentFlag
;
66 // Max size (in bytes) of a command that can be sent to the TrEE
68 UINT16 MaxCommandSize
;
70 // Max size (in bytes) of a response that can be provided by the TrEE
72 UINT16 MaxResponseSize
;
74 // 4-byte Vendor ID (see Trusted Computing Group, "TCG Vendor ID Registry,"
75 // Version 1.0, Revision 0.1, August 31, 2007, "TPM Capabilities Vendor ID" section)
77 UINT32 ManufacturerID
;
78 } TREE_BOOT_SERVICE_CAPABILITY_1_0
;
80 typedef TREE_BOOT_SERVICE_CAPABILITY_1_0 TREE_BOOT_SERVICE_CAPABILITY
;
82 #define TREE_BOOT_HASH_ALG_SHA1 0x00000001
83 #define TREE_BOOT_HASH_ALG_SHA256 0x00000002
84 #define TREE_BOOT_HASH_ALG_SHA384 0x00000004
85 #define TREE_BOOT_HASH_ALG_SHA512 0x00000008
88 // This bit is shall be set when an event shall be extended but not logged.
90 #define TREE_EXTEND_ONLY 0x0000000000000001
92 // This bit shall be set when the intent is to measure a PE/COFF image.
94 #define PE_COFF_IMAGE 0x0000000000000010
96 typedef UINT32 TrEE_PCRINDEX
;
97 typedef UINT32 TrEE_EVENTTYPE
;
99 #define MAX_PCR_INDEX 23
100 #define TREE_EVENT_HEADER_VERSION 1
106 // Size of the event header itself (sizeof(TrEE_EVENT_HEADER)).
110 // Header version. For this version of this specification, the value shall be 1.
112 UINT16 HeaderVersion
;
114 // Index of the PCR that shall be extended (0 - 23).
116 TrEE_PCRINDEX PCRIndex
;
118 // Type of the event that shall be extended (and optionally logged).
120 TrEE_EVENTTYPE EventType
;
125 // Total size of the event including the Size component, the header and the Event data.
128 TrEE_EVENT_HEADER Header
;
135 The EFI_TREE_PROTOCOL GetCapability function call provides protocol
136 capability information and state information about the TrEE.
138 @param[in] This Indicates the calling context
139 @param[out] ProtocolCapability The caller allocates memory for a TREE_BOOT_SERVICE_CAPABILITY
140 structure and sets the size field to the size of the structure allocated.
141 The callee fills in the fields with the EFI protocol capability information
142 and the current TrEE state information up to the number of fields which
143 fit within the size of the structure passed in.
145 @retval EFI_SUCCESS Operation completed successfully.
146 @retval EFI_DEVICE_ERROR The command was unsuccessful.
147 The ProtocolCapability variable will not be populated.
148 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
149 The ProtocolCapability variable will not be populated.
150 @retval EFI_BUFFER_TOO_SMALL The ProtocolCapability variable is too small to hold the full response.
151 It will be partially populated (required Size field will be set).
155 (EFIAPI
*EFI_TREE_GET_CAPABILITY
) (
156 IN EFI_TREE_PROTOCOL
*This
,
157 IN OUT TREE_BOOT_SERVICE_CAPABILITY
*ProtocolCapability
161 The EFI_TREE_PROTOCOL Get Event Log function call allows a caller to
162 retrieve the address of a given event log and its last entry.
164 @param[in] This Indicates the calling context
165 @param[in] EventLogFormat The type of the event log for which the information is requested.
166 @param[out] EventLogLocation A pointer to the memory address of the event log.
167 @param[out] EventLogLastEntry If the Event Log contains more than one entry, this is a pointer to the
168 address of the start of the last entry in the event log in memory.
169 @param[out] EventLogTruncated If the Event Log is missing at least one entry because an event would
170 have exceeded the area allocated for events, this value is set to TRUE.
171 Otherwise, the value will be FALSE and the Event Log will be complete.
173 @retval EFI_SUCCESS Operation completed successfully.
174 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect
175 (e.g. asking for an event log whose format is not supported).
179 (EFIAPI
*EFI_TREE_GET_EVENT_LOG
) (
180 IN EFI_TREE_PROTOCOL
*This
,
181 IN TREE_EVENT_LOG_FORMAT EventLogFormat
,
182 OUT EFI_PHYSICAL_ADDRESS
*EventLogLocation
,
183 OUT EFI_PHYSICAL_ADDRESS
*EventLogLastEntry
,
184 OUT BOOLEAN
*EventLogTruncated
188 The EFI_TREE_PROTOCOL HashLogExtendEvent function call provides callers with
189 an opportunity to extend and optionally log events without requiring
190 knowledge of actual TPM commands.
191 The extend operation will occur even if this function cannot create an event
192 log entry (e.g. due to the event log being full).
194 @param[in] This Indicates the calling context
195 @param[in] Flags Bitmap providing additional information.
196 @param[in] DataToHash Physical address of the start of the data buffer to be hashed.
197 @param[in] DataToHashLen The length in bytes of the buffer referenced by DataToHash.
198 @param[in] Event Pointer to data buffer containing information about the event.
200 @retval EFI_SUCCESS Operation completed successfully.
201 @retval EFI_DEVICE_ERROR The command was unsuccessful.
202 @retval EFI_VOLUME_FULL The extend operation occurred, but the event could not be written to one or more event logs.
203 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
204 @retval EFI_UNSUPPORTED The PE/COFF image type is not supported.
208 (EFIAPI
* EFI_TREE_HASH_LOG_EXTEND_EVENT
) (
209 IN EFI_TREE_PROTOCOL
*This
,
211 IN EFI_PHYSICAL_ADDRESS DataToHash
,
212 IN UINT64 DataToHashLen
,
217 This service enables the sending of commands to the TrEE.
219 @param[in] This Indicates the calling context
220 @param[in] InputParameterBlockSize Size of the TrEE input parameter block.
221 @param[in] InputParameterBlock Pointer to the TrEE input parameter block.
222 @param[in] OutputParameterBlockSize Size of the TrEE output parameter block.
223 @param[in] OutputParameterBlock Pointer to the TrEE output parameter block.
225 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
226 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
227 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
228 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
232 (EFIAPI
*EFI_TREE_SUBMIT_COMMAND
) (
233 IN EFI_TREE_PROTOCOL
*This
,
234 IN UINT32 InputParameterBlockSize
,
235 IN UINT8
*InputParameterBlock
,
236 IN UINT32 OutputParameterBlockSize
,
237 IN UINT8
*OutputParameterBlock
240 struct _EFI_TREE_PROTOCOL
{
241 EFI_TREE_GET_CAPABILITY GetCapability
;
242 EFI_TREE_GET_EVENT_LOG GetEventLog
;
243 EFI_TREE_HASH_LOG_EXTEND_EVENT HashLogExtendEvent
;
244 EFI_TREE_SUBMIT_COMMAND SubmitCommand
;
247 extern EFI_GUID gEfiTrEEProtocolGuid
;