]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
ShellPkg/for: Fix potential null pointer deference
[mirror_edk2.git] / SecurityPkg / Library / PlatformSecureLibNull / PlatformSecureLibNull.c
1 /** @file
2 NULL PlatformSecureLib instance does NOT really detect whether a physical present
3 user exists but return TRUE directly. This instance can be used to verify security
4 related features during platform enabling and development. It should be replaced
5 by a platform-specific method(e.g. Button pressed) in a real platform for product.
6
7 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 BOOLEAN mUserPhysicalPresence = FALSE;
19
20 /**
21
22 This function provides a platform-specific method to detect whether the platform
23 is operating by a physically present user.
24
25 Programmatic changing of platform security policy (such as disable Secure Boot,
26 or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during
27 Boot Services or after exiting EFI Boot Services. Only a physically present user
28 is allowed to perform these operations.
29
30 NOTE THAT: This function cannot depend on any EFI Variable Service since they are
31 not available when this function is called in AuthenticateVariable driver.
32
33 @retval TRUE The platform is operated by a physically present user.
34 @retval FALSE The platform is NOT operated by a physically present user.
35
36 **/
37 BOOLEAN
38 EFIAPI
39 UserPhysicalPresent (
40 VOID
41 )
42 {
43 return mUserPhysicalPresence;
44 }
45
46
47 /**
48 Save user physical presence state from a PCD to mUserPhysicalPresence.
49
50 @param ImageHandle ImageHandle of the loaded driver.
51 @param SystemTable Pointer to the EFI System Table.
52
53 @retval EFI_SUCCESS PcdUserPhysicalPresence is got successfully.
54
55 **/
56 EFI_STATUS
57 EFIAPI
58 PlatformSecureLibNullConstructor (
59 IN EFI_HANDLE ImageHandle,
60 IN EFI_SYSTEM_TABLE *SystemTable
61 )
62 {
63
64 mUserPhysicalPresence = PcdGetBool(PcdUserPhysicalPresence);
65
66 return EFI_SUCCESS;
67 }