summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@hpe.com>2022-03-04 16:45:05 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-03-16 08:58:43 +0000
commit33438f7354af9c04cb296fb15a7a79c2c3944c0a (patch)
tree8e40fd6b12ba9662b79e4e6bf6e359986e3350b7
parent414cd2a4d536b444acee3fcdbe33bd0c8ef9819b (diff)
downloadedk2-33438f7354af9c04cb296fb15a7a79c2c3944c0a.tar.gz
edk2-33438f7354af9c04cb296fb15a7a79c2c3944c0a.tar.bz2
edk2-33438f7354af9c04cb296fb15a7a79c2c3944c0a.zip
EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME
https://bugzilla.tianocore.org/show_bug.cgi?id=3858 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.chang@hpe.com> Cc: Nickle Wang <nickle.wang@hpe.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
-rw-r--r--EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c32
1 files 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);
}