2 TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final
3 See http://trustedcomputinggroup.org for the latest specification
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _TCG_SERVICE_PROTOCOL_H_
17 #define _TCG_SERVICE_PROTOCOL_H_
19 FILE_LICENCE ( BSD3 );
21 #include <ipxe/efi/IndustryStandard/UefiTcgPlatform.h>
23 #define EFI_TCG_PROTOCOL_GUID \
24 {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }
26 typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;
35 typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {
36 UINT8 Size; /// Size of this structure.
37 TCG_VERSION StructureVersion;
38 TCG_VERSION ProtocolSpecVersion;
39 UINT8 HashAlgorithmBitmap; /// Hash algorithms .
40 /// This protocol is capable of : 01=SHA-1.
41 BOOLEAN TPMPresentFlag; /// 00h = TPM not present.
42 BOOLEAN TPMDeactivatedFlag; /// 01h = TPM currently deactivated.
43 } TCG_EFI_BOOT_SERVICE_CAPABILITY;
45 typedef UINT32 TCG_ALGORITHM_ID;
49 /// Status codes returned for functions of EFI_TCG_PROTOCOL do not exactly match
50 /// those defined in the TCG EFI Protocol 1.20 Final Specification.
54 This service provides EFI protocol capability information, state information
55 about the TPM, and Event Log state information.
57 @param This Indicates the calling context
58 @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY
59 structure and fills in the fields with the EFI protocol
60 capability information and the current TPM state information.
61 @param TCGFeatureFlags This is a pointer to the feature flags. No feature
62 flags are currently defined so this parameter
63 MUST be set to 0. However, in the future,
64 feature flags may be defined that, for example,
65 enable hash algorithm agility.
66 @param EventLogLocation This is a pointer to the address of the event log in memory.
67 @param EventLogLastEntry If the Event Log contains more than one entry,
68 this is a pointer to the address of the start of
69 the last entry in the event log in memory.
71 @retval EFI_SUCCESS The operation completed successfully.
72 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.
76 (EFIAPI *EFI_TCG_STATUS_CHECK)(
77 IN EFI_TCG_PROTOCOL *This,
78 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY
80 OUT UINT32 *TCGFeatureFlags,
81 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
82 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
86 This service abstracts the capability to do a hash operation on a data buffer.
88 @param This Indicates the calling context.
89 @param HashData The pointer to the data buffer to be hashed.
90 @param HashDataLen The length of the data buffer to be hashed.
91 @param AlgorithmId Identification of the Algorithm to use for the hashing operation.
92 @param HashedDataLen Resultant length of the hashed data.
93 @param HashedDataResult Resultant buffer of the hashed data.
95 @retval EFI_SUCCESS The operation completed successfully.
96 @retval EFI_INVALID_PARAMETER HashDataLen is NULL.
97 @retval EFI_INVALID_PARAMETER HashDataLenResult is NULL.
98 @retval EFI_OUT_OF_RESOURCES Cannot allocate buffer of size *HashedDataLen.
99 @retval EFI_UNSUPPORTED AlgorithmId not supported.
100 @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST).
104 (EFIAPI *EFI_TCG_HASH_ALL)(
105 IN EFI_TCG_PROTOCOL *This,
107 IN UINT64 HashDataLen,
108 IN TCG_ALGORITHM_ID AlgorithmId,
109 IN OUT UINT64 *HashedDataLen,
110 IN OUT UINT8 **HashedDataResult
114 This service abstracts the capability to add an entry to the Event Log.
116 @param This Indicates the calling context
117 @param TCGLogData The pointer to the start of the data buffer containing
118 the TCG_PCR_EVENT data structure. All fields in
119 this structure are properly filled by the caller.
120 @param EventNumber The event number of the event just logged.
121 @param Flags Indicates additional flags. Only one flag has been
122 defined at this time, which is 0x01 and means the
123 extend operation should not be performed. All
124 other bits are reserved.
126 @retval EFI_SUCCESS The operation completed successfully.
127 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.
131 (EFIAPI *EFI_TCG_LOG_EVENT)(
132 IN EFI_TCG_PROTOCOL *This,
133 IN TCG_PCR_EVENT *TCGLogData,
134 IN OUT UINT32 *EventNumber,
139 This service is a proxy for commands to the TPM.
141 @param This Indicates the calling context.
142 @param TpmInputParameterBlockSize Size of the TPM input parameter block.
143 @param TpmInputParameterBlock The pointer to the TPM input parameter block.
144 @param TpmOutputParameterBlockSize Size of the TPM output parameter block.
145 @param TpmOutputParameterBlock The pointer to the TPM output parameter block.
147 @retval EFI_SUCCESS The operation completed successfully.
148 @retval EFI_INVALID_PARAMETER Invalid ordinal.
149 @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK.
150 @retval EFI_TIMEOUT The TIS timed-out.
154 (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(
155 IN EFI_TCG_PROTOCOL *This,
156 IN UINT32 TpmInputParameterBlockSize,
157 IN UINT8 *TpmInputParameterBlock,
158 IN UINT32 TpmOutputParameterBlockSize,
159 IN UINT8 *TpmOutputParameterBlock
163 This service abstracts the capability to do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and add an entry to the Event Log
165 @param This Indicates the calling context
166 @param HashData The physical address of the start of the data buffer
167 to be hashed, extended, and logged.
168 @param HashDataLen The length, in bytes, of the buffer referenced by HashData
169 @param AlgorithmId Identification of the Algorithm to use for the hashing operation
170 @param TCGLogData The physical address of the start of the data
171 buffer containing the TCG_PCR_EVENT data structure.
172 @param EventNumber The event number of the event just logged.
173 @param EventLogLastEntry The physical address of the first byte of the entry
174 just placed in the Event Log. If the Event Log was
175 empty when this function was called then this physical
176 address will be the same as the physical address of
177 the start of the Event Log.
179 @retval EFI_SUCCESS The operation completed successfully.
180 @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.
181 @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.
182 @retval EFI_DEVICE_ERROR The command was unsuccessful.
186 (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(
187 IN EFI_TCG_PROTOCOL *This,
188 IN EFI_PHYSICAL_ADDRESS HashData,
189 IN UINT64 HashDataLen,
190 IN TCG_ALGORITHM_ID AlgorithmId,
191 IN OUT TCG_PCR_EVENT *TCGLogData,
192 IN OUT UINT32 *EventNumber,
193 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
197 /// The EFI_TCG Protocol abstracts TCG activity.
199 struct _EFI_TCG_PROTOCOL {
200 EFI_TCG_STATUS_CHECK StatusCheck;
201 EFI_TCG_HASH_ALL HashAll;
202 EFI_TCG_LOG_EVENT LogEvent;
203 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;
204 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
207 extern EFI_GUID gEfiTcgProtocolGuid;