1 /** @file
2   UEFI User Manager Protocol definition.
3 
4   This protocol manages user profiles.
5 
6   Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
7   This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef __USER_MANAGER_H__
18 #define __USER_MANAGER_H__
19 
20 ///
21 /// Global ID for the User Manager Protocol
22 ///
23 #define EFI_USER_MANAGER_PROTOCOL_GUID \
24   { \
25     0x6fd5b00c, 0xd426, 0x4283, { 0x98, 0x87, 0x6c, 0xf5, 0xcf, 0x1c, 0xb1, 0xfe } \
26   }
27 
28 #define EFI_EVENT_GROUP_USER_PROFILE_CHANGED \
29   { \
30     0xbaf1e6de, 0x209e, 0x4adb, { 0x8d, 0x96, 0xfd, 0x8b, 0x71, 0xf3, 0xf6, 0x83 } \
31   }
32 
33 typedef VOID *EFI_USER_PROFILE_HANDLE;
34 typedef VOID *EFI_USER_INFO_HANDLE;
35 
36 ///
37 /// The attributes of the user profile information.
38 ///
39 typedef UINT16 EFI_USER_INFO_ATTRIBS;
40 #define EFI_USER_INFO_STORAGE                   0x000F
41 #define EFI_USER_INFO_STORAGE_VOLATILE          0x0000
42 #define EFI_USER_INFO_STORAGE_CREDENTIAL_NV     0x0001
43 #define EFI_USER_INFO_STORAGE_PLATFORM_NV       0x0002
44 
45 #define EFI_USER_INFO_ACCESS                    0x0070
46 #define EFI_USER_INFO_PUBLIC                    0x0010
47 #define EFI_USER_INFO_PRIVATE                   0x0020
48 #define EFI_USER_INFO_PROTECTED                 0x0030
49 #define EFI_USER_INFO_EXCLUSIVE                 0x0080
50 
51 ///
52 /// User information structure
53 ///
54 typedef struct {
55   ///
56   /// The user credential identifier associated with this user information or else Nil if the
57   /// information is not associated with any specific credential.
58   ///
59   EFI_GUID               Credential;
60   ///
61   /// The type of user information.
62   ///
63   UINT8                  InfoType;
64   ///
65   /// Must be set to 0.
66   ///
67   UINT8                  Reserved1;
68   ///
69   /// The attributes of the user profile information.
70   ///
71   EFI_USER_INFO_ATTRIBS  InfoAttribs;
72   ///
73   /// The size of the user information, in bytes, including this header.
74   ///
75   UINT32                 InfoSize;
76 } EFI_USER_INFO;
77 
78 ///
79 /// User credential class GUIDs
80 ///
81 #define EFI_USER_CREDENTIAL_CLASS_UNKNOWN \
82   { 0x5cf32e68, 0x7660, 0x449b, { 0x80, 0xe6, 0x7e, 0xa3, 0x6e, 0x3, 0xf6, 0xa8 } }
83 #define EFI_USER_CREDENTIAL_CLASS_PASSWORD \
84   { 0xf8e5058c, 0xccb6, 0x4714, { 0xb2, 0x20, 0x3f, 0x7e, 0x3a, 0x64, 0xb, 0xd1 } }
85 #define EFI_USER_CREDENTIAL_CLASS_SMART_CARD \
86   { 0x5f03ba33, 0x8c6b, 0x4c24, { 0xaa, 0x2e, 0x14, 0xa2, 0x65, 0x7b, 0xd4, 0x54 } }
87 #define EFI_USER_CREDENTIAL_CLASS_FINGERPRINT \
88   { 0x32cba21f, 0xf308, 0x4cbc, { 0x9a, 0xb5, 0xf5, 0xa3, 0x69, 0x9f, 0x4, 0x4a } }
89 #define EFI_USER_CREDENTIAL_CLASS_HANDPRINT \
90   { 0x5917ef16, 0xf723, 0x4bb9, { 0xa6, 0x4b, 0xd8, 0xc5, 0x32, 0xf4, 0xd8, 0xb5 } }
91 #define EFI_USER_CREDENTIAL_CLASS_SECURE_CARD \
92   { 0x8a6b4a83, 0x42fe, 0x45d2, { 0xa2, 0xef, 0x46, 0xf0, 0x6c, 0x7d, 0x98, 0x52 } }
93 
94 typedef UINT64   EFI_CREDENTIAL_CAPABILITIES;
95 #define EFI_CREDENTIAL_CAPABILITIES_ENROLL  0x0000000000000001
96 
97 ///
98 /// Credential logon flags
99 ///
100 typedef UINT32 EFI_CREDENTIAL_LOGON_FLAGS;
101 #define EFI_CREDENTIAL_LOGON_FLAG_AUTO                0x00000001
102 #define EFI_CREDENTIAL_LOGON_FLAG_DEFAULT             0x00000002
103 
104 ///
105 /// User information record types
106 ///
107 
108 ///
109 /// No information.
110 ///
111 #define EFI_USER_INFO_EMPTY_RECORD                    0x00
112 ///
113 /// Provide the user's name for the enrolled user.
114 ///
115 #define EFI_USER_INFO_NAME_RECORD                     0x01
116 typedef CHAR16 *EFI_USER_INFO_NAME;
117 ///
118 /// Provides the date and time when the user profile was created.
119 ///
120 #define EFI_USER_INFO_CREATE_DATE_RECORD              0x02
121 typedef EFI_TIME EFI_USER_INFO_CREATE_DATE;
122 ///
123 /// Provides the date and time when the user profile was selected.
124 ///
125 #define EFI_USER_INFO_USAGE_DATE_RECORD               0x03
126 typedef EFI_TIME EFI_USER_INFO_USAGE_DATE;
127 ///
128 /// Provides the number of times that the user profile has been selected.
129 ///
130 #define EFI_USER_INFO_USAGE_COUNT_RECORD              0x04
131 typedef UINT64 EFI_USER_INFO_USAGE_COUNT;
132 ///
133 /// Provides a unique non-volatile user identifier for each enrolled user.
134 ///
135 #define EFI_USER_INFO_IDENTIFIER_RECORD               0x05
136 typedef UINT8 EFI_USER_INFO_IDENTIFIER[16];
137 ///
138 /// Specifies the type of a particular credential associated with the user profile.
139 ///
140 #define EFI_USER_INFO_CREDENTIAL_TYPE_RECORD          0x06
141 typedef EFI_GUID EFI_USER_INFO_CREDENTIAL_TYPE;
142 ///
143 /// Specifies the user-readable name of a particular credential type.
144 ///
145 #define EFI_USER_INFO_CREDENTIAL_TYPE_NAME_RECORD     0x07
146 typedef CHAR16 *EFI_USER_INFO_CREDENTIAL_TYPE_NAME;
147 ///
148 /// Specifies the credential provider.
149 ///
150 #define EFI_USER_INFO_CREDENTIAL_PROVIDER_RECORD      0x08
151 typedef EFI_GUID EFI_USER_INFO_CREDENTIAL_PROVIDER;
152 ///
153 /// Specifies the user-readable name of a particular credential's provider.
154 ///
155 #define EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME_RECORD 0x09
156 typedef CHAR16 *EFI_USER_INFO_CREDENTIAL_PROVIDER_NAME;
157 ///
158 /// Provides PKCS#11 credential information from a smart card.
159 ///
160 #define EFI_USER_INFO_PKCS11_RECORD                   0x0A
161 ///
162 /// Provides standard biometric information in the format specified by the ISO 19785 (Common
163 /// Biometric Exchange Formats Framework) specification.
164 ///
165 #define EFI_USER_INFO_CBEFF_RECORD                    0x0B
166 typedef VOID *EFI_USER_INFO_CBEFF;
167 ///
168 /// Indicates how close of a match the fingerprint must be in order to be considered a match.
169 ///
170 #define EFI_USER_INFO_FAR_RECORD                      0x0C
171 typedef UINT8 EFI_USER_INFO_FAR;
172 ///
173 /// Indicates how many attempts the user has to with a particular credential before the system prevents
174 /// further attempts.
175 ///
176 #define EFI_USER_INFO_RETRY_RECORD                    0x0D
177 typedef UINT8 EFI_USER_INFO_RETRY;
178 ///
179 /// Provides the user's pre-OS access rights.
180 ///
181 #define EFI_USER_INFO_ACCESS_POLICY_RECORD            0x0E
182 
183 typedef struct {
184   UINT32  Type;  ///< Specifies the type of user access control.
185   UINT32  Size;  ///< Specifies the size of the user access control record, in bytes, including this header.
186 } EFI_USER_INFO_ACCESS_CONTROL;
187 
188 typedef EFI_USER_INFO_ACCESS_CONTROL EFI_USER_INFO_ACCESS_POLICY;
189 
190 ///
191 /// User Information access types
192 ///
193 
194 ///
195 /// Forbids the user from booting or loading executables from the specified device path or any child
196 /// device paths.
197 ///
198 #define EFI_USER_INFO_ACCESS_FORBID_LOAD              0x00000001
199 ///
200 /// Permits the user from booting or loading executables from the specified device path or any child
201 /// device paths.
202 /// Note: in-consistency between code and the UEFI 2.3 specification here.
203 /// The definition EFI_USER_INFO_ACCESS_PERMIT_BOOT in the specification should be typo and wait for
204 /// spec update.
205 ///
206 #define EFI_USER_INFO_ACCESS_PERMIT_LOAD              0x00000002
207 ///
208 /// Presence of this record indicates that a user can update enrollment information.
209 ///
210 #define EFI_USER_INFO_ACCESS_ENROLL_SELF              0x00000003
211 ///
212 /// Presence of this record indicates that a user can enroll new users.
213 ///
214 #define EFI_USER_INFO_ACCESS_ENROLL_OTHERS            0x00000004
215 ///
216 /// Presence of this record indicates that a user can update the user information of any user.
217 ///
218 #define EFI_USER_INFO_ACCESS_MANAGE                   0x00000005
219 ///
220 /// Describes permissions usable when configuring the platform.
221 ///
222 #define EFI_USER_INFO_ACCESS_SETUP                    0x00000006
223 ///
224 /// Standard GUIDs for access to configure the platform.
225 ///
226 #define EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID \
227   { 0x85b75607, 0xf7ce, 0x471e, { 0xb7, 0xe4, 0x2a, 0xea, 0x5f, 0x72, 0x32, 0xee } }
228 #define EFI_USER_INFO_ACCESS_SETUP_NORMAL_GUID \
229   { 0x1db29ae0, 0x9dcb, 0x43bc, { 0x8d, 0x87, 0x5d, 0xa1, 0x49, 0x64, 0xdd, 0xe2 } }
230 #define EFI_USER_INFO_ACCESS_SETUP_RESTRICTED_GUID \
231   { 0xbdb38125, 0x4d63, 0x49f4, { 0x82, 0x12, 0x61, 0xcf, 0x5a, 0x19, 0xa, 0xf8 } }
232 
233 ///
234 /// Forbids UEFI drivers from being started from the specified device path(s) or any child device paths.
235 ///
236 #define EFI_USER_INFO_ACCESS_FORBID_CONNECT           0x00000007
237 ///
238 /// Permits UEFI drivers to be started on the specified device path(s) or any child device paths.
239 ///
240 #define EFI_USER_INFO_ACCESS_PERMIT_CONNECT           0x00000008
241 ///
242 /// Modifies the boot order.
243 ///
244 #define EFI_USER_INFO_ACCESS_BOOT_ORDER               0x00000009
245 typedef UINT32 EFI_USER_INFO_ACCESS_BOOT_ORDER_HDR;
246 
247 #define EFI_USER_INFO_ACCESS_BOOT_ORDER_MASK          0x0000000F
248 ///
249 /// Insert new boot options at the beginning of the boot order.
250 ///
251 #define EFI_USER_INFO_ACCESS_BOOT_ORDER_INSERT        0x00000000
252 ///
253 /// Append new boot options to the end of the boot order.
254 ///
255 #define EFI_USER_INFO_ACCESS_BOOT_ORDER_APPEND        0x00000001
256 ///
257 /// Replace the entire boot order.
258 ///
259 #define EFI_USER_INFO_ACCESS_BOOT_ORDER_REPLACE       0x00000002
260 ///
261 /// The Boot Manager will not attempt find a default boot device
262 /// when the default boot order is does not lead to a bootable device.
263 ///
264 #define EFI_USER_INFO_ACCESS_BOOT_ORDER_NODEFAULT     0x00000010
265 
266 ///
267 /// Provides the expression which determines which credentials are required to assert user identity.
268 ///
269 #define EFI_USER_INFO_IDENTITY_POLICY_RECORD          0x0F
270 
271 typedef struct {
272   UINT32  Type;    ///< Specifies either an operator or a data item.
273   UINT32  Length;  ///< The length of this block, in bytes, including this header.
274 } EFI_USER_INFO_IDENTITY_POLICY;
275 
276 ///
277 /// User identity policy expression operators.
278 ///
279 #define EFI_USER_INFO_IDENTITY_FALSE                  0x00
280 #define EFI_USER_INFO_IDENTITY_TRUE                   0x01
281 #define EFI_USER_INFO_IDENTITY_CREDENTIAL_TYPE        0x02
282 #define EFI_USER_INFO_IDENTITY_CREDENTIAL_PROVIDER    0x03
283 #define EFI_USER_INFO_IDENTITY_NOT                    0x10
284 #define EFI_USER_INFO_IDENTITY_AND                    0x11
285 #define EFI_USER_INFO_IDENTITY_OR                     0x12
286 
287 ///
288 /// Provides placeholder for additional user profile information identified by a GUID.
289 ///
290 #define EFI_USER_INFO_GUID_RECORD                     0xFF
291 typedef EFI_GUID EFI_USER_INFO_GUID;
292 
293 ///
294 /// User information table
295 /// A collection of EFI_USER_INFO records, prefixed with this header.
296 ///
297 typedef struct {
298   UINT64   Size;  ///< Total size of the user information table, in bytes.
299 } EFI_USER_INFO_TABLE;
300 
301 typedef struct _EFI_USER_MANAGER_PROTOCOL  EFI_USER_MANAGER_PROTOCOL;
302 
303 /**
304   Create a new user profile.
305 
306   This function creates a new user profile with only a new user identifier attached and returns its
307   handle. The user profile is non-volatile, but the handle User can change across reboots.
308 
309   @param[in]  This               Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
310   @param[out] User               On return, points to the new user profile handle.
311                                  The user profile handle is unique only during this boot.
312 
313   @retval EFI_SUCCESS            User profile was successfully created.
314   @retval EFI_ACCESS_DENIED      Current user does not have sufficient permissions to create a user profile.
315   @retval EFI_UNSUPPORTED        Creation of new user profiles is not supported.
316   @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
317 **/
318 typedef
319 EFI_STATUS
320 (EFIAPI *EFI_USER_PROFILE_CREATE)(
321   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
322   OUT      EFI_USER_PROFILE_HANDLE    *User
323   );
324 
325 /**
326   Delete an existing user profile.
327 
328   @param[in] This                Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
329   @param[in] User                User profile handle.
330 
331   @retval EFI_SUCCESS            User profile was successfully deleted.
332   @retval EFI_ACCESS_DENIED      Current user does not have sufficient permissions to delete a user
333                                  profile or there is only one user profile.
334   @retval EFI_UNSUPPORTED        Deletion of new user profiles is not supported.
335   @retval EFI_INVALID_PARAMETER  User does not refer to a valid user profile.
336 **/
337 typedef
338 EFI_STATUS
339 (EFIAPI *EFI_USER_PROFILE_DELETE)(
340   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
341   IN       EFI_USER_PROFILE_HANDLE    User
342   );
343 
344 /**
345   Enumerate all of the enrolled users on the platform.
346 
347   This function returns the next enrolled user profile. To retrieve the first user profile handle, point
348   User at a NULL. Each subsequent call will retrieve another user profile handle until there are no
349   more, at which point User will point to NULL.
350 
351   @param[in]     This            Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
352   @param[in,out] User            On entry, points to the previous user profile handle or NULL to
353                                  start enumeration. On exit, points to the next user profile handle
354                                  or NULL if there are no more user profiles.
355 
356   @retval EFI_SUCCESS            Next enrolled user profile successfully returned.
357   @retval EFI_ACCESS_DENIED      Next enrolled user profile was not successfully returned.
358   @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
359 **/
360 typedef
361 EFI_STATUS
362 (EFIAPI *EFI_USER_PROFILE_GET_NEXT)(
363   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
364   IN OUT   EFI_USER_PROFILE_HANDLE    *User
365   );
366 
367 /**
368   Return the current user profile handle.
369 
370   @param[in]  This               Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
371   @param[out] CurrentUser        On return, points to the current user profile handle.
372 
373   @retval EFI_SUCCESS            Current user profile handle returned successfully.
374   @retval EFI_INVALID_PARAMETER  The CurrentUser parameter is NULL.
375 **/
376 typedef
377 EFI_STATUS
378 (EFIAPI *EFI_USER_PROFILE_CURRENT)(
379   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
380   OUT      EFI_USER_PROFILE_HANDLE    *CurrentUser
381   );
382 
383 /**
384   Identify a user.
385 
386   Identify the user and, if authenticated, returns the user handle and changes the current user profile.
387   All user information marked as private in a previously selected profile is no longer available for
388   inspection.
389   Whenever the current user profile is changed then the an event with the GUID
390   EFI_EVENT_GROUP_USER_PROFILE_CHANGED is signaled.
391 
392   @param[in]  This               Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
393   @param[out] User               On return, points to the user profile handle for the current user profile.
394 
395   @retval EFI_SUCCESS            User was successfully identified.
396   @retval EFI_ACCESS_DENIED      User was not successfully identified.
397   @retval EFI_INVALID_PARAMETER  The User parameter is NULL.
398 **/
399 typedef
400 EFI_STATUS
401 (EFIAPI *EFI_USER_PROFILE_IDENTIFY)(
402   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
403   OUT      EFI_USER_PROFILE_HANDLE    *User
404   );
405 
406 /**
407   Find a user using a user information record.
408 
409   This function searches all user profiles for the specified user information record. The search starts
410   with the user information record handle following UserInfo and continues until either the
411   information is found or there are no more user profiles.
412   A match occurs when the Info.InfoType field matches the user information record type and the
413   user information record data matches the portion of Info.
414 
415   @param[in]     This      Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
416   @param[in,out] User      On entry, points to the previously returned user profile handle or NULL to start
417                            searching with the first user profile. On return, points to the user profile handle or
418                            NULL if not found.
419   @param[in,out] UserInfo  On entry, points to the previously returned user information handle or NULL to start
420                            searching with the first. On return, points to the user information handle of the user
421                            information record or NULL if not found. Can be NULL, in which case only one user
422                            information record per user can be returned.
423   @param[in]     Info      Points to the buffer containing the user information to be compared to the user
424                            information record. If the user information record data is empty, then only the user
425                            information record type is compared.
426                            If InfoSize is 0, then the user information record must be empty.
427 
428   @param[in]     InfoSize  The size of Info, in bytes.
429 
430   @retval EFI_SUCCESS           User information was found. User points to the user profile handle and UserInfo
431                                 points to the user information handle.
432   @retval EFI_NOT_FOUND         User information was not found. User points to NULL and UserInfo points to NULL.
433   @retval EFI_INVALID_PARAMETER User is NULL. Or Info is NULL.
434 **/
435 typedef
436 EFI_STATUS
437 (EFIAPI *EFI_USER_PROFILE_FIND)(
438   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
439   IN OUT   EFI_USER_PROFILE_HANDLE    *User,
440   IN OUT   EFI_USER_INFO_HANDLE       *UserInfo OPTIONAL,
441   IN CONST EFI_USER_INFO              *Info,
442   IN       UINTN                      InfoSize
443   );
444 
445 /**
446   Called by credential provider to notify of information change.
447 
448   This function allows the credential provider to notify the User Identity Manager when user status
449   has changed.
450   If the User Identity Manager doesn't support asynchronous changes in credentials, then this function
451   should return EFI_UNSUPPORTED.
452   If current user does not exist, and the credential provider can identify a user, then make the user
453   to be current user and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event.
454   If current user already exists, and the credential provider can identify another user, then switch
455   current user to the newly identified user, and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event.
456   If current user was identified by this credential provider and now the credential provider cannot identify
457   current user, then logout current user and signal the EFI_EVENT_GROUP_USER_PROFILE_CHANGED event.
458 
459   @param[in] This          Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
460   @param[in] Changed       Handle on which is installed an instance of the
461                            EFI_USER_CREDENTIAL_PROTOCOL where the user has changed.
462 
463   @retval EFI_SUCCESS      The User Identity Manager has handled the notification.
464   @retval EFI_NOT_READY    The function was called while the specified credential provider was not selected.
465   @retval EFI_UNSUPPORTED  The User Identity Manager doesn't support asynchronous notifications.
466 **/
467 typedef
468 EFI_STATUS
469 (EFIAPI *EFI_USER_PROFILE_NOTIFY)(
470   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
471   IN       EFI_HANDLE                 Changed
472   );
473 
474 /**
475   Return information attached to the user.
476 
477   This function returns user information. The format of the information is described in User
478   Information. The function may return EFI_ACCESS_DENIED if the information is marked private
479   and the handle specified by User is not the current user profile. The function may return
480   EFI_ACCESS_DENIED if the information is marked protected and the information is associated
481   with a credential provider for which the user has not been authenticated.
482 
483   @param[in]     This           Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
484   @param[in]     User           Handle of the user whose profile will be retrieved.
485   @param[in]     UserInfo       Handle of the user information data record.
486   @param[out]    Info           On entry, points to a buffer of at least *InfoSize bytes. On exit, holds the user
487                                 information. If the buffer is too small to hold the information, then
488                                 EFI_BUFFER_TOO_SMALL is returned and InfoSize is updated to contain the
489                                 number of bytes actually required.
490   @param[in,out] InfoSize       On entry, points to the size of Info. On return, points to the size of the user
491                                 information.
492 
493   @retval EFI_SUCCESS           Information returned successfully.
494   @retval EFI_ACCESS_DENIED     The information about the specified user cannot be accessed by the current user.
495   @retval EFI_BUFFER_TOO_SMALL  The number of bytes specified by *InfoSize is too small to hold
496                                 the returned data. The actual size required is returned in *InfoSize.
497   @retval EFI_NOT_FOUND         User does not refer to a valid user profile or UserInfo does not refer to a valid
498                                 user info handle.
499   @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL.
500 **/
501 typedef
502 EFI_STATUS
503 (EFIAPI *EFI_USER_PROFILE_GET_INFO)(
504   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
505   IN       EFI_USER_PROFILE_HANDLE    User,
506   IN       EFI_USER_INFO_HANDLE       UserInfo,
507   OUT      EFI_USER_INFO              *Info,
508   IN OUT   UINTN                      *InfoSize
509   );
510 
511 /**
512   Add or update user information.
513 
514   This function changes user information.  If NULL is pointed to by UserInfo, then a new user
515   information record is created and its handle is returned in UserInfo. Otherwise, the existing one is
516   replaced.
517   If EFI_USER_INFO_IDENTITY_POLICY_RECORD is changed, it is the caller's responsibility to keep it to
518   be synced with the information on credential providers.
519   If EFI_USER_INFO_EXCLUSIVE is specified in Info and a user information record of the same
520   type already exists in the user profile, then EFI_ACCESS_DENIED will be returned and
521   UserInfo will point to the handle of the existing record.
522 
523   @param[in]     This             Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
524   @param[in]     User             Handle of the user whose profile will be retrieved.
525   @param[in,out] UserInfo         Handle of the user information data record.
526   @param[in]     Info             On entry, points to a buffer of at least *InfoSize bytes. On exit, holds the user
527                                   information. If the buffer is too small to hold the information, then
528                                   EFI_BUFFER_TOO_SMALL is returned and InfoSize is updated to contain the
529                                   number of bytes actually required.
530   @param[in]     InfoSize         On entry, points to the size of Info. On return, points to the size of the user
531                                   information.
532 
533   @retval EFI_SUCCESS             Information returned successfully.
534   @retval EFI_ACCESS_DENIED       The record is exclusive.
535   @retval EFI_SECURITY_VIOLATION  The current user does not have permission to change the specified
536                                   user profile or user information record.
537   @retval EFI_NOT_FOUND           User does not refer to a valid user profile or UserInfo does not refer to a valid
538                                   user info handle.
539   @retval EFI_INVALID_PARAMETER   UserInfo is NULL or Info is NULL.
540 **/
541 typedef
542 EFI_STATUS
543 (EFIAPI *EFI_USER_PROFILE_SET_INFO)(
544   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
545   IN       EFI_USER_PROFILE_HANDLE    User,
546   IN OUT   EFI_USER_INFO_HANDLE       *UserInfo,
547   IN CONST EFI_USER_INFO              *Info,
548   IN       UINTN                      InfoSize
549   );
550 
551 /**
552   Delete user information.
553 
554   Delete the user information attached to the user profile specified by the UserInfo.
555 
556   @param[in] This            Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
557   @param[in] User            Handle of the user whose information will be deleted.
558   @param[in] UserInfo        Handle of the user information to remove.
559 
560   @retval EFI_SUCCESS        User information deleted successfully.
561   @retval EFI_NOT_FOUND      User information record UserInfo does not exist in the user profile.
562   @retval EFI_ACCESS_DENIED  The current user does not have permission to delete this user information.
563 **/
564 typedef
565 EFI_STATUS
566 (EFIAPI *EFI_USER_PROFILE_DELETE_INFO)(
567   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
568   IN       EFI_USER_PROFILE_HANDLE    User,
569   IN       EFI_USER_INFO_HANDLE       UserInfo
570   );
571 
572 /**
573   Enumerate user information of all the enrolled users on the platform.
574 
575   This function returns the next user information record. To retrieve the first user information record
576   handle, point UserInfo at a NULL. Each subsequent call will retrieve another user information
577   record handle until there are no more, at which point UserInfo will point to NULL.
578 
579   @param[in]     This           Points to this instance of the EFI_USER_MANAGER_PROTOCOL.
580   @param[in]     User           Handle of the user whose information will be deleted.
581   @param[in,out] UserInfo       Handle of the user information to remove.
582 
583   @retval EFI_SUCCESS           User information returned.
584   @retval EFI_NOT_FOUND         No more user information found.
585   @retval EFI_INVALID_PARAMETER UserInfo is NULL.
586 **/
587 typedef
588 EFI_STATUS
589 (EFIAPI *EFI_USER_PROFILE_GET_NEXT_INFO)(
590   IN CONST EFI_USER_MANAGER_PROTOCOL  *This,
591   IN       EFI_USER_PROFILE_HANDLE    User,
592   IN OUT   EFI_USER_INFO_HANDLE       *UserInfo
593   );
594 
595 ///
596 /// This protocol provides the services used to manage user profiles.
597 ///
598 struct _EFI_USER_MANAGER_PROTOCOL {
599   EFI_USER_PROFILE_CREATE         Create;
600   EFI_USER_PROFILE_DELETE         Delete;
601   EFI_USER_PROFILE_GET_NEXT       GetNext;
602   EFI_USER_PROFILE_CURRENT        Current;
603   EFI_USER_PROFILE_IDENTIFY       Identify;
604   EFI_USER_PROFILE_FIND           Find;
605   EFI_USER_PROFILE_NOTIFY         Notify;
606   EFI_USER_PROFILE_GET_INFO       GetInfo;
607   EFI_USER_PROFILE_SET_INFO       SetInfo;
608   EFI_USER_PROFILE_DELETE_INFO    DeleteInfo;
609   EFI_USER_PROFILE_GET_NEXT_INFO  GetNextInfo;
610 };
611 
612 extern EFI_GUID gEfiUserManagerProtocolGuid;
613 extern EFI_GUID gEfiEventUserProfileChangedGuid;
614 extern EFI_GUID gEfiUserCredentialClassUnknownGuid;
615 extern EFI_GUID gEfiUserCredentialClassPasswordGuid;
616 extern EFI_GUID gEfiUserCredentialClassSmartCardGuid;
617 extern EFI_GUID gEfiUserCredentialClassFingerprintGuid;
618 extern EFI_GUID gEfiUserCredentialClassHandprintGuid;
619 extern EFI_GUID gEfiUserCredentialClassSecureCardGuid;
620 extern EFI_GUID gEfiUserInfoAccessSetupAdminGuid;
621 extern EFI_GUID gEfiUserInfoAccessSetupNormalGuid;
622 extern EFI_GUID gEfiUserInfoAccessSetupRestrictedGuid;
623 
624 #endif
625