]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h
Update UID drivers to align with latest UEFI spec 2.3.1.
[mirror_edk2.git] / SecurityPkg / UserIdentification / UserProfileManagerDxe / UserProfileManager.h
CommitLineData
0c18794e 1/** @file\r
2 The header file for user profile manager driver.\r
3 \r
a0c56a82 4Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
0c18794e 5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __EFI_USER_PROFILE_MANAGER_H__\r
16#define __EFI_USER_PROFILE_MANAGER_H__\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Guid/GlobalVariable.h>\r
21#include <Guid/MdeModuleHii.h>\r
22\r
23#include <Protocol/HiiConfigAccess.h>\r
24#include <Protocol/DevicePathToText.h>\r
6f0b8648 25#include <Protocol/UserCredential2.h>\r
0c18794e 26#include <Protocol/UserManager.h>\r
27\r
28#include <Library/UefiRuntimeServicesTableLib.h>\r
29#include <Library/UefiBootServicesTableLib.h>\r
30#include <Library/MemoryAllocationLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32#include <Library/DevicePathLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/UefiLib.h>\r
35#include <Library/PrintLib.h>\r
36#include <Library/HiiLib.h>\r
37\r
38#include "UserProfileManagerData.h"\r
39\r
40#define USER_NAME_LENGTH 17\r
41\r
42//\r
43// Credential Provider Information.\r
44//\r
45typedef struct {\r
46 UINTN Count;\r
6f0b8648 47 EFI_USER_CREDENTIAL2_PROTOCOL *Provider[1];\r
0c18794e 48} CREDENTIAL_PROVIDER_INFO;\r
49\r
50//\r
51// User profile information structure.\r
52//\r
53typedef struct {\r
54 UINT64 UsageCount;\r
55 EFI_TIME CreateDate;\r
56 EFI_TIME UsageDate;\r
57 UINTN AccessPolicyLen;\r
58 UINTN IdentityPolicyLen;\r
59 UINTN NewIdentityPolicyLen; \r
60 UINT8 *AccessPolicy;\r
61 UINT8 *IdentityPolicy;\r
62 UINT8 *NewIdentityPolicy;\r
63 CHAR16 UserName[USER_NAME_LENGTH];\r
64 BOOLEAN CreateDateExist;\r
65 BOOLEAN UsageDateExist;\r
66 BOOLEAN AccessPolicyModified;\r
67 BOOLEAN IdentityPolicyModified;\r
68 BOOLEAN NewIdentityPolicyModified;\r
69} USER_INFO;\r
70\r
71//\r
72// User access information structure.\r
73//\r
74typedef struct {\r
75 UINTN LoadPermitLen;\r
76 UINTN LoadForbidLen;\r
77 UINTN ConnectPermitLen;\r
78 UINTN ConnectForbidLen;\r
79 UINT8 *LoadPermit;\r
80 UINT8 *LoadForbid;\r
81 UINT8 *ConnectPermit;\r
82 UINT8 *ConnectForbid;\r
83 UINT32 AccessBootOrder;\r
84 UINT8 AccessRight;\r
85 UINT8 AccessSetup;\r
86} USER_INFO_ACCESS;\r
87\r
88#define USER_PROFILE_MANAGER_SIGNATURE SIGNATURE_32 ('U', 'P', 'M', 'S')\r
89\r
90typedef struct {\r
91 UINTN Signature;\r
92 EFI_HANDLE DriverHandle;\r
93 EFI_HII_HANDLE HiiHandle;\r
94 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
95} USER_PROFILE_MANAGER_CALLBACK_INFO;\r
96\r
97//\r
98// HII specific Vendor Device Path definition.\r
99//\r
100typedef struct {\r
101 VENDOR_DEVICE_PATH VendorDevicePath;\r
102 EFI_DEVICE_PATH_PROTOCOL End;\r
103} HII_VENDOR_DEVICE_PATH;\r
104\r
105//\r
106// This is the generated IFR binary data for each formset defined in VFR.\r
107//\r
108extern UINT8 UserProfileManagerVfrBin[];\r
109\r
110//\r
111// This is the generated String package data for .UNI file.\r
112//\r
113extern UINT8 UserProfileManagerStrings[];\r
114\r
0c18794e 115//\r
116// The user manager protocol, used in several function.\r
117//\r
118extern EFI_USER_MANAGER_PROTOCOL *mUserManager;\r
119\r
120//\r
121// The credential providers database in system.\r
122//\r
123extern CREDENTIAL_PROVIDER_INFO *mProviderInfo;\r
124\r
125//\r
126// The variables used to update identity policy.\r
127//\r
128extern UINT8 mProviderChoice;\r
129extern UINT8 mConncetLogical;\r
130\r
131//\r
132// The variables used to update access policy.\r
133//\r
134extern USER_INFO_ACCESS mAccessInfo;\r
135\r
136//\r
137// The user information used to record all data in UI.\r
138//\r
139extern USER_INFO mUserInfo;\r
140\r
141extern USER_PROFILE_MANAGER_CALLBACK_INFO *mCallbackInfo;\r
142\r
143\r
144/**\r
145 Get string by string id from HII Interface.\r
146\r
147\r
148 @param[in] Id String ID to get the string from.\r
149\r
150 @retval CHAR16 * String from ID.\r
151 @retval NULL If error occurs.\r
152\r
153**/\r
154CHAR16 *\r
155GetStringById (\r
156 IN EFI_STRING_ID Id\r
157 );\r
158\r
159/**\r
160 Add a new user profile into the user profile database.\r
161\r
162**/\r
163VOID\r
164CallAddUser (\r
165 VOID\r
166 );\r
167\r
168/**\r
169 Display user select form; can select a user to modify.\r
170\r
171**/\r
172VOID\r
173SelectUserToModify (\r
174 VOID\r
175 );\r
176\r
177/**\r
178 Display user select form, cab select a user to delete.\r
179\r
180**/\r
181VOID\r
182SelectUserToDelete (\r
183 VOID\r
184 );\r
185\r
186/**\r
187 Delete the user specified by UserIndex in user profile database.\r
188\r
189 @param[in] UserIndex The index of user in the user name list to be deleted.\r
190\r
191**/\r
192VOID\r
193DeleteUser (\r
194 IN UINT8 UserIndex\r
195 );\r
196\r
197/**\r
198 Add a username item in form.\r
199\r
200 @param[in] User Points to the user profile whose username is added. \r
201 @param[in] Index The index of the user in the user name list.\r
202 @param[in] OpCodeHandle Points to container for dynamic created opcodes.\r
203\r
204**/\r
205VOID\r
206AddUserToForm (\r
207 IN EFI_USER_PROFILE_HANDLE User,\r
208 IN UINT16 Index,\r
209 IN VOID *OpCodeHandle\r
210 );\r
211\r
212/**\r
213 Display modify user information form\r
214\r
215 In this form, username, create Date, usage date, usage count, identity policy,\r
216 and access policy are displayed.\r
217\r
218 @param[in] UserIndex The index of the user in display list to modify.\r
219 \r
220**/\r
221VOID\r
222ModifyUserInfo (\r
223 IN UINT8 UserIndex\r
224 );\r
225\r
226/**\r
227 Get the username from user input and update username string in Hii \r
228 database with it.\r
229\r
230**/\r
231VOID\r
232ModifyUserName (\r
233 VOID\r
234 );\r
235\r
236/**\r
237 Display the form of modifying user identity policy.\r
238\r
239**/\r
240VOID\r
241ModifyIdentityPolicy (\r
242 VOID\r
243 );\r
244\r
245/**\r
246 Update the mUserInfo.NewIdentityPolicy and UI when 'add option' is pressed.\r
247\r
248**/\r
249VOID\r
250AddIdentityPolicyItem (\r
251 VOID\r
252 );\r
253\r
254/**\r
255 Save the identity policy and update UI with it.\r
256 \r
257 This funciton will verify the new identity policy, in current implementation, \r
258 the identity policy can be: T, P & P & P & ..., P | P | P | ...\r
259 Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or".\r
260 Other identity policies are not supported. \r
261\r
262**/\r
263VOID\r
264SaveIdentityPolicy (\r
265 VOID\r
266 );\r
267\r
268/**\r
269 Display modify user access policy form\r
270\r
271 In this form, access right, access setu,p and access boot order are dynamically\r
272 added. Load devicepath and connect devicepath are displayed too.\r
273 \r
274**/\r
275VOID\r
276ModidyAccessPolicy (\r
277 VOID\r
278 );\r
279\r
280/**\r
281 Collect all the access policy data to mUserInfo.AccessPolicy, \r
282 and save it to user profile.\r
283\r
284**/\r
285VOID\r
286SaveAccessPolicy (\r
287 VOID\r
288 );\r
289\r
290/**\r
291 Get current user's access rights.\r
292\r
293 @param[out] AccessRight Points to the buffer used for user's access rights.\r
294\r
295 @retval EFI_SUCCESS Get current user access rights successfully.\r
296 @retval others Fail to get current user access rights.\r
297\r
298**/\r
299EFI_STATUS\r
300GetAccessRight (\r
301 OUT UINT32 *AccessRight\r
302 );\r
303\r
304/**\r
305 Display the permit load device path in the loadable device path list.\r
306\r
307**/\r
308VOID\r
309DisplayLoadPermit(\r
310 VOID\r
311 );\r
312\r
313/**\r
314 Display the forbid load device path list (mAccessInfo.LoadForbid).\r
315\r
316**/\r
317VOID\r
318DisplayLoadForbid (\r
319 VOID\r
320 );\r
321\r
322/**\r
323 Display the permit connect device path.\r
324\r
325**/\r
326VOID\r
327DisplayConnectPermit (\r
328 VOID\r
329 );\r
330\r
331/**\r
332 Display the forbid connect device path list.\r
333\r
334**/\r
335VOID\r
336DisplayConnectForbid (\r
337 VOID\r
338 );\r
339\r
340/**\r
341 Delete the specified device path by DriverIndex from the forbid device path \r
342 list (mAccessInfo.LoadForbid).\r
343\r
344 @param[in] DriverIndex The index of driver in a forbidden device path list.\r
345 \r
346**/\r
347VOID\r
348DeleteFromForbidLoad (\r
349 IN UINT16 DriverIndex\r
350 );\r
351 \r
352/**\r
353 Add the specified device path by DriverIndex to the forbid device path \r
354 list (mAccessInfo.LoadForbid).\r
355\r
356 @param[in] DriverIndex The index of driver saved in driver options.\r
357 \r
358**/\r
359VOID\r
360AddToForbidLoad (\r
361 IN UINT16 DriverIndex\r
362 );\r
363\r
364/**\r
365 Get user name from the popup windows.\r
366 \r
367 @param[in, out] UserNameLen On entry, point to the buffer lengh of UserName.\r
368 On exit, point to the input user name length.\r
369 @param[out] UserName The buffer to hold the input user name.\r
370 \r
371 @retval EFI_ABORTED It is given up by pressing 'ESC' key.\r
372 @retval EFI_NOT_READY Not a valid input at all.\r
373 @retval EFI_SUCCESS Get a user name successfully.\r
374\r
375**/\r
376EFI_STATUS\r
377GetUserNameInput (\r
378 IN OUT UINTN *UserNameLen,\r
379 OUT CHAR16 *UserName\r
380 );\r
381 \r
382#endif\r