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