PlatformSecureLibNull.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
  7. SPDX-License-Identifier: BSD-2-Clause-Patent
  8. **/
  9. #include <Uefi/UefiBaseType.h>
  10. BOOLEAN mUserPhysicalPresence = FALSE;
  11. /**
  12. This function provides a platform-specific method to detect whether the platform
  13. is operating by a physically present user.
  14. Programmatic changing of platform security policy (such as disable Secure Boot,
  15. or switch between Standard/Custom Secure Boot mode) MUST NOT be possible during
  16. Boot Services or after exiting EFI Boot Services. Only a physically present user
  17. is allowed to perform these operations.
  18. NOTE THAT: This function cannot depend on any EFI Variable Service since they are
  19. not available when this function is called in AuthenticateVariable driver.
  20. @retval TRUE The platform is operated by a physically present user.
  21. @retval FALSE The platform is NOT operated by a physically present user.
  22. **/
  23. BOOLEAN
  24. EFIAPI
  25. UserPhysicalPresent (
  26. VOID
  27. )
  28. {
  29. return mUserPhysicalPresence;
  30. }
  31. /**
  32. Save user physical presence state from a PCD to mUserPhysicalPresence.
  33. @retval EFI_SUCCESS PcdUserPhysicalPresence is got successfully.
  34. **/
  35. RETURN_STATUS
  36. EFIAPI
  37. PlatformSecureLibNullConstructor (
  38. VOID
  39. )
  40. {
  41. mUserPhysicalPresence = PcdGetBool (PcdUserPhysicalPresence);
  42. return RETURN_SUCCESS;
  43. }