]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/TcgService.h
Fix doxygen issue:
[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, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. 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 <Uefi/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 //
27 // Set structure alignment to 1-byte
28 //
29 #pragma pack (push, 1)
30
31 typedef struct {
32 UINT8 Major;
33 UINT8 Minor;
34 UINT8 RevMajor;
35 UINT8 RevMinor;
36 } TCG_VERSION;
37
38 typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {
39 UINT8 Size; // Size of this structure
40 TCG_VERSION StructureVersion;
41 TCG_VERSION ProtocolSpecVersion;
42 UINT8 HashAlgorithmBitmap; // Hash algorithms
43 // this protocol is capable of : 01=SHA-1
44 BOOLEAN TPMPresentFlag; // 00h = TPM not present
45 BOOLEAN TPMDeactivatedFlag; // 01h = TPM currently deactivated
46 } TCG_EFI_BOOT_SERVICE_CAPABILITY;
47
48 typedef UINT32 TCG_ALGORITHM_ID;
49
50 //
51 // Restore original structure alignment
52 //
53 #pragma pack (pop)
54
55 /**
56 This service provides EFI protocol capability information, state information
57 about the TPM, and Event Log state information.
58
59 @param This Indicates the calling context
60 @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY
61 structure and fills in the fields with the EFI protocol
62 capability information and the current TPM state information.
63 @param TCGFeatureFlags This is a pointer to the feature flags. No feature
64 flags are currently defined so this parameter
65 MUST be set to 0. However, in the future,
66 feature flags may be defined that, for example,
67 enable hash algorithm agility.
68 @param EventLogLocation This is a pointer to the address of the event log in memory.
69 @param EventLogLastEntry If the Event Log contains more than one entry,
70 this is a pointer to the address of the start of
71 the last entry in the event log in memory.
72
73 @retval EFI_SUCCESS Operation completed successfully.
74 @retval EFI_DEVICE_ERROR The command was unsuccessful.
75 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
76 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.
77 @retval EFI_NOT_FOUND The component was not running
78
79 **/
80 typedef
81 EFI_STATUS
82 (EFIAPI *EFI_TCG_STATUS_CHECK)(
83 IN EFI_TCG_PROTOCOL *This,
84 OUT TCG_EFI_BOOT_SERVICE_CAPABILITY
85 *ProtocolCapability,
86 OUT UINT32 *TCGFeatureFlags,
87 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
88 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
89 );
90
91 /**
92 This service abstracts the capability to do a hash operation on a data buffer.
93
94 @param This Indicates the calling context
95 @param HashData Pointer to the data buffer to be hashed
96 @param HashDataLen Length of the data buffer to be hashed
97 @param AlgorithmId Identification of the Algorithm to use for the hashing operation
98 @param HashedDataLen Resultant length of the hashed data
99 @param HashedDataResult Resultant buffer of the hashed data
100
101 @retval EFI_SUCCESS Operation completed successfully.
102 @retval EFI_DEVICE_ERROR The command was unsuccessful.
103 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
104 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.
105 @retval EFI_NOT_FOUND The component was not running
106
107 **/
108 typedef
109 EFI_STATUS
110 (EFIAPI *EFI_TCG_HASH_ALL)(
111 IN EFI_TCG_PROTOCOL *This,
112 IN UINT8 *HashData,
113 IN UINT64 HashDataLen,
114 IN TCG_ALGORITHM_ID AlgorithmId,
115 IN OUT UINT64 *HashedDataLen,
116 IN OUT UINT8 **HashedDataResult
117 );
118
119 /**
120 This service abstracts the capability to add an entry to the Event Log.
121
122 @param This Indicates the calling context
123 @param TCGLogData Pointer to the start of the data buffer containing
124 the TCG_PCR_EVENT data structure. All fields in
125 this structure are properly filled by the caller.
126 @param EventNumber The event number of the event just logged
127 @param Flags Indicate additional flags. Only one flag has been
128 defined at this time, which is 0x01 and means the
129 extend operation should not be performed. All
130 other bits are reserved.
131
132 @retval EFI_SUCCESS Operation completed successfully.
133 @retval EFI_DEVICE_ERROR The command was unsuccessful.
134 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
135 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.
136 @retval EFI_NOT_FOUND The component was not running
137 **/
138 typedef
139 EFI_STATUS
140 (EFIAPI *EFI_TCG_LOG_EVENT)(
141 IN EFI_TCG_PROTOCOL *This,
142 IN TCG_PCR_EVENT *TCGLogData,
143 IN OUT UINT32 *EventNumber,
144 IN UINT32 Flags
145 );
146
147 /**
148 This service is a proxy for commands to the TPM.
149
150 @param This Indicates the calling context
151 @param TpmInputParameterBlockSize Size of the TPM input parameter block
152 @param TpmInputParameterBlock Pointer to the TPM input parameter block
153 @param TpmOutputParameterBlockSize Size of the TPM output parameter block
154 @param TpmOutputParameterBlock Pointer to the TPM output parameter block
155
156 @retval EFI_SUCCESS Operation completed successfully.
157 @retval EFI_DEVICE_ERROR The command was unsuccessful.
158 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
159 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.
160 @retval EFI_NOT_FOUND The component was not running
161 **/
162 typedef
163 EFI_STATUS
164 (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(
165 IN EFI_TCG_PROTOCOL *This,
166 IN UINT32 TpmInputParamterBlockSize,
167 IN UINT8 *TpmInputParamterBlock,
168 IN UINT32 TpmOutputParameterBlockSize,
169 IN UINT8 *TpmOutputParameterBlock
170 );
171
172 /**
173 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
174
175 @param This Indicates the calling context
176 @param HashData Physical address of the start of the data buffer
177 to be hashed, extended, and logged.
178 @param HashDataLen The length, in bytes, of the buffer referenced by HashData
179 @param AlgorithmId Identification of the Algorithm to use for the hashing operation
180 @param TCGLogData The physical address of the start of the data
181 buffer containing the TCG_PCR_EVENT data structure.
182 @param EventNumber The event number of the event just logged.
183 @param EventLogLastEntry Physical address of the first byte of the entry
184 just placed in the Event Log. If the Event Log was
185 empty when this function was called then this physical
186 address will be the same as the physical address of
187 the start of the Event Log.
188
189 @retval EFI_SUCCESS Operation completed successfully.
190 @retval EFI_DEVICE_ERROR The command was unsuccessful.
191 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
192 @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small.
193 @retval EFI_NOT_FOUND The component was not running
194 **/
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(
198 IN EFI_TCG_PROTOCOL *This,
199 IN EFI_PHYSICAL_ADDRESS HashData,
200 IN UINT64 HashDataLen,
201 IN TCG_ALGORITHM_ID AlgorithmId,
202 IN OUT TCG_PCR_EVENT *TCGLogData,
203 IN OUT UINT32 *EventNumber,
204 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry
205 );
206
207 /**
208 The EFI_TCG Protocol abstracts TCG activity.
209
210 @param StatusCheck This service provides information on the TPM.
211 @param HashAll This service abstracts the capability to do a hash
212 operation on a data buffer.
213 @param LogEvent This service abstracts the capability to add
214 an entry to the Event Log.
215 @param PassThroughToTPM This service provides a pass-through capability
216 from the caller to the system's TPM.
217 @param HashLogExtendEvent This service abstracts the capability to do a hash
218 operation on a data buffer, extend a specific TPM PCR
219 with the hash result, and add an entry to the Event Log.
220
221 **/
222 typedef struct _EFI_TCG_PROTOCOL {
223 EFI_TCG_STATUS_CHECK StatusCheck;
224 EFI_TCG_HASH_ALL HashAll;
225 EFI_TCG_LOG_EVENT LogEvent;
226 EFI_TCG_PASS_THROUGH_TO_TPM PassThroughToTpm;
227 EFI_TCG_HASH_LOG_EXTEND_EVENT HashLogExtendEvent;
228 } EFI_TCG_PROTOCOL;
229
230 extern EFI_GUID gEfiTcgProtocolGuid;
231
232 #endif