From a95dbfd7ad66712a038bae6c5003b3e1d9df26f1 Mon Sep 17 00:00:00 2001 From: Joey Vagedes Date: Mon, 4 Dec 2023 15:19:14 -0800 Subject: [PATCH] Update --- .../BaseSecureBootKeyStoreLib.inf} | 5 ++- .../SecureBootKeyStoreLib.c | 36 +++---------------- 2 files changed, 7 insertions(+), 34 deletions(-) rename MsCorePkg/Library/{SecureBootKeyStoreLib/SecureBootKeyStoreLib.inf => BaseSecureBootKeyStoreLib/BaseSecureBootKeyStoreLib.inf} (83%) rename MsCorePkg/Library/{SecureBootKeyStoreLib => BaseSecureBootKeyStoreLib}/SecureBootKeyStoreLib.c (71%) diff --git a/MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.inf b/MsCorePkg/Library/BaseSecureBootKeyStoreLib/BaseSecureBootKeyStoreLib.inf similarity index 83% rename from MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.inf rename to MsCorePkg/Library/BaseSecureBootKeyStoreLib/BaseSecureBootKeyStoreLib.inf index e5103c287b..d577c15ee8 100644 --- a/MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.inf +++ b/MsCorePkg/Library/BaseSecureBootKeyStoreLib/BaseSecureBootKeyStoreLib.inf @@ -1,16 +1,15 @@ -## @file - SecureBootKeyStoreLib.inf +## @file - BaseSecureBootKeyStoreLib.inf # Copyright (C) Microsoft Corporation. All rights reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # [Defines] INF_VERSION = 0x00010005 - BASE_NAME = SecureBootKeyStoreLib + BASE_NAME = BaseSecureBootKeyStoreLib FILE_GUID = 02EEF9DA-5557-4090-BFF5-E07EF0344805 VERSION_STRING = 1.0 MODULE_TYPE = BASE LIBRARY_CLASS = SecureBootKeyStoreLib - CONSTRUCTOR = SecureBootKeyStoreLibConstructor # # The following information is for reference only and not required by the build tools. diff --git a/MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.c b/MsCorePkg/Library/BaseSecureBootKeyStoreLib/SecureBootKeyStoreLib.c similarity index 71% rename from MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.c rename to MsCorePkg/Library/BaseSecureBootKeyStoreLib/SecureBootKeyStoreLib.c index 94cc59c7c0..c8ca803992 100644 --- a/MsCorePkg/Library/SecureBootKeyStoreLib/SecureBootKeyStoreLib.c +++ b/MsCorePkg/Library/BaseSecureBootKeyStoreLib/SecureBootKeyStoreLib.c @@ -8,20 +8,13 @@ #include #include + #include -#include -#include -#include +#include #include -#define PLATFORM_SECURE_BOOT_KEY_COUNT 2 - -SECURE_BOOT_PAYLOAD_INFO *gSecureBootPayload = NULL; -UINT8 gSecureBootPayloadCount = 0; - -UINT8 mSecureBootPayloadCount = PLATFORM_SECURE_BOOT_KEY_COUNT; -SECURE_BOOT_PAYLOAD_INFO mSecureBootPayload[PLATFORM_SECURE_BOOT_KEY_COUNT] = { +SECURE_BOOT_PAYLOAD_INFO mSecureBootPayload[] = { { .SecureBootKeyName = L"Microsoft Only", .KekPtr = (CONST UINT8 *)FixedPcdGetPtr (PcdDefaultKek), @@ -62,7 +55,6 @@ SECURE_BOOT_PAYLOAD_INFO mSecureBootPayload[PLATFORM_SECURE_BOOT_KEY_COUNT] = { @retval EFI_SUCCESS The Keys are properly fetched. @retval EFI_INVALID_PARAMETER Inputs have NULL pointers. - @retval Others Something went wrong. Investigate further. **/ EFI_STATUS EFIAPI @@ -75,26 +67,8 @@ GetPlatformKeyStore ( return EFI_INVALID_PARAMETER; } - *Keys = gSecureBootPayload; - *KeyCount = gSecureBootPayloadCount; - - return EFI_SUCCESS; -} - -/** - The constructor gets the secure boot platform keys populated. - - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -SecureBootKeyStoreLibConstructor ( - VOID - ) -{ - gSecureBootPayload = mSecureBootPayload; - gSecureBootPayloadCount = mSecureBootPayloadCount; + *Keys = mSecureBootPayload; + *KeyCount = ARRAY_SIZE (mSecureBootPayload); return EFI_SUCCESS; }