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