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