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 #include <IndustryStandard/UefiTcgPlatform.h>
21 #define EFI_TCG_PROTOCOL_GUID \
22 {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }
24 typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL
;
33 typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY
{
34 UINT8 Size
; /// Size of this structure.
35 TCG_VERSION StructureVersion
;
36 TCG_VERSION ProtocolSpecVersion
;
37 UINT8 HashAlgorithmBitmap
; /// Hash algorithms .
38 /// This protocol is capable of : 01=SHA-1.
39 BOOLEAN TPMPresentFlag
; /// 00h = TPM not present.
40 BOOLEAN TPMDeactivatedFlag
; /// 01h = TPM currently deactivated.
41 } TCG_EFI_BOOT_SERVICE_CAPABILITY
;
43 typedef UINT32 TCG_ALGORITHM_ID
;
47 /// Status codes returned for functions of EFI_TCG_PROTOCOL do not exactly match
48 /// those defined in the TCG EFI Protocol 1.20 Final Specification.
52 This service provides EFI protocol capability information, state information
53 about the TPM, and Event Log state information.
55 @param This Indicates the calling context
56 @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY
57 structure and fills in the fields with the EFI protocol
58 capability information and the current TPM state information.
59 @param TCGFeatureFlags This is a pointer to the feature flags. No feature
60 flags are currently defined so this parameter
61 MUST be set to 0. However, in the future,
62 feature flags may be defined that, for example,
63 enable hash algorithm agility.
64 @param EventLogLocation This is a pointer to the address of the event log in memory.
65 @param EventLogLastEntry If the Event Log contains more than one entry,
66 this is a pointer to the address of the start of
67 the last entry in the event log in memory.
69 @retval EFI_SUCCESS The operation completed successfully.
70 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.
74 (EFIAPI
*EFI_TCG_STATUS_CHECK
)(
75 IN EFI_TCG_PROTOCOL
*This
,
76 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY
78 OUT UINT32
*TCGFeatureFlags
,
79 OUT EFI_PHYSICAL_ADDRESS
*EventLogLocation
,
80 OUT EFI_PHYSICAL_ADDRESS
*EventLogLastEntry
84 This service abstracts the capability to do a hash operation on a data buffer.
86 @param This Indicates the calling context.
87 @param HashData The pointer to the data buffer to be hashed.
88 @param HashDataLen The length of the data buffer to be hashed.
89 @param AlgorithmId Identification of the Algorithm to use for the hashing operation.
90 @param HashedDataLen Resultant length of the hashed data.
91 @param HashedDataResult Resultant buffer of the hashed data.
93 @retval EFI_SUCCESS The operation completed successfully.
94 @retval EFI_INVALID_PARAMETER HashDataLen is NULL.
95 @retval EFI_INVALID_PARAMETER HashDataLenResult is NULL.
96 @retval EFI_OUT_OF_RESOURCES Cannot allocate buffer of size *HashedDataLen.
97 @retval EFI_UNSUPPORTED AlgorithmId not supported.
98 @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST).
102 (EFIAPI
*EFI_TCG_HASH_ALL
)(
103 IN EFI_TCG_PROTOCOL
*This
,
105 IN UINT64 HashDataLen
,
106 IN TCG_ALGORITHM_ID AlgorithmId
,
107 IN OUT UINT64
*HashedDataLen
,
108 IN OUT UINT8
**HashedDataResult
112 This service abstracts the capability to add an entry to the Event Log.
114 @param This Indicates the calling context
115 @param TCGLogData The pointer to the start of the data buffer containing
116 the TCG_PCR_EVENT data structure. All fields in
117 this structure are properly filled by the caller.
118 @param EventNumber The event number of the event just logged.
119 @param Flags Indicates additional flags. Only one flag has been
120 defined at this time, which is 0x01 and means the
121 extend operation should not be performed. All
122 other bits are reserved.
124 @retval EFI_SUCCESS The operation completed successfully.
125 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.
129 (EFIAPI
*EFI_TCG_LOG_EVENT
)(
130 IN EFI_TCG_PROTOCOL
*This
,
131 IN TCG_PCR_EVENT
*TCGLogData
,
132 IN OUT UINT32
*EventNumber
,
137 This service is a proxy for commands to the TPM.
139 @param This Indicates the calling context.
140 @param TpmInputParameterBlockSize Size of the TPM input parameter block.
141 @param TpmInputParameterBlock The pointer to the TPM input parameter block.
142 @param TpmOutputParameterBlockSize Size of the TPM output parameter block.
143 @param TpmOutputParameterBlock The pointer to the TPM output parameter block.
145 @retval EFI_SUCCESS The operation completed successfully.
146 @retval EFI_INVALID_PARAMETER Invalid ordinal.
147 @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK.
148 @retval EFI_TIMEOUT The TIS timed-out.
152 (EFIAPI
*EFI_TCG_PASS_THROUGH_TO_TPM
)(
153 IN EFI_TCG_PROTOCOL
*This
,
154 IN UINT32 TpmInputParameterBlockSize
,
155 IN UINT8
*TpmInputParameterBlock
,
156 IN UINT32 TpmOutputParameterBlockSize
,
157 IN UINT8
*TpmOutputParameterBlock
161 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
163 @param This Indicates the calling context
164 @param HashData The physical address of the start of the data buffer
165 to be hashed, extended, and logged.
166 @param HashDataLen The length, in bytes, of the buffer referenced by HashData
167 @param AlgorithmId Identification of the Algorithm to use for the hashing operation
168 @param TCGLogData The physical address of the start of the data
169 buffer containing the TCG_PCR_EVENT data structure.
170 @param EventNumber The event number of the event just logged.
171 @param EventLogLastEntry The physical address of the first byte of the entry
172 just placed in the Event Log. If the Event Log was
173 empty when this function was called then this physical
174 address will be the same as the physical address of
175 the start of the Event Log.
177 @retval EFI_SUCCESS The operation completed successfully.
178 @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.
179 @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.
180 @retval EFI_DEVICE_ERROR The command was unsuccessful.
184 (EFIAPI
*EFI_TCG_HASH_LOG_EXTEND_EVENT
)(
185 IN EFI_TCG_PROTOCOL
*This
,
186 IN EFI_PHYSICAL_ADDRESS HashData
,
187 IN UINT64 HashDataLen
,
188 IN TCG_ALGORITHM_ID AlgorithmId
,
189 IN OUT TCG_PCR_EVENT
*TCGLogData
,
190 IN OUT UINT32
*EventNumber
,
191 OUT EFI_PHYSICAL_ADDRESS
*EventLogLastEntry
195 /// The EFI_TCG Protocol abstracts TCG activity.
197 struct _EFI_TCG_PROTOCOL
{
198 EFI_TCG_STATUS_CHECK StatusCheck
;
199 EFI_TCG_HASH_ALL HashAll
;
200 EFI_TCG_LOG_EVENT LogEvent
;
201 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm
;
202 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent
;
205 extern EFI_GUID gEfiTcgProtocolGuid
;