]>
Commit | Line | Data |
---|---|---|
0c18794e | 1 | /** @file\r |
2 | Password Credential Provider driver header file.\r | |
3 | \r | |
6f0b8648 | 4 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r |
0c18794e | 5 | This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT 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 | |
39 | extern UINT8 PwdCredentialProviderStrings[];\r | |
40 | extern 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 | |
48 | typedef 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 | |
56 | typedef 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 | |
66 | typedef 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 | |
74 | typedef 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 | |
81 | typedef 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 | |
6f0b8648 | 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 | |
97 | otherwise delete the user information on credential provider.\r | |
98 | \r | |
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 |
101 | \r | |
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 | |
105 | on any user profile or cannot enroll on a user profile \r | |
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 | |
112 | \r | |
113 | **/\r | |
114 | EFI_STATUS\r | |
115 | EFIAPI\r | |
116 | CredentialEnroll (\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 | |
126 | class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If \r | |
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 | |
134 | @param[out] FormId On return, holds the identifier of the form used during user \r | |
135 | identification.\r | |
136 | \r | |
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 | |
140 | \r | |
141 | **/\r | |
142 | EFI_STATUS\r | |
143 | EFIAPI\r | |
144 | CredentialForm (\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 | |
156 | is returned. \r | |
157 | \r | |
6f0b8648 | 158 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r |
0c18794e | 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 | |
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 | |
163 | bitmap information will be returned. On exit, points to the \r | |
164 | height of the bitmap returned\r | |
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 | |
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 | |
171 | \r | |
172 | **/\r | |
173 | EFI_STATUS\r | |
174 | EFIAPI\r | |
175 | CredentialTile (\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 | |
187 | such string exists, then EFI_NOT_FOUND is returned. \r | |
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 | |
192 | \r | |
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 | |
196 | \r | |
197 | **/\r | |
198 | EFI_STATUS\r | |
199 | EFIAPI\r | |
200 | CredentialTitle (\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 | |
210 | provider. This function is called after the credential-related information has been \r | |
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 |
0c18794e | 215 | @param[in] User The user profile handle of the user profile currently being \r |
216 | considered by the user identity manager. If NULL, then no user\r | |
217 | profile is currently under consideration.\r | |
218 | @param[out] Identifier On return, points to the user identifier. \r | |
219 | \r | |
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 | |
226 | \r | |
227 | **/\r | |
228 | EFI_STATUS\r | |
229 | EFIAPI\r | |
230 | CredentialUser (\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 | |
239 | This function is called when a credential provider is selected by the user. If \r | |
240 | AutoLogon returns FALSE, then the user interface will be constructed by the User\r | |
241 | Identity Manager. \r | |
242 | \r | |
6f0b8648 | 243 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r |
0c18794e | 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 | |
247 | @retval EFI_SUCCESS Credential provider successfully selected.\r | |
248 | @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r | |
249 | \r | |
250 | **/\r | |
251 | EFI_STATUS\r | |
252 | EFIAPI\r | |
253 | CredentialSelect (\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 |
0c18794e | 264 | \r |
265 | @retval EFI_SUCCESS Credential provider successfully deselected.\r | |
266 | \r | |
267 | **/\r | |
268 | EFI_STATUS\r | |
269 | EFIAPI\r | |
270 | CredentialDeselect (\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 | |
277 | This function reports the default login behavior regarding this credential provider. \r | |
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 |
281 | by default to automatically log on the user. \r | |
282 | \r | |
283 | @retval EFI_SUCCESS Default information successfully returned.\r | |
284 | @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r | |
285 | \r | |
286 | **/\r | |
287 | EFI_STATUS\r | |
288 | EFIAPI\r | |
289 | CredentialDefault (\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 | |
297 | This function returns user information. \r | |
298 | \r | |
6f0b8648 | 299 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL2_PROTOCOL.\r |
0c18794e | 300 | @param[in] UserInfo Handle of the user information data record. \r |
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 | |
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 | |
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 | |
313 | @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. \r | |
314 | \r | |
315 | **/\r | |
316 | EFI_STATUS\r | |
317 | EFIAPI\r | |
318 | CredentialGetInfo (\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 | |
332 | will point to NULL. \r | |
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 | |
338 | \r | |
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 | |
342 | \r | |
343 | **/\r | |
344 | EFI_STATUS\r | |
345 | EFIAPI\r | |
346 | CredentialGetNextInfo (\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 | |
354 | This function deletes a user on this credential provider. \r | |
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 | |
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 | |
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 | |
367 | EFI_STATUS\r | |
368 | EFIAPI\r | |
369 | CredentialDelete (\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 |