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