]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/TcgService.h
Improve status codes returned for functions of EFI_TCG_PROTOCOL. Note that after...
[mirror_edk2.git] / MdePkg / Include / Protocol / TcgService.h
CommitLineData
ac644614 1/** @file\r
267669ba 2 TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final\r
ac644614 3 See http://trustedcomputinggroup.org for the latest specification\r
4\r
65d02573 5 Copyright (c) 2007 - 2009, Intel Corporation \r
ac644614 6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
8069d49e 14**/\r
267669ba
LG
15\r
16#ifndef _TCG_SERVICE_PROTOCOL_H_\r
17#define _TCG_SERVICE_PROTOCOL_H_\r
18\r
f6d2bcc6 19#include <IndustryStandard/UefiTcgPlatform.h>\r
267669ba
LG
20\r
21#define EFI_TCG_PROTOCOL_GUID \\r
22 {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } } \r
23\r
24typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;\r
25\r
267669ba
LG
26typedef struct {\r
27 UINT8 Major;\r
28 UINT8 Minor;\r
29 UINT8 RevMajor;\r
30 UINT8 RevMinor;\r
31} TCG_VERSION;\r
32\r
33typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {\r
992f22b9 34 UINT8 Size; /// Size of this structure\r
267669ba
LG
35 TCG_VERSION StructureVersion; \r
36 TCG_VERSION ProtocolSpecVersion;\r
992f22b9
LG
37 UINT8 HashAlgorithmBitmap; /// Hash algorithms \r
38 /// this protocol is capable of : 01=SHA-1\r
39 BOOLEAN TPMPresentFlag; /// 00h = TPM not present\r
40 BOOLEAN TPMDeactivatedFlag; /// 01h = TPM currently deactivated\r
267669ba
LG
41} TCG_EFI_BOOT_SERVICE_CAPABILITY;\r
42\r
43typedef UINT32 TCG_ALGORITHM_ID;\r
44\r
65d02573 45///\r
46/// Note:\r
47/// Status codes returned for functions of EFI_TCG_PROTOCOL do not exactly match\r
48/// those defined in the TCG EFI Protocol 1.20 Final Specification.\r
49///\r
50\r
8069d49e
LG
51/**\r
52 This service provides EFI protocol capability information, state information \r
53 about the TPM, and Event Log state information.\r
54\r
55 @param This Indicates the calling context\r
56 @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY \r
57 structure and fills in the fields with the EFI protocol \r
58 capability information and the current TPM state information.\r
59 @param TCGFeatureFlags This is a pointer to the feature flags. No feature \r
60 flags are currently defined so this parameter \r
61 MUST be set to 0. However, in the future, \r
62 feature flags may be defined that, for example, \r
63 enable hash algorithm agility.\r
64 @param EventLogLocation This is a pointer to the address of the event log in memory.\r
65 @param EventLogLastEntry If the Event Log contains more than one entry, \r
66 this is a pointer to the address of the start of \r
67 the last entry in the event log in memory. \r
68\r
69 @retval EFI_SUCCESS Operation completed successfully.\r
65d02573 70 @retval EFI_INVALID_PARAMETER ProtocolCapability does not match TCG capability.\r
8069d49e 71**/\r
267669ba
LG
72typedef\r
73EFI_STATUS\r
8b13229b 74(EFIAPI *EFI_TCG_STATUS_CHECK)(\r
267669ba
LG
75 IN EFI_TCG_PROTOCOL *This,\r
76 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY\r
77 *ProtocolCapability,\r
78 OUT UINT32 *TCGFeatureFlags,\r
79 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,\r
80 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
81 );\r
82\r
8069d49e
LG
83/**\r
84 This service abstracts the capability to do a hash operation on a data buffer.\r
85 \r
86 @param This Indicates the calling context\r
87 @param HashData Pointer to the data buffer to be hashed\r
88 @param HashDataLen Length of the data buffer to be hashed\r
89 @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r
90 @param HashedDataLen Resultant length of the hashed data\r
91 @param HashedDataResult Resultant buffer of the hashed data \r
92 \r
93 @retval EFI_SUCCESS Operation completed successfully.\r
65d02573 94 @retval EFI_INVALID_PARAMETER HashDataLen is NULL.\r
95 @retval EFI_INVALID_PARAMETER HashDataLenResult is NULL.\r
96 @retval EFI_OUT_OF_RESOURCES Cannot allocate buffer of size *HashedDataLen.\r
97 @retval EFI_UNSUPPORTED AlgorithmId not supported.\r
98 @retval EFI_BUFFER_TOO_SMALL *HashedDataLen < sizeof (TCG_DIGEST).\r
8069d49e 99**/\r
267669ba
LG
100typedef\r
101EFI_STATUS\r
8b13229b 102(EFIAPI *EFI_TCG_HASH_ALL)(\r
267669ba
LG
103 IN EFI_TCG_PROTOCOL *This,\r
104 IN UINT8 *HashData,\r
105 IN UINT64 HashDataLen,\r
106 IN TCG_ALGORITHM_ID AlgorithmId,\r
107 IN OUT UINT64 *HashedDataLen,\r
108 IN OUT UINT8 **HashedDataResult\r
109 );\r
110\r
8069d49e
LG
111/**\r
112 This service abstracts the capability to add an entry to the Event Log.\r
113\r
114 @param This Indicates the calling context\r
115 @param TCGLogData Pointer to the start of the data buffer containing \r
116 the TCG_PCR_EVENT data structure. All fields in \r
117 this structure are properly filled by the caller.\r
118 @param EventNumber The event number of the event just logged\r
119 @param Flags Indicate additional flags. Only one flag has been \r
120 defined at this time, which is 0x01 and means the \r
121 extend operation should not be performed. All \r
122 other bits are reserved. \r
123 \r
124 @retval EFI_SUCCESS Operation completed successfully.\r
65d02573 125 @retval EFI_OUT_OF_RESOURCES Insufficient memory in the event log to complete this action.\r
8069d49e 126**/\r
267669ba
LG
127typedef\r
128EFI_STATUS\r
8b13229b 129(EFIAPI *EFI_TCG_LOG_EVENT)(\r
267669ba
LG
130 IN EFI_TCG_PROTOCOL *This,\r
131 IN TCG_PCR_EVENT *TCGLogData,\r
132 IN OUT UINT32 *EventNumber,\r
133 IN UINT32 Flags\r
134 );\r
135\r
8069d49e
LG
136/**\r
137 This service is a proxy for commands to the TPM.\r
138\r
139 @param This Indicates the calling context\r
140 @param TpmInputParameterBlockSize Size of the TPM input parameter block\r
141 @param TpmInputParameterBlock Pointer to the TPM input parameter block\r
142 @param TpmOutputParameterBlockSize Size of the TPM output parameter block\r
143 @param TpmOutputParameterBlock Pointer to the TPM output parameter block\r
144\r
145 @retval EFI_SUCCESS Operation completed successfully.\r
65d02573 146 @retval EFI_INVALID_PARAMETER Invalid ordinal.\r
147 @retval EFI_UNSUPPORTED Current Task Priority Level >= EFI_TPL_CALLBACK.\r
148 @retval EFI_TIMEOUT The TIS timed-out.\r
8069d49e 149**/\r
267669ba
LG
150typedef\r
151EFI_STATUS\r
8b13229b 152(EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(\r
267669ba 153 IN EFI_TCG_PROTOCOL *This,\r
b36e4814 154 IN UINT32 TpmInputParameterBlockSize,\r
155 IN UINT8 *TpmInputParameterBlock,\r
267669ba
LG
156 IN UINT32 TpmOutputParameterBlockSize,\r
157 IN UINT8 *TpmOutputParameterBlock\r
158 );\r
159\r
8069d49e
LG
160/**\r
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\r
162\r
163 @param This Indicates the calling context\r
164 @param HashData Physical address of the start of the data buffer \r
165 to be hashed, extended, and logged.\r
166 @param HashDataLen The length, in bytes, of the buffer referenced by HashData\r
167 @param AlgorithmId Identification of the Algorithm to use for the hashing operation\r
168 @param TCGLogData The physical address of the start of the data \r
169 buffer containing the TCG_PCR_EVENT data structure.\r
170 @param EventNumber The event number of the event just logged.\r
171 @param EventLogLastEntry Physical address of the first byte of the entry \r
172 just placed in the Event Log. If the Event Log was \r
173 empty when this function was called then this physical \r
174 address will be the same as the physical address of \r
175 the start of the Event Log.\r
176\r
177 @retval EFI_SUCCESS Operation completed successfully.\r
65d02573 178 @retval EFI_UNSUPPORTED AlgorithmId != TPM_ALG_SHA.\r
179 @retval EFI_UNSUPPORTED Current TPL >= EFI_TPL_CALLBACK.\r
8069d49e 180 @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
8069d49e 181**/\r
267669ba
LG
182typedef\r
183EFI_STATUS\r
8b13229b 184(EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(\r
267669ba 185 IN EFI_TCG_PROTOCOL *This,\r
5397fc66 186 IN EFI_PHYSICAL_ADDRESS HashData,\r
267669ba
LG
187 IN UINT64 HashDataLen,\r
188 IN TCG_ALGORITHM_ID AlgorithmId,\r
189 IN OUT TCG_PCR_EVENT *TCGLogData,\r
190 IN OUT UINT32 *EventNumber,\r
191 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry\r
192 );\r
193\r
44717a39 194///\r
195/// The EFI_TCG Protocol abstracts TCG activity.\r
196///\r
c28a5554 197struct _EFI_TCG_PROTOCOL {\r
267669ba
LG
198 EFI_TCG_STATUS_CHECK StatusCheck;\r
199 EFI_TCG_HASH_ALL HashAll;\r
200 EFI_TCG_LOG_EVENT LogEvent;\r
201 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;\r
202 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;\r
c28a5554 203};\r
267669ba
LG
204\r
205extern EFI_GUID gEfiTcgProtocolGuid;\r
206\r
207#endif\r