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