]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
SecurityPkg/PlatformSecureLibNull: permit use by MM_STANDALONE modules
[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 - 2018, 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 #include <Uefi/UefiBaseType.h>
19
20 BOOLEAN mUserPhysicalPresence = FALSE;
21
22 /**
23
24 This function provides a platform-specific method to detect whether the platform
25 is operating by a physically present user.
26
27 Programmatic changing of platform security policy (such as disable Secure Boot,
28 or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during
29 Boot Services or after exiting EFI Boot Services. Only a physically present user
30 is allowed to perform these operations.
31
32 NOTE THAT: This function cannot depend on any EFI Variable Service since they are
33 not available when this function is called in AuthenticateVariable driver.
34
35 @retval TRUE The platform is operated by a physically present user.
36 @retval FALSE The platform is NOT operated by a physically present user.
37
38 **/
39 BOOLEAN
40 EFIAPI
41 UserPhysicalPresent (
42 VOID
43 )
44 {
45 return mUserPhysicalPresence;
46 }
47
48
49 /**
50 Save user physical presence state from a PCD to mUserPhysicalPresence.
51
52 @retval EFI_SUCCESS PcdUserPhysicalPresence is got successfully.
53
54 **/
55 RETURN_STATUS
56 EFIAPI
57 PlatformSecureLibNullConstructor (
58 VOID
59 )
60 {
61
62 mUserPhysicalPresence = PcdGetBool(PcdUserPhysicalPresence);
63
64 return RETURN_SUCCESS;
65 }