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