Reviewed-by: Nickle Wang <nickle.w...@hpe.com> Thanks, Nickle
-----Original Message----- From: Chang, Abner (HPS SW/FW Technologist) <abner.ch...@hpe.com> Sent: Thursday, March 10, 2022 1:42 PM To: devel@edk2.groups.io Cc: Wang, Nickle (Server BIOS) <nickle.w...@hpe.com>; Andrew Fish <af...@apple.com>; Ray Ni <ray...@intel.com> Subject: [PATCH] EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME Check EFI_SECURE_BOOT_MODE_NAME before setting the flags to prohibit acquiring Redfish service credential and using Redfish service. Signed-off-by: Abner Chang <abner.ch...@hpe.com> Cc: Nickle Wang <nickle.w...@hpe.com> Cc: Andrew Fish <af...@apple.com> Cc: Ray Ni <ray...@intel.com> --- .../RedfishPlatformCredentialLib.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c index eaf9c56450..a0233a984d 100644 --- a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c +++ b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c @@ -165,6 +165,9 @@ LibStopRedfishService ( IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType ) { + EFI_STATUS Status; + UINT8 *SecureBootVar; + if (ServiceStopType >= ServiceStopTypeMax) { return EFI_INVALID_PARAMETER; } @@ -177,8 +180,18 @@ LibStopRedfishService ( if (!PcdGetBool (PcdRedfishServieStopIfSecureBootDisabled)) { return EFI_UNSUPPORTED; } else { - mStopRedfishService = TRUE; - DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureBoot is disabled!!\n")); + // + // Check Secure Boot status and lock Redfish service if Secure Boot is disabled. + // + Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID **)&SecureBootVar, NULL); + if (EFI_ERROR (Status) || (*SecureBootVar != SECURE_BOOT_MODE_ENABLE)) { + // + // Secure Boot is disabled + // + mSecureBootDisabled = TRUE; + mStopRedfishService = TRUE; + DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureBoot is disabled!!\n")); + } } } else if (ServiceStopType == ServiceStopTypeExitBootService) { // @@ -224,18 +237,5 @@ LibCredentialEndOfDxeNotify ( IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This ) { - EFI_STATUS Status; - UINT8 *SecureBootVar; - - // - // Check Secure Boot status and lock Redfish service if Secure Boot is disabled. - // - Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID **)&SecureBootVar, NULL); - if (EFI_ERROR (Status) || (*SecureBootVar != SECURE_BOOT_MODE_ENABLE)) { - // - // Secure Boot is disabled - // - mSecureBootDisabled = TRUE; - LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); - } + LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); } -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87554): https://edk2.groups.io/g/devel/message/87554 Mute This Topic: https://groups.io/mt/89681463/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-