]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/TcgService.h
Update the copyright notice format
[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
9df063a0 5Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
10 \r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
ac644614 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
af2dc6a7 34 UINT8 Size; /// Size of this structure.\r
267669ba
LG
35 TCG_VERSION StructureVersion; \r
36 TCG_VERSION ProtocolSpecVersion;\r
af2dc6a7 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
af2dc6a7 69 @retval EFI_SUCCESS The 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
af2dc6a7 86 @param This Indicates the calling context.\r
87 @param HashData The pointer to the data buffer to be hashed.\r
88 @param HashDataLen The 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
8069d49e 92 \r
af2dc6a7 93 @retval EFI_SUCCESS The 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
af2dc6a7 115 @param TCGLogData The pointer to the start of the data buffer containing \r
8069d49e
LG
116 the TCG_PCR_EVENT data structure. All fields in \r
117 this structure are properly filled by the caller.\r
af2dc6a7 118 @param EventNumber The event number of the event just logged.\r
119 @param Flags Indicates additional flags. Only one flag has been \r
8069d49e
LG
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
af2dc6a7 124 @retval EFI_SUCCESS The 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
af2dc6a7 139 @param This Indicates the calling context.\r
140 @param TpmInputParameterBlockSize Size of the TPM input parameter block.\r
141 @param TpmInputParameterBlock The pointer to the TPM input parameter block.\r
142 @param TpmOutputParameterBlockSize Size of the TPM output parameter block.\r
143 @param TpmOutputParameterBlock The pointer to the TPM output parameter block.\r
8069d49e 144\r
af2dc6a7 145 @retval EFI_SUCCESS The 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
af2dc6a7 164 @param HashData The physical address of the start of the data buffer \r
8069d49e
LG
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
af2dc6a7 171 @param EventLogLastEntry The physical address of the first byte of the entry \r
8069d49e
LG
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
af2dc6a7 177 @retval EFI_SUCCESS The 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