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