]>
Commit | Line | Data |
---|---|---|
0c18794e | 1 | /** @file\r |
2 | Password Credential Provider driver header file.\r | |
3 | \r | |
4 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
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 | |
23 | #include <Protocol/UserCredential.h>\r | |
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 | |
95 | This function enrolls and deletes a user profile using this credential provider. \r | |
96 | If a user profile is successfully enrolled, it calls the User Manager Protocol \r | |
97 | function Notify() to notify the user manager driver that credential information \r | |
98 | has changed. If an enrolled user does exist, delete the user on the credential \r | |
99 | provider.\r | |
100 | \r | |
101 | @param[in] This Points to this instance of EFI_USER_CREDENTIAL_PROTOCOL.\r | |
102 | @param[in] User The user profile to enroll.\r | |
103 | \r | |
104 | @retval EFI_SUCCESS User profile was successfully enrolled.\r | |
105 | @retval EFI_ACCESS_DENIED Current user profile does not permit enrollment on the\r | |
106 | user profile handle. Either the user profile cannot enroll\r | |
107 | on any user profile or cannot enroll on a user profile \r | |
108 | other than the current user profile.\r | |
109 | @retval EFI_UNSUPPORTED This credential provider does not support enrollment in\r | |
110 | the pre-OS.\r | |
111 | @retval EFI_DEVICE_ERROR The new credential could not be created because of a device\r | |
112 | error.\r | |
113 | @retval EFI_INVALID_PARAMETER User does not refer to a valid user profile handle.\r | |
114 | \r | |
115 | **/\r | |
116 | EFI_STATUS\r | |
117 | EFIAPI\r | |
118 | CredentialEnroll (\r | |
119 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
120 | IN EFI_USER_PROFILE_HANDLE User\r | |
121 | );\r | |
122 | \r | |
123 | /**\r | |
124 | Returns the user interface information used during user identification.\r | |
125 | \r | |
126 | This function returns information about the form used when interacting with the\r | |
127 | user during user identification. The form is the first enabled form in the form-set\r | |
128 | class EFI_HII_USER_CREDENTIAL_FORMSET_GUID installed on the HII handle HiiHandle. If \r | |
129 | the user credential provider does not require a form to identify the user, then this\r | |
130 | function should return EFI_NOT_FOUND.\r | |
131 | \r | |
132 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
133 | @param[out] Hii On return, holds the HII database handle.\r | |
134 | @param[out] FormSetId On return, holds the identifier of the form set which contains\r | |
135 | the form used during user identification.\r | |
136 | @param[out] FormId On return, holds the identifier of the form used during user \r | |
137 | identification.\r | |
138 | \r | |
139 | @retval EFI_SUCCESS Form returned successfully.\r | |
140 | @retval EFI_NOT_FOUND Form not returned.\r | |
141 | @retval EFI_INVALID_PARAMETER Hii is NULL or FormSetId is NULL or FormId is NULL.\r | |
142 | \r | |
143 | **/\r | |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | CredentialForm (\r | |
147 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
148 | OUT EFI_HII_HANDLE *Hii,\r | |
149 | OUT EFI_GUID *FormSetId,\r | |
150 | OUT EFI_FORM_ID *FormId\r | |
151 | );\r | |
152 | \r | |
153 | /**\r | |
154 | Returns bitmap used to describe the credential provider type.\r | |
155 | \r | |
156 | This optional function returns a bitmap which is less than or equal to the number\r | |
157 | of pixels specified by Width and Height. If no such bitmap exists, then EFI_NOT_FOUND\r | |
158 | is returned. \r | |
159 | \r | |
160 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
161 | @param[in, out] Width On entry, points to the desired bitmap width. If NULL then no \r | |
162 | bitmap information will be returned. On exit, points to the \r | |
163 | width of the bitmap returned.\r | |
164 | @param[in, out] Height On entry, points to the desired bitmap height. If NULL then no\r | |
165 | bitmap information will be returned. On exit, points to the \r | |
166 | height of the bitmap returned\r | |
167 | @param[out] Hii On return, holds the HII database handle. \r | |
168 | @param[out] Image On return, holds the HII image identifier. \r | |
169 | \r | |
170 | @retval EFI_SUCCESS Image identifier returned successfully.\r | |
171 | @retval EFI_NOT_FOUND Image identifier not returned.\r | |
172 | @retval EFI_INVALID_PARAMETER Hii is NULL or Image is NULL.\r | |
173 | \r | |
174 | **/\r | |
175 | EFI_STATUS\r | |
176 | EFIAPI\r | |
177 | CredentialTile (\r | |
178 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
179 | IN OUT UINTN *Width,\r | |
180 | IN OUT UINTN *Height,\r | |
181 | OUT EFI_HII_HANDLE *Hii,\r | |
182 | OUT EFI_IMAGE_ID *Image\r | |
183 | );\r | |
184 | \r | |
185 | /**\r | |
186 | Returns string used to describe the credential provider type.\r | |
187 | \r | |
188 | This function returns a string which describes the credential provider. If no\r | |
189 | such string exists, then EFI_NOT_FOUND is returned. \r | |
190 | \r | |
191 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
192 | @param[out] Hii On return, holds the HII database handle.\r | |
193 | @param[out] String On return, holds the HII string identifier.\r | |
194 | \r | |
195 | @retval EFI_SUCCESS String identifier returned successfully.\r | |
196 | @retval EFI_NOT_FOUND String identifier not returned.\r | |
197 | @retval EFI_INVALID_PARAMETER Hii is NULL or String is NULL.\r | |
198 | \r | |
199 | **/\r | |
200 | EFI_STATUS\r | |
201 | EFIAPI\r | |
202 | CredentialTitle (\r | |
203 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
204 | OUT EFI_HII_HANDLE *Hii,\r | |
205 | OUT EFI_STRING_ID *String\r | |
206 | );\r | |
207 | \r | |
208 | /**\r | |
209 | Return the user identifier associated with the currently authenticated user.\r | |
210 | \r | |
211 | This function returns the user identifier of the user authenticated by this credential\r | |
212 | provider. This function is called after the credential-related information has been \r | |
213 | submitted on a form OR after a call to Default() has returned that this credential is\r | |
214 | ready to log on.\r | |
215 | \r | |
216 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
217 | @param[in] User The user profile handle of the user profile currently being \r | |
218 | considered by the user identity manager. If NULL, then no user\r | |
219 | profile is currently under consideration.\r | |
220 | @param[out] Identifier On return, points to the user identifier. \r | |
221 | \r | |
222 | @retval EFI_SUCCESS User identifier returned successfully.\r | |
223 | @retval EFI_NOT_READY No user identifier can be returned.\r | |
224 | @retval EFI_ACCESS_DENIED The user has been locked out of this user credential.\r | |
225 | @retval EFI_INVALID_PARAMETER This is NULL, or Identifier is NULL.\r | |
226 | @retval EFI_NOT_FOUND User is not NULL, and the specified user handle can't be\r | |
227 | found in user profile database\r | |
228 | \r | |
229 | **/\r | |
230 | EFI_STATUS\r | |
231 | EFIAPI\r | |
232 | CredentialUser (\r | |
233 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
234 | IN EFI_USER_PROFILE_HANDLE User,\r | |
235 | OUT EFI_USER_INFO_IDENTIFIER *Identifier\r | |
236 | );\r | |
237 | \r | |
238 | /**\r | |
239 | Indicate that user interface interaction has begun for the specified credential.\r | |
240 | \r | |
241 | This function is called when a credential provider is selected by the user. If \r | |
242 | AutoLogon returns FALSE, then the user interface will be constructed by the User\r | |
243 | Identity Manager. \r | |
244 | \r | |
245 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
246 | @param[out] AutoLogon On return, points to the credential provider's capabilities \r | |
247 | after the credential provider has been selected by the user. \r | |
248 | \r | |
249 | @retval EFI_SUCCESS Credential provider successfully selected.\r | |
250 | @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r | |
251 | \r | |
252 | **/\r | |
253 | EFI_STATUS\r | |
254 | EFIAPI\r | |
255 | CredentialSelect (\r | |
256 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
257 | OUT EFI_CREDENTIAL_LOGON_FLAGS *AutoLogon\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Indicate that user interface interaction has ended for the specified credential.\r | |
262 | \r | |
263 | This function is called when a credential provider is deselected by the user.\r | |
264 | \r | |
265 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
266 | \r | |
267 | @retval EFI_SUCCESS Credential provider successfully deselected.\r | |
268 | \r | |
269 | **/\r | |
270 | EFI_STATUS\r | |
271 | EFIAPI\r | |
272 | CredentialDeselect (\r | |
273 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This\r | |
274 | );\r | |
275 | \r | |
276 | /**\r | |
277 | Return the default logon behavior for this user credential.\r | |
278 | \r | |
279 | This function reports the default login behavior regarding this credential provider. \r | |
280 | \r | |
281 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
282 | @param[out] AutoLogon On return, holds whether the credential provider should be used\r | |
283 | by default to automatically log on the user. \r | |
284 | \r | |
285 | @retval EFI_SUCCESS Default information successfully returned.\r | |
286 | @retval EFI_INVALID_PARAMETER AutoLogon is NULL.\r | |
287 | \r | |
288 | **/\r | |
289 | EFI_STATUS\r | |
290 | EFIAPI\r | |
291 | CredentialDefault (\r | |
292 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
293 | OUT EFI_CREDENTIAL_LOGON_FLAGS *AutoLogon\r | |
294 | );\r | |
295 | \r | |
296 | /**\r | |
297 | Return information attached to the credential provider.\r | |
298 | \r | |
299 | This function returns user information. \r | |
300 | \r | |
301 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
302 | @param[in] UserInfo Handle of the user information data record. \r | |
303 | @param[out] Info On entry, points to a buffer of at least *InfoSize bytes. On\r | |
304 | exit, holds the user information. If the buffer is too small\r | |
305 | to hold the information, then EFI_BUFFER_TOO_SMALL is returned\r | |
306 | and InfoSize is updated to contain the number of bytes actually\r | |
307 | required.\r | |
308 | @param[in, out] InfoSize On entry, points to the size of Info. On return, points to the \r | |
309 | size of the user information. \r | |
310 | \r | |
311 | @retval EFI_SUCCESS Information returned successfully.\r | |
312 | @retval EFI_BUFFER_TOO_SMALL The size specified by InfoSize is too small to hold all of the\r | |
313 | user information. The size required is returned in *InfoSize.\r | |
314 | @retval EFI_INVALID_PARAMETER Info is NULL or InfoSize is NULL.\r | |
315 | @retval EFI_NOT_FOUND The specified UserInfo does not refer to a valid user info handle. \r | |
316 | \r | |
317 | **/\r | |
318 | EFI_STATUS\r | |
319 | EFIAPI\r | |
320 | CredentialGetInfo (\r | |
321 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
322 | IN EFI_USER_INFO_HANDLE UserInfo,\r | |
323 | OUT EFI_USER_INFO *Info,\r | |
324 | IN OUT UINTN *InfoSize\r | |
325 | );\r | |
326 | \r | |
327 | \r | |
328 | /**\r | |
329 | Enumerate all of the user informations on the credential provider.\r | |
330 | \r | |
331 | This function returns the next user information record. To retrieve the first user\r | |
332 | information record handle, point UserInfo at a NULL. Each subsequent call will retrieve\r | |
333 | another user information record handle until there are no more, at which point UserInfo\r | |
334 | will point to NULL. \r | |
335 | \r | |
336 | @param[in] This Points to this instance of the EFI_USER_CREDENTIAL_PROTOCOL.\r | |
337 | @param[in, out] UserInfo On entry, points to the previous user information handle or NULL\r | |
338 | to start enumeration. On exit, points to the next user information\r | |
339 | handle or NULL if there is no more user information.\r | |
340 | \r | |
341 | @retval EFI_SUCCESS User information returned.\r | |
342 | @retval EFI_NOT_FOUND No more user information found.\r | |
343 | @retval EFI_INVALID_PARAMETER UserInfo is NULL.\r | |
344 | \r | |
345 | **/\r | |
346 | EFI_STATUS\r | |
347 | EFIAPI\r | |
348 | CredentialGetNextInfo (\r | |
349 | IN CONST EFI_USER_CREDENTIAL_PROTOCOL *This,\r | |
350 | IN OUT EFI_USER_INFO_HANDLE *UserInfo\r | |
351 | );\r | |
352 | \r | |
353 | #endif\r |