hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/** @file
  NULL PlatformPasswordLib instance does NOT really detect whether the password is cleared
  but returns the PCD value directly. This instance can be used to verify security
  related features during platform enabling and development. It should be replaced
  by a platform-specific method(e.g. Button pressed) in a real platform for product.
 
  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
BOOLEAN       mPasswordCleared      = FALSE;
 
/**
  This function is called at password driver entrypoint.
  This function should be called only once, to clear the password.
 
  This function provides a way to reset the password, just in case
  the platform owner forgets the password.
  The platform should provide a secure way to make sure
  only the platform owner is allowed to clear password.
 
  Once the password is cleared, the platform should provide a way
  to set a new password.
 
  @retval TRUE  There is a platform request to clear the password.
  @retval FALSE There is no platform request to clear the password.
**/
BOOLEAN
EFIAPI
IsPasswordCleared (
  VOID
  )
{
  return mPasswordCleared;
}
 
/**
  This function is called if the password driver finds that the password is not enrolled,
  when the password is required to input.
 
  This function should return the action according to platform policy.
 
  @retval TRUE  The caller should force the user to enroll the password.
  @retval FALSE The caller may skip the password enroll.
**/
BOOLEAN
EFIAPI
NeedEnrollPassword (
  VOID
  )
{
  return FALSE;
}
 
 
/**
  Save password clear state from a PCD to mPasswordCleared.
 
  @param  ImageHandle   ImageHandle of the loaded driver.
  @param  SystemTable   Pointer to the EFI System Table.
 
  @retval  EFI_SUCCESS          PcdPasswordCleared is got successfully.
 
**/
EFI_STATUS
EFIAPI
PlatformPasswordLibNullConstructor (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
 
  mPasswordCleared = PcdGetBool(PcdPasswordCleared);
 
  return EFI_SUCCESS;
}