]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/UserIdentification/PwdCredentialProviderDxe/PwdCredentialProvider.h
SecurityPkg: Clean up source files
[mirror_edk2.git] / SecurityPkg / UserIdentification / PwdCredentialProviderDxe / PwdCredentialProvider.h
CommitLineData
0c18794e 1/** @file\r
2 Password Credential Provider driver header file.\r
b3548d32
LG
3\r
4Copyright (c) 2009 - 2018, 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
0c18794e 8http://opensource.org/licenses/bsd-license.php\r
9\r
b3548d32 10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
0c18794e 11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _PASSWORD_CREDENTIAL_PROVIDER_H_\r
16#define _PASSWORD_CREDENTIAL_PROVIDER_H_\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Guid/GlobalVariable.h>\r
0c18794e 21\r
22#include <Protocol/HiiConfigAccess.h>\r
6f0b8648 23#include <Protocol/UserCredential2.h>\r
0c18794e 24#include <Protocol/UserManager.h>\r
25\r
26#include <Library/UefiRuntimeServicesTableLib.h>\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/MemoryAllocationLib.h>\r
29#include <Library/BaseMemoryLib.h>\r
30#include <Library/DevicePathLib.h>\r
31#include <Library/DebugLib.h>\r
32#include <Library/UefiLib.h>\r
33#include <Library/PrintLib.h>\r
34#include <Library/HiiLib.h>\r
35#include <Library/BaseCryptLib.h>\r
36\r
37#include "PwdCredentialProviderData.h"\r
38\r
39extern UINT8 PwdCredentialProviderStrings[];\r
40extern UINT8 PwdCredentialProviderVfrBin[];\r
41\r
42#define PASSWORD_TABLE_INC 16\r
43#define CREDENTIAL_LEN 20\r
44\r
45//\r
46// Password credential information.\r
47//\r
48typedef struct {\r
49 EFI_USER_INFO_IDENTIFIER UserId;\r
50 CHAR8 Password[CREDENTIAL_LEN];\r
51} PASSWORD_INFO;\r
52\r
53//\r
54// Password credential table.\r
55//\r
56typedef struct {\r
57 UINTN Count;\r
58 UINTN MaxCount;\r
59 UINTN ValidIndex;\r
60 PASSWORD_INFO UserInfo[1];\r
61} CREDENTIAL_TABLE;\r
62\r
63//\r
64// The user information on the password provider.\r
65//\r
66typedef struct {\r
67 UINTN Count;\r
68 EFI_USER_INFO *Info[1];\r
69} PASSWORD_CREDENTIAL_INFO;\r
70\r
71///\r
72/// HII specific Vendor Device Path definition.\r
73///\r
74typedef struct {\r
75 VENDOR_DEVICE_PATH VendorDevicePath;\r
76 EFI_DEVICE_PATH_PROTOCOL End;\r
77} HII_VENDOR_DEVICE_PATH;\r
78\r
79#define PWD_PROVIDER_SIGNATURE SIGNATURE_32 ('P', 'W', 'D', 'P')\r
80\r
81typedef struct {\r
82 UINTN Signature;\r
83 EFI_HANDLE DriverHandle;\r
84 EFI_HII_HANDLE HiiHandle;\r
85 //\r
86 // Produced protocol.\r
87 //\r
88 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
89} PWD_PROVIDER_CALLBACK_INFO;\r
90\r
91\r
92/**\r
93 Enroll a user on a credential provider.\r
94\r
b3548d32
LG
95 This function enrolls a user on this credential provider. If the user exists on\r
96 this credential provider, update the user information on this credential provider;\r
6f0b8648 97 otherwise delete the user information on credential provider.\r
b3548d32 98\r
6f0b8648 99 @param[in] This Points to this instance of EFI_USER_CREDENTIAL2_PROTOCOL.\r
0c18794e 100 @param[in] User The user profile to enroll.\r
b3548d32 101\r
0c18794e 102 @retval EFI_SUCCESS User profile was successfully enrolled.\r
103 @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the\r
104 user profile handle. Either the user profile cannot enroll\r
b3548d32 105 on any user profile or cannot enroll on a user profile\r
0c18794e 106 other than the current user profile.\r
107 @retval EFI_UNSUPPORTED This credential provider does not support enrollment in\r
108 the pre-OS.\r
109 @retval EFI_DEVICE_ERROR The new credential could not be created because of a device\r
110 error.\r
111 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle.\r
b3548d32 112\r
0c18794e 113**/\r
114EFI_STATUS\r
115EFIAPI\r
116CredentialEnroll (\r
6f0b8648 117 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 118 IN EFI_USER_PROFILE_HANDLE User\r
119 );\r
120\r
121/**\r
122 Returns the user interface information used during user identification.\r
123\r
124 This function returns information about the form used when interacting with the\r
125 user during user identification. The form is the first enabled form in the form-set\r
b3548d32 126 class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If\r
0c18794e 127 the user credential provider does not require a form to identify the user, then this\r
128 function should return EFI_NOT_FOUND.\r
129\r
6f0b8648 130 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
0c18794e 131 @param[out] Hii On return, holds the HII database handle.\r
132 @param[out] FormSetId On return, holds the identifier of the form set which contains\r
133 the form used during user identification.\r
b3548d32 134 @param[out] FormId On return, holds the identifier of the form used during user\r
0c18794e 135 identification.\r
b3548d32 136\r
0c18794e 137 @retval EFI_SUCCESS Form returned successfully.\r
138 @retval EFI_NOT_FOUND Form not returned.\r
139 @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL.\r
b3548d32 140\r
0c18794e 141**/\r
142EFI_STATUS\r
143EFIAPI\r
144CredentialForm (\r
6f0b8648 145 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 146 OUT EFI_HII_HANDLE *Hii,\r
147 OUT EFI_GUID *FormSetId,\r
148 OUT EFI_FORM_ID *FormId\r
149 );\r
150\r
151/**\r
152 Returns bitmap used to describe the credential provider type.\r
153\r
154 This optional function returns a bitmap which is less than or equal to the number\r
155 of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r
b3548d32 156 is returned.\r
0c18794e 157\r
6f0b8648 158 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
b3548d32
LG
159 @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no\r
160 bitmap information will be returned. On exit, points to the\r
0c18794e 161 width of the bitmap returned.\r
162 @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no\r
b3548d32 163 bitmap information will be returned. On exit, points to the\r
0c18794e 164 height of the bitmap returned\r
b3548d32
LG
165 @param[out] Hii On return, holds the HII database handle.\r
166 @param[out] Image On return, holds the HII image identifier.\r
167\r
0c18794e 168 @retval EFI_SUCCESS Image identifier returned successfully.\r
169 @retval EFI_NOT_FOUND Image identifier not returned.\r
170 @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL.\r
b3548d32 171\r
0c18794e 172**/\r
173EFI_STATUS\r
174EFIAPI\r
175CredentialTile (\r
6f0b8648 176 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 177 IN OUT UINTN *Width,\r
178 IN OUT UINTN *Height,\r
179 OUT EFI_HII_HANDLE *Hii,\r
180 OUT EFI_IMAGE_ID *Image\r
181 );\r
182\r
183/**\r
184 Returns string used to describe the credential provider type.\r
185\r
186 This function returns a string which describes the credential provider. If no\r
b3548d32 187 such string exists, then EFI_NOT_FOUND is returned.\r
0c18794e 188\r
6f0b8648 189 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
0c18794e 190 @param[out] Hii On return, holds the HII database handle.\r
191 @param[out] String On return, holds the HII string identifier.\r
b3548d32 192\r
0c18794e 193 @retval EFI_SUCCESS String identifier returned successfully.\r
194 @retval EFI_NOT_FOUND String identifier not returned.\r
195 @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL.\r
b3548d32 196\r
0c18794e 197**/\r
198EFI_STATUS\r
199EFIAPI\r
200CredentialTitle (\r
6f0b8648 201 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 202 OUT EFI_HII_HANDLE *Hii,\r
203 OUT EFI_STRING_ID *String\r
204 );\r
205\r
206/**\r
207 Return the user identifier associated with the currently authenticated user.\r
208\r
209 This function returns the user identifier of the user authenticated by this credential\r
b3548d32 210 provider. This function is called after the credential-related information has been\r
0c18794e 211 submitted on a form OR after a call to Default() has returned that this credential is\r
212 ready to log on.\r
213\r
6f0b8648 214 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
b3548d32 215 @param[in] User The user profile handle of the user profile currently being\r
0c18794e 216 considered by the user identity manager. If NULL, then no user\r
217 profile is currently under consideration.\r
b3548d32
LG
218 @param[out] Identifier On return, points to the user identifier.\r
219\r
0c18794e 220 @retval EFI_SUCCESS User identifier returned successfully.\r
221 @retval EFI_NOT_READY No user identifier can be returned.\r
222 @retval EFI_ACCESS_DENIED The user has been locked out of this user credential.\r
223 @retval EFI_INVALID_PARAMETER This is NULL, or Identifier is NULL.\r
224 @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be\r
225 found in user profile database\r
b3548d32 226\r
0c18794e 227**/\r
228EFI_STATUS\r
229EFIAPI\r
230CredentialUser (\r
6f0b8648 231 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 232 IN EFI_USER_PROFILE_HANDLE User,\r
233 OUT EFI_USER_INFO_IDENTIFIER *Identifier\r
234 );\r
235\r
236/**\r
237 Indicate that user interface interaction has begun for the specified credential.\r
238\r
b3548d32 239 This function is called when a credential provider is selected by the user. If\r
0c18794e 240 AutoLogon returns FALSE, then the user interface will be constructed by the User\r
b3548d32 241 Identity Manager.\r
0c18794e 242\r
6f0b8648 243 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
b3548d32
LG
244 @param[out] AutoLogon On return, points to the credential provider's capabilities\r
245 after the credential provider has been selected by the user.\r
246\r
0c18794e 247 @retval EFI_SUCCESS Credential provider successfully selected.\r
248 @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r
b3548d32 249\r
0c18794e 250**/\r
251EFI_STATUS\r
252EFIAPI\r
253CredentialSelect (\r
6f0b8648 254 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 255 OUT EFI_CREDENTIAL_LOGON_FLAGS *AutoLogon\r
256 );\r
257\r
258/**\r
259 Indicate that user interface interaction has ended for the specified credential.\r
260\r
261 This function is called when a credential provider is deselected by the user.\r
262\r
6f0b8648 263 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
b3548d32 264\r
0c18794e 265 @retval EFI_SUCCESS Credential provider successfully deselected.\r
b3548d32 266\r
0c18794e 267**/\r
268EFI_STATUS\r
269EFIAPI\r
270CredentialDeselect (\r
6f0b8648 271 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This\r
0c18794e 272 );\r
273\r
274/**\r
275 Return the default logon behavior for this user credential.\r
276\r
b3548d32 277 This function reports the default login behavior regarding this credential provider.\r
0c18794e 278\r
6f0b8648 279 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
0c18794e 280 @param[out] AutoLogon On return, holds whether the credential provider should be used\r
b3548d32
LG
281 by default to automatically log on the user.\r
282\r
0c18794e 283 @retval EFI_SUCCESS Default information successfully returned.\r
284 @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r
285\r
286**/\r
287EFI_STATUS\r
288EFIAPI\r
289CredentialDefault (\r
6f0b8648 290 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 291 OUT EFI_CREDENTIAL_LOGON_FLAGS *AutoLogon\r
292 );\r
293\r
294/**\r
295 Return information attached to the credential provider.\r
296\r
b3548d32 297 This function returns user information.\r
0c18794e 298\r
6f0b8648 299 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
b3548d32 300 @param[in] UserInfo Handle of the user information data record.\r
0c18794e 301 @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On\r
302 exit, holds the user information. If the buffer is too small\r
303 to hold the information, then EFI_BUFFER_TOO_SMALL is returned\r
304 and InfoSize is updated to contain the number of bytes actually\r
305 required.\r
b3548d32
LG
306 @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the\r
307 size of the user information.\r
308\r
0c18794e 309 @retval EFI_SUCCESS Information returned successfully.\r
310 @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the\r
311 user information. The size required is returned in *InfoSize.\r
312 @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL.\r
b3548d32
LG
313 @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle.\r
314\r
0c18794e 315**/\r
316EFI_STATUS\r
317EFIAPI\r
318CredentialGetInfo (\r
6f0b8648 319 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 320 IN EFI_USER_INFO_HANDLE UserInfo,\r
321 OUT EFI_USER_INFO *Info,\r
322 IN OUT UINTN *InfoSize\r
323 );\r
324\r
325\r
326/**\r
327 Enumerate all of the user informations on the credential provider.\r
328\r
329 This function returns the next user information record. To retrieve the first user\r
330 information record handle, point UserInfo at a NULL. Each subsequent call will retrieve\r
331 another user information record handle until there are no more, at which point UserInfo\r
b3548d32 332 will point to NULL.\r
0c18794e 333\r
6f0b8648 334 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
0c18794e 335 @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r
336 to start enumeration. On exit, points to the next user information\r
337 handle or NULL if there is no more user information.\r
b3548d32 338\r
0c18794e 339 @retval EFI_SUCCESS User information returned.\r
340 @retval EFI_NOT_FOUND No more user information found.\r
341 @retval EFI_INVALID_PARAMETER UserInfo is NULL.\r
b3548d32 342\r
0c18794e 343**/\r
344EFI_STATUS\r
345EFIAPI\r
346CredentialGetNextInfo (\r
6f0b8648 347 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
0c18794e 348 IN OUT EFI_USER_INFO_HANDLE *UserInfo\r
349 );\r
350\r
6f0b8648 351/**\r
352 Delete a user on this credential provider.\r
353\r
b3548d32 354 This function deletes a user on this credential provider.\r
6f0b8648 355\r
356 @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r
357 @param[in] User The user profile handle to delete.\r
358\r
359 @retval EFI_SUCCESS User profile was successfully deleted.\r
b3548d32
LG
360 @retval EFI_ACCESS_DENIED Current user profile does not permit deletion on the user profile handle.\r
361 Either the user profile cannot delete on any user profile or cannot delete\r
362 on a user profile other than the current user profile.\r
6f0b8648 363 @retval EFI_UNSUPPORTED This credential provider does not support deletion in the pre-OS.\r
364 @retval EFI_DEVICE_ERROR The new credential could not be deleted because of a device error.\r
365 @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle.\r
366**/\r
367EFI_STATUS\r
368EFIAPI\r
369CredentialDelete (\r
370 IN CONST EFI_USER_CREDENTIAL2_PROTOCOL *This,\r
371 IN EFI_USER_PROFILE_HANDLE User\r
372 );\r
373\r
0c18794e 374#endif\r