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