]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/UserIdentification/UserIdentifyManagerDxe/UserIdentifyManager.h
Update UID drivers to align with latest UEFI spec 2.3.1 errata A.
[mirror_edk2.git] / SecurityPkg / UserIdentification / UserIdentifyManagerDxe / UserIdentifyManager.h
CommitLineData
0c18794e 1/** @file\r
2 The header file for User identify Manager driver.\r
3 \r
4Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
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 _USER_IDENTIFY_MANAGER_H_\r
16#define _USER_IDENTIFY_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/FormBrowser2.h>\r
24#include <Protocol/HiiDatabase.h>\r
25#include <Protocol/HiiConfigAccess.h>\r
26#include <Protocol/HiiString.h>\r
27#include <Protocol/HiiConfigRouting.h>\r
28#include <Protocol/UserCredential.h>\r
29#include <Protocol/UserManager.h>\r
30#include <Protocol/DeferredImageLoad.h>\r
31#include <Protocol/SimpleTextOut.h>\r
32#include <Protocol/SimpleTextIn.h>\r
33#include <Protocol/SimpleTextInEx.h>\r
34\r
35#include <Library/UefiRuntimeServicesTableLib.h>\r
36#include <Library/UefiBootServicesTableLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/BaseMemoryLib.h>\r
39#include <Library/DevicePathLib.h>\r
40#include <Library/DebugLib.h>\r
41#include <Library/UefiLib.h>\r
42#include <Library/PrintLib.h>\r
43#include <Library/HiiLib.h>\r
44\r
45#include "UserIdentifyManagerData.h"\r
46\r
47//\r
48// This is the generated IFR binary data for each formset defined in VFR.\r
49// This data array is ready to be used as input of HiiAddPackages() to\r
50// create a packagelist.\r
51//\r
52extern UINT8 UserIdentifyManagerVfrBin[];\r
53\r
54//\r
55// This is the generated String package data for all .UNI files.\r
56// This data array is ready to be used as input of HiiAddPackages() to\r
57// create a packagelist.\r
58//\r
59extern UINT8 UserIdentifyManagerStrings[];\r
60\r
61#define USER_NUMBER_INC 32\r
62#define DEFAULT_PROFILE_SIZE 512\r
63#define INFO_PAYLOAD_SIZE 64\r
64\r
65//\r
66// Credential Provider Information.\r
67//\r
68typedef struct {\r
69 UINTN Count;\r
70 EFI_USER_CREDENTIAL_PROTOCOL *Provider[1];\r
71} CREDENTIAL_PROVIDER_INFO;\r
72\r
73//\r
74// Internal user profile entry.\r
75//\r
76typedef struct {\r
77 UINTN MaxProfileSize;\r
78 UINTN UserProfileSize;\r
79 CHAR16 UserVarName[9];\r
80 UINT8 *ProfileInfo;\r
81} USER_PROFILE_ENTRY;\r
82\r
83//\r
84// Internal user profile database.\r
85//\r
86typedef struct {\r
87 UINTN UserProfileNum;\r
88 UINTN MaxProfileNum;\r
89 EFI_USER_PROFILE_HANDLE UserProfile[1];\r
90} USER_PROFILE_DB;\r
91\r
92#define USER_MANAGER_SIGNATURE SIGNATURE_32 ('U', 'I', 'M', 'S')\r
93\r
94typedef struct {\r
95 UINTN Signature;\r
96 EFI_HANDLE DriverHandle;\r
97 EFI_HII_HANDLE HiiHandle;\r
98\r
99 //\r
100 // Consumed protocol.\r
101 //\r
102 EFI_HII_DATABASE_PROTOCOL *HiiDatabase;\r
103 EFI_HII_STRING_PROTOCOL *HiiString;\r
104 EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;\r
105 EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
106\r
107 //\r
108 // Produced protocol.\r
109 //\r
110 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
111} USER_MANAGER_CALLBACK_INFO;\r
112\r
113///\r
114/// HII specific Vendor Device Path definition.\r
115///\r
116typedef struct {\r
117 VENDOR_DEVICE_PATH VendorDevicePath;\r
118 EFI_DEVICE_PATH_PROTOCOL End;\r
119} HII_VENDOR_DEVICE_PATH;\r
120\r
121/**\r
122 Register an event notification function for the user profile changed.\r
123\r
124 @param[in] ImageHandle Image handle this driver.\r
125\r
126**/\r
127VOID\r
128LoadDeferredImageInit (\r
129 IN EFI_HANDLE ImageHandle\r
130 );\r
131\r
132\r
133/**\r
134 This function creates a new user profile with only\r
135 a new user identifier attached and returns its handle.\r
136 The user profile is non-volatile, but the handle User\r
137 can change across reboots.\r
138\r
139 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
140 pointer.\r
141 @param[out] User Handle of a new user profile.\r
142\r
143 @retval EFI_SUCCESS User profile was successfully created.\r
144 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions\r
145 to create a user profile.\r
146 @retval EFI_UNSUPPORTED Creation of new user profiles is not supported.\r
147 @retval EFI_INVALID_PARAMETER User is NULL.\r
148\r
149**/\r
150EFI_STATUS\r
151EFIAPI\r
152UserProfileCreate (\r
153 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
154 OUT EFI_USER_PROFILE_HANDLE *User\r
155 );\r
156\r
157\r
158/**\r
159 Delete an existing user profile.\r
160\r
161 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
162 pointer.\r
163 @param User User profile handle.\r
164\r
165 @retval EFI_SUCCESS User profile was successfully deleted.\r
166 @retval EFI_ACCESS_DENIED Current user does not have sufficient permissions\r
167 to delete a user profile or there is only one\r
168 user profile.\r
169 @retval EFI_UNSUPPORTED Deletion of new user profiles is not supported.\r
170 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile.\r
171\r
172**/\r
173EFI_STATUS\r
174EFIAPI\r
175UserProfileDelete (\r
176 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
177 IN EFI_USER_PROFILE_HANDLE User\r
178 );\r
179\r
180\r
181/**\r
182 Get next user profile from the user profile database.\r
183\r
184 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
185 pointer.\r
186 @param[in, out] User User profile handle.\r
187\r
188 @retval EFI_SUCCESS Next enrolled user profile successfully returned.\r
189 @retval EFI_INVALID_PARAMETER User is NULL.\r
190\r
191**/\r
192EFI_STATUS\r
193EFIAPI\r
194UserProfileGetNext (\r
195 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
196 IN OUT EFI_USER_PROFILE_HANDLE *User\r
197 );\r
198\r
199\r
200/**\r
201 This function returns the current user profile handle.\r
202\r
203 @param[in] This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.\r
204 @param[out] CurrentUser User profile handle.\r
205\r
206 @retval EFI_SUCCESS Current user profile handle returned successfully.\r
207 @retval EFI_INVALID_PARAMETER CurrentUser is NULL.\r
208\r
209**/\r
210EFI_STATUS\r
211EFIAPI\r
212UserProfileCurrent (\r
213 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
214 OUT EFI_USER_PROFILE_HANDLE *CurrentUser\r
215 );\r
216\r
217\r
218/**\r
219 Identify the user and, if authenticated, returns the user handle and changes\r
220 the current user profile.\r
221\r
222 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.\r
223 @param CurrentUser User profile handle.\r
224\r
225 @retval EFI_SUCCESS User was successfully identified.\r
226 @retval EFI_INVALID_PARAMETER User is NULL.\r
227 @retval EFI_ACCESS_DENIED User was not successfully identified.\r
228\r
229**/\r
230EFI_STATUS\r
231EFIAPI\r
232UserProfileIdentify (\r
233 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
234 OUT EFI_USER_PROFILE_HANDLE *User\r
235 );\r
236\r
237\r
238/**\r
239 Find a user using a user information record.\r
240\r
241 This function searches all user profiles for the specified user information record.\r
242 The search starts with the user information record handle following UserInfo and \r
243 continues until either the information is found or there are no more user profiles.\r
244 A match occurs when the Info.InfoType field matches the user information record\r
245 type and the user information record data matches the portion of Info passed the \r
246 EFI_USER_INFO header.\r
247\r
248 @param[in] This Points to this instance of the EFI_USER_MANAGER_PROTOCOL.\r
249 @param[in, out] User On entry, points to the previously returned user profile \r
250 handle, or NULL to start searching with the first user profile.\r
251 On return, points to the user profile handle, or NULL if not\r
252 found.\r
253 @param[in, out] UserInfo On entry, points to the previously returned user information\r
254 handle, or NULL to start searching with the first. On return, \r
255 points to the user information handle of the user information\r
256 record, or NULL if not found. Can be NULL, in which case only \r
257 one user information record per user can be returned. \r
258 @param[in] Info Points to the buffer containing the user information to be \r
259 compared to the user information record. If NULL, then only \r
260 the user information record type is compared. If InfoSize is 0, \r
261 then the user information record must be empty.\r
262\r
263 @param[in] InfoSize The size of Info, in bytes. \r
264\r
265 @retval EFI_SUCCESS User information was found. User points to the user profile handle,\r
266 and UserInfo points to the user information handle.\r
267 @retval EFI_NOT_FOUND User information was not found. User points to NULL and UserInfo \r
268 points to NULL.\r
269 \r
270**/\r
271EFI_STATUS\r
272EFIAPI\r
273UserProfileFind (\r
274 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
275 IN OUT EFI_USER_PROFILE_HANDLE *User,\r
276 IN OUT EFI_USER_INFO_HANDLE *UserInfo OPTIONAL,\r
277 IN CONST EFI_USER_INFO *Info,\r
278 IN UINTN InfoSize\r
279 );\r
280\r
281\r
282/**\r
283 This function returns user information.\r
284\r
285 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
286 pointer.\r
287 @param User Handle of the user whose profile will be\r
288 retrieved.\r
289 @param UserInfo Handle of the user information data record.\r
290 @param Info On entry, points to a buffer of at least\r
291 *InfoSize bytes. On exit, holds the user\r
292 information.\r
293 @param InfoSize On entry, points to the size of Info. On return,\r
294 points to the size of the user information.\r
295\r
296 @retval EFI_SUCCESS Information returned successfully.\r
297 @retval EFI_ACCESS_DENIED The information about the specified user cannot\r
298 be accessed by the current user.\r
299 EFI_BUFFER_TOO_SMALL- The number of bytes\r
300 specified by *InfoSize is too small to hold the\r
301 returned data.\r
302\r
303**/\r
304EFI_STATUS\r
305EFIAPI\r
306UserProfileGetInfo (\r
307 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
308 IN EFI_USER_PROFILE_HANDLE User,\r
309 IN EFI_USER_INFO_HANDLE UserInfo,\r
310 OUT EFI_USER_INFO *Info,\r
311 IN OUT UINTN *InfoSize\r
312 );\r
313\r
314\r
315/**\r
316 This function changes user information.\r
317\r
318 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
319 pointer.\r
320 @param User Handle of the user whose profile will be\r
321 retrieved.\r
322 @param UserInfo Handle of the user information data record.\r
323 @param Info Points to the user information.\r
324 @param InfoSize The size of Info, in bytes.\r
325\r
326 @retval EFI_SUCCESS User profile information was successfully\r
327 changed/added.\r
328 @retval EFI_ACCESS_DENIED The record is exclusive.\r
329 @retval EFI_SECURITY_VIOLATION The current user does not have permission to\r
330 change the specified user profile or user\r
331 information record.\r
332\r
333**/\r
334EFI_STATUS\r
335EFIAPI\r
336UserProfileSetInfo (\r
337 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
338 IN EFI_USER_PROFILE_HANDLE User,\r
339 IN OUT EFI_USER_INFO_HANDLE *UserInfo,\r
340 IN CONST EFI_USER_INFO *Info,\r
341 IN UINTN InfoSize\r
342 );\r
343\r
344\r
345/**\r
346 This function allows the credential provider to notify the User Identity Manager\r
347 when user status has changed while deselected.\r
348\r
349 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance\r
350 pointer.\r
351 @param Changed Points to the instance of the\r
352 EFI_USER_CREDENTIAL_PROTOCOL where the user has\r
353 changed.\r
354\r
355 @retval EFI_SUCCESS The User Identity Manager has handled the\r
356 notification.\r
357 @retval EFI_NOT_READY The function was called while the specified\r
358 credential provider was not selected.\r
359 @retval EFI_UNSUPPORTED The User Identity Manager doesn't support\r
360 asynchronous notifications.\r
361\r
362**/\r
363EFI_STATUS\r
364EFIAPI\r
365UserProfileNotify (\r
366 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
367 IN EFI_HANDLE Changed\r
368 );\r
369\r
370\r
371/**\r
372 Delete the user information attached to the user profile specified by the UserInfo.\r
373\r
374 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.\r
375 @param User Handle of the user whose profile will be retrieved.\r
376 @param UserInfo Handle of the user information data record.\r
377\r
378 @retval EFI_SUCCESS User information deleted successfully.\r
379 @retval EFI_ACCESS_DENIED The current user does not have permission to\r
380 delete this user in-formation.\r
381 @retval EFI_NOT_FOUND User information record UserInfo does not exist\r
382 in the user pro-file.\r
383\r
384**/\r
385EFI_STATUS\r
386EFIAPI\r
387UserProfileDeleteInfo (\r
388 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
389 IN EFI_USER_PROFILE_HANDLE User,\r
390 IN EFI_USER_INFO_HANDLE UserInfo\r
391 );\r
392\r
393\r
394/**\r
395 This function returns the next user information record.\r
396\r
397 @param This Protocol EFI_USER_MANAGER_PROTOCOL instance pointer.\r
398 @param User Handle of the user whose profile will be retrieved.\r
399 @param UserInfo Handle of the user information data record.\r
400\r
401 @retval EFI_SUCCESS User information returned.\r
402 @retval EFI_NOT_FOUND No more user information found.\r
403\r
404**/\r
405EFI_STATUS\r
406EFIAPI\r
407UserProfileGetNextInfo (\r
408 IN CONST EFI_USER_MANAGER_PROTOCOL *This,\r
409 IN EFI_USER_PROFILE_HANDLE User,\r
410 IN OUT EFI_USER_INFO_HANDLE *UserInfo\r
411 );\r
412 \r
413#endif\r