]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/SecureBootVariableLib/UnitTest/MockPlatformPKProtectionLib.c
SecurityPkg: SecureBootVariableLib: Added unit tests
[mirror_edk2.git] / SecurityPkg / Library / SecureBootVariableLib / UnitTest / MockPlatformPKProtectionLib.c
diff --git a/SecurityPkg/Library/SecureBootVariableLib/UnitTest/MockPlatformPKProtectionLib.c b/SecurityPkg/Library/SecureBootVariableLib/UnitTest/MockPlatformPKProtectionLib.c
new file mode 100644 (file)
index 0000000..a8644d2
--- /dev/null
@@ -0,0 +1,36 @@
+/** @file\r
+  Provides a mocked interface for configuring PK related variable protection.\r
+\r
+  Copyright (c) Microsoft Corporation.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <stdarg.h>\r
+#include <stddef.h>\r
+#include <setjmp.h>\r
+#include <cmocka.h>\r
+\r
+#include <Uefi.h>\r
+\r
+/**\r
+  Disable any applicable protection against variable 'PK'. The implementation\r
+  of this interface is platform specific, depending on the protection techniques\r
+  used per platform.\r
+\r
+  Note: It is the platform's responsibility to conduct cautious operation after\r
+        disabling this protection.\r
+\r
+  @retval     EFI_SUCCESS             State has been successfully updated.\r
+  @retval     Others                  Error returned from implementation specific\r
+                                      underying APIs.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DisablePKProtection (\r
+  VOID\r
+  )\r
+{\r
+  return (EFI_STATUS)mock ();\r
+}\r