]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.c
Vlv2TbltDevicePkg/Tcg2PhysicalPresenceLib: use Tcg2 instead of TrEE.
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / DxeTcg2PhysicalPresenceLibNull / DxeTcg2PhysicalPresenceLibNull.c
CommitLineData
f4e7aa05
TH
1/** @file\r
2 Execute pending TPM2 requests from OS or BIOS.\r
3\r
4 Caution: This module requires additional review when modified.\r
5 This driver will have external input - variable.\r
6 This external input must be validated carefully to avoid security issue.\r
7\r
9461604e 8 Tcg2ExecutePendingTpmRequest() will receive untrusted input and do validation.\r
f4e7aa05
TH
9\r
10Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
11This program and the accompanying materials \r
12are licensed and made available under the terms and conditions of the BSD License \r
13which accompanies this distribution. The full text of the license may be found at \r
14http://opensource.org/licenses/bsd-license.php\r
15\r
16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
17WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
18\r
19**/\r
20\r
21#include <PiDxe.h>\r
22\r
9461604e 23#include <Protocol/Tcg2Protocol.h>\r
f4e7aa05
TH
24#include <Protocol/VariableLock.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/UefiRuntimeServicesTableLib.h>\r
28#include <Library/UefiDriverEntryPoint.h>\r
29#include <Library/UefiBootServicesTableLib.h>\r
30#include <Library/UefiLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32#include <Library/PrintLib.h>\r
33#include <Library/HiiLib.h>\r
34#include <Guid/EventGroup.h>\r
9461604e 35#include <Guid/Tcg2PhysicalPresenceData.h>\r
f4e7aa05 36#include <Library/Tpm2CommandLib.h>\r
9461604e 37#include <Library/Tcg2PpVendorLib.h>\r
f4e7aa05
TH
38\r
39\r
40/**\r
41 Get string by string id from HII Interface.\r
42\r
43 @param[in] Id String ID.\r
44\r
45 @retval CHAR16 * String from ID.\r
46 @retval NULL If error occurs.\r
47\r
48**/\r
49CHAR16 *\r
9461604e 50Tcg2PhysicalPresenceGetStringById (\r
f4e7aa05
TH
51 IN EFI_STRING_ID Id\r
52 )\r
53{\r
54 return NULL;\r
55}\r
56\r
57/**\r
58 Send ClearControl and Clear command to TPM.\r
59\r
60 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
61\r
62 @retval EFI_SUCCESS Operation completed successfully.\r
63 @retval EFI_TIMEOUT The register can't run into the expected status in time.\r
64 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r
65 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
66\r
67**/\r
68EFI_STATUS\r
69EFIAPI\r
70TpmCommandClear (\r
71 IN TPM2B_AUTH *PlatformAuth OPTIONAL\r
72 )\r
73{\r
74 return EFI_SUCCESS;\r
75}\r
76\r
77/**\r
78 Execute physical presence operation requested by the OS.\r
79\r
80 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
81 @param[in] CommandCode Physical presence operation value.\r
82 @param[in, out] PpiFlags The physical presence interface flags.\r
83 \r
84 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Unknown physical presence operation.\r
85 @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE Error occurred during sending command to TPM or \r
86 receiving response from TPM.\r
87 @retval Others Return code from the TPM device after command execution.\r
88**/\r
89UINT32\r
9461604e 90Tcg2ExecutePhysicalPresence (\r
f4e7aa05
TH
91 IN TPM2B_AUTH *PlatformAuth, OPTIONAL\r
92 IN UINT32 CommandCode,\r
93 IN OUT EFI_TREE_PHYSICAL_PRESENCE_FLAGS *PpiFlags\r
94 )\r
95{\r
96 return 0;\r
97}\r
98\r
99\r
100/**\r
101 Read the specified key for user confirmation.\r
102\r
103 @param[in] CautionKey If true, F12 is used as confirm key;\r
104 If false, F10 is used as confirm key.\r
105\r
106 @retval TRUE User confirmed the changes by input.\r
107 @retval FALSE User discarded the changes.\r
108**/\r
109BOOLEAN\r
9461604e 110Tcg2ReadUserKey (\r
f4e7aa05
TH
111 IN BOOLEAN CautionKey\r
112 )\r
113{\r
114 return FALSE;\r
115}\r
116\r
117/**\r
118 The constructor function register UNI strings into imageHandle.\r
119 \r
120 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. \r
121\r
122 @param ImageHandle The firmware allocated handle for the EFI image.\r
123 @param SystemTable A pointer to the EFI System Table.\r
124 \r
125 @retval EFI_SUCCESS The constructor successfully added string package.\r
126 @retval Other value The constructor can't add string package.\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
9461604e 130Tcg2PhysicalPresenceLibConstructor (\r
f4e7aa05
TH
131 IN EFI_HANDLE ImageHandle,\r
132 IN EFI_SYSTEM_TABLE *SystemTable\r
133 )\r
134{\r
135 return EFI_SUCCESS;\r
136}\r
137\r
138/**\r
139 Display the confirm text and get user confirmation.\r
140\r
141 @param[in] TpmPpCommand The requested TPM physical presence command.\r
142\r
143 @retval TRUE The user has confirmed the changes.\r
144 @retval FALSE The user doesn't confirm the changes.\r
145**/\r
146BOOLEAN\r
9461604e 147Tcg2UserConfirm (\r
f4e7aa05
TH
148 IN UINT32 TpmPpCommand\r
149 )\r
150{\r
151 return FALSE; \r
152}\r
153\r
154/**\r
155 Check if there is a valid physical presence command request. Also updates parameter value \r
156 to whether the requested physical presence command already confirmed by user\r
157 \r
9461604e 158 @param[in] TcgPpData EFI Tcg2 Physical Presence request data. \r
f4e7aa05
TH
159 @param[in] Flags The physical presence interface flags.\r
160 @param[out] RequestConfirmed If the physical presence operation command required user confirm from UI.\r
161 True, it indicates the command doesn't require user confirm, or already confirmed \r
162 in last boot cycle by user.\r
163 False, it indicates the command need user confirm from UI.\r
164\r
165 @retval TRUE Physical Presence operation command is valid.\r
166 @retval FALSE Physical Presence operation command is invalid.\r
167\r
168**/\r
169BOOLEAN\r
9461604e 170Tcg2HaveValidTpmRequest (\r
f4e7aa05
TH
171 IN EFI_TREE_PHYSICAL_PRESENCE *TcgPpData,\r
172 IN EFI_TREE_PHYSICAL_PRESENCE_FLAGS Flags,\r
173 OUT BOOLEAN *RequestConfirmed\r
174 )\r
175{\r
176 return TRUE;\r
177}\r
178\r
179\r
180/**\r
181 Check and execute the requested physical presence command.\r
182\r
183 Caution: This function may receive untrusted input.\r
184 TcgPpData variable is external input, so this function will validate\r
185 its data structure to be valid value.\r
186\r
187 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
188 @param[in] TcgPpData Point to the physical presence NV variable.\r
189 @param[in] Flags The physical presence interface flags.\r
190**/\r
191VOID\r
9461604e 192Tcg2ExecutePendingTpmRequest (\r
f4e7aa05
TH
193 IN TPM2B_AUTH *PlatformAuth, OPTIONAL\r
194 IN EFI_TREE_PHYSICAL_PRESENCE *TcgPpData,\r
195 IN EFI_TREE_PHYSICAL_PRESENCE_FLAGS Flags\r
196 )\r
197{\r
198 return;\r
199}\r
200\r
201/**\r
202 Check and execute the pending TPM request.\r
203\r
204 The TPM request may come from OS or BIOS. This API will display request information and wait \r
205 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r
206 the TPM request is confirmed, and one or more reset may be required to make TPM request to \r
207 take effect.\r
208 \r
209 This API should be invoked after console in and console out are all ready as they are required\r
210 to display request information and get user input to confirm the request. \r
211\r
212 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
213**/\r
214VOID\r
215EFIAPI\r
9461604e 216Tcg2PhysicalPresenceLibProcessRequest (\r
f4e7aa05
TH
217 IN TPM2B_AUTH *PlatformAuth OPTIONAL\r
218 )\r
219{\r
220 return;\r
221}\r
222\r
223/**\r
224 Check if the pending TPM request needs user input to confirm.\r
225\r
226 The TPM request may come from OS. This API will check if TPM request exists and need user\r
227 input to confirmation.\r
228 \r
229 @retval TRUE TPM needs input to confirm user physical presence.\r
230 @retval FALSE TPM doesn't need input to confirm user physical presence.\r
231\r
232**/\r
233BOOLEAN\r
234EFIAPI\r
9461604e 235Tcg2PhysicalPresenceLibNeedUserConfirm(\r
f4e7aa05
TH
236 VOID\r
237 )\r
238{\r
239\r
240 return FALSE;\r
241}\r
242\r