]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/TcgService.h
Grammatical and disclaimer changes (does not follow internal C coding stds.)
[mirror_edk2.git] / MdePkg / Include / Protocol / TcgService.h
1 /** @file
2 TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final
3 See http://trustedcomputinggroup.org for the latest specification
4
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.
10
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.
13
14 **/
15
16 #ifndef _TCG_SERVICE_PROTOCOL_H_
17 #define _TCG_SERVICE_PROTOCOL_H_
18
19 #include <IndustryStandard/UefiTcgPlatform.h>
20
21 #define EFI_TCG_PROTOCOL_GUID \
22 {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }
23
24 typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;
25
26 typedef struct {
27 UINT8 Major;
28 UINT8 Minor;
29 UINT8 RevMajor;
30 UINT8 RevMinor;
31 } TCG_VERSION;
32
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;
42
43 typedef UINT32 TCG_ALGORITHM_ID;
44
45 ///
46 /// Note:
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.
49 ///
50
51 /**
52 This service provides EFI protocol capability information, state information
53 about the TPM, and Event Log state information.
54
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.
68
69 @retval EFI_SUCCESS The operation completed successfully.
70 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.
71 **/
72 typedef
73 EFI_STATUS
74 (EFIAPI *EFI_TCG_STATUS_CHECK)(
75 IN EFI_TCG_PROTOCOL *This,
76 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY
77 *ProtocolCapability,
78 OUT UINT32 *TCGFeatureFlags,
79 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
80 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
81 );
82
83 /**
84 This service abstracts the capability to do a hash operation on a data buffer.
85
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.
92
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).
99 **/
100 typedef
101 EFI_STATUS
102 (EFIAPI *EFI_TCG_HASH_ALL)(
103 IN EFI_TCG_PROTOCOL *This,
104 IN UINT8 *HashData,
105 IN UINT64 HashDataLen,
106 IN TCG_ALGORITHM_ID AlgorithmId,
107 IN OUT UINT64 *HashedDataLen,
108 IN OUT UINT8 **HashedDataResult
109 );
110
111 /**
112 This service abstracts the capability to add an entry to the Event Log.
113
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.
123
124 @retval EFI_SUCCESS The operation completed successfully.
125 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_TCG_LOG_EVENT)(
130 IN EFI_TCG_PROTOCOL *This,
131 IN TCG_PCR_EVENT *TCGLogData,
132 IN OUT UINT32 *EventNumber,
133 IN UINT32 Flags
134 );
135
136 /**
137 This service is a proxy for commands to the TPM.
138
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.
144
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.
149 **/
150 typedef
151 EFI_STATUS
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
158 );
159
160 /**
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
162
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.
176
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.
181 **/
182 typedef
183 EFI_STATUS
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
192 );
193
194 ///
195 /// The EFI_TCG Protocol abstracts TCG activity.
196 ///
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;
203 };
204
205 extern EFI_GUID gEfiTcgProtocolGuid;
206
207 #endif