]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h
SecurityPkg: Fix typos in comments
[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
863986b3 4Copyright (c) 2009 - 2013, 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
6f0b8648 24#include <Protocol/UserCredential2.h>\r
0c18794e 25#include <Protocol/UserManager.h>\r
26\r
27#include <Library/UefiRuntimeServicesTableLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/DevicePathLib.h>\r
32#include <Library/DebugLib.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/PrintLib.h>\r
35#include <Library/HiiLib.h>\r
36\r
37#include "UserProfileManagerData.h"\r
38\r
39#define USER_NAME_LENGTH 17\r
40\r
41//\r
42// Credential Provider Information.\r
43//\r
44typedef struct {\r
45 UINTN Count;\r
6f0b8648 46 EFI_USER_CREDENTIAL2_PROTOCOL *Provider[1];\r
0c18794e 47} CREDENTIAL_PROVIDER_INFO;\r
48\r
49//\r
50// User profile information structure.\r
51//\r
52typedef struct {\r
53 UINT64 UsageCount;\r
54 EFI_TIME CreateDate;\r
55 EFI_TIME UsageDate;\r
56 UINTN AccessPolicyLen;\r
57 UINTN IdentityPolicyLen;\r
58 UINTN NewIdentityPolicyLen; \r
59 UINT8 *AccessPolicy;\r
60 UINT8 *IdentityPolicy;\r
61 UINT8 *NewIdentityPolicy;\r
62 CHAR16 UserName[USER_NAME_LENGTH];\r
63 BOOLEAN CreateDateExist;\r
64 BOOLEAN UsageDateExist;\r
65 BOOLEAN AccessPolicyModified;\r
66 BOOLEAN IdentityPolicyModified;\r
67 BOOLEAN NewIdentityPolicyModified;\r
68} USER_INFO;\r
69\r
70//\r
71// User access information structure.\r
72//\r
73typedef struct {\r
74 UINTN LoadPermitLen;\r
75 UINTN LoadForbidLen;\r
76 UINTN ConnectPermitLen;\r
77 UINTN ConnectForbidLen;\r
78 UINT8 *LoadPermit;\r
79 UINT8 *LoadForbid;\r
80 UINT8 *ConnectPermit;\r
81 UINT8 *ConnectForbid;\r
82 UINT32 AccessBootOrder;\r
83 UINT8 AccessRight;\r
84 UINT8 AccessSetup;\r
85} USER_INFO_ACCESS;\r
86\r
87#define USER_PROFILE_MANAGER_SIGNATURE SIGNATURE_32 ('U', 'P', 'M', 'S')\r
88\r
89typedef struct {\r
90 UINTN Signature;\r
91 EFI_HANDLE DriverHandle;\r
92 EFI_HII_HANDLE HiiHandle;\r
93 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
94} USER_PROFILE_MANAGER_CALLBACK_INFO;\r
95\r
96//\r
97// HII specific Vendor Device Path definition.\r
98//\r
99typedef struct {\r
100 VENDOR_DEVICE_PATH VendorDevicePath;\r
101 EFI_DEVICE_PATH_PROTOCOL End;\r
102} HII_VENDOR_DEVICE_PATH;\r
103\r
104//\r
105// This is the generated IFR binary data for each formset defined in VFR.\r
106//\r
107extern UINT8 UserProfileManagerVfrBin[];\r
108\r
109//\r
110// This is the generated String package data for .UNI file.\r
111//\r
112extern UINT8 UserProfileManagerStrings[];\r
113\r
0c18794e 114//\r
115// The user manager protocol, used in several function.\r
116//\r
117extern EFI_USER_MANAGER_PROTOCOL *mUserManager;\r
118\r
119//\r
120// The credential providers database in system.\r
121//\r
122extern CREDENTIAL_PROVIDER_INFO *mProviderInfo;\r
123\r
124//\r
125// The variables used to update identity policy.\r
126//\r
127extern UINT8 mProviderChoice;\r
128extern UINT8 mConncetLogical;\r
129\r
130//\r
131// The variables used to update access policy.\r
132//\r
133extern USER_INFO_ACCESS mAccessInfo;\r
134\r
135//\r
136// The user information used to record all data in UI.\r
137//\r
138extern USER_INFO mUserInfo;\r
139\r
140extern USER_PROFILE_MANAGER_CALLBACK_INFO *mCallbackInfo;\r
141\r
0c5b25f0 142extern EFI_USER_PROFILE_HANDLE mModifyUser;\r
0c18794e 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
c0cb1e1a 257 This function will verify the new identity policy, in current implementation, \r
0c18794e 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
0c5b25f0 381\r
382/**\r
383 Find the specified info in User profile by the InfoType.\r
384\r
385 @param[in] User Handle of the user whose information will be searched.\r
386 @param[in] InfoType The user information type to find.\r
387 @param[out] UserInfo Points to user information handle found.\r
388 \r
389 @retval EFI_SUCCESS Find the user information successfully.\r
390 @retval Others Fail to find the user information.\r
391\r
392**/\r
393EFI_STATUS\r
394FindInfoByType (\r
395 IN EFI_USER_PROFILE_HANDLE User,\r
396 IN UINT8 InfoType,\r
397 OUT EFI_USER_INFO_HANDLE *UserInfo\r
398 );\r
399\r
400/**\r
401 Convert the identity policy to a unicode string and update the Hii database\r
402 IpStringId string with it.\r
403\r
404 @param[in] Ip Points to identity policy.\r
405 @param[in] IpLen The identity policy length.\r
406 @param[in] IpStringId String ID in the HII database to be replaced.\r
407\r
408**/\r
409VOID\r
410ResolveIdentityPolicy (\r
411 IN UINT8 *Ip,\r
412 IN UINTN IpLen,\r
413 IN EFI_STRING_ID IpStringId\r
414 );\r
415\r
416/**\r
417 Expand access policy memory size.\r
418\r
419 @param[in] ValidLen The valid access policy length.\r
420 @param[in] ExpandLen The length that is needed to expand.\r
421 \r
422**/\r
423VOID\r
424ExpandMemory (\r
425 IN UINTN ValidLen,\r
426 IN UINTN ExpandLen\r
427 );\r
428\r
429/**\r
430 Delete User's credental from all the providers that exist in User's identity policy.\r
431 \r
432 @param[in] IdentityPolicy Point to User's identity policy.\r
433 @param[in] IdentityPolicyLen The length of the identity policy.\r
434 @param[in] User Points to user profile.\r
435\r
436**/\r
437VOID\r
438DeleteCredentialFromProviders (\r
439 IN UINT8 *IdentityPolicy,\r
440 IN UINTN IdentityPolicyLen,\r
441 IN EFI_USER_PROFILE_HANDLE User \r
442 );\r
0c18794e 443 \r
444#endif\r