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