]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
1. Reset system when user changes secure boot state in secure boot configuration...
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / SecureBootConfigDxe / SecureBootConfigImpl.c
index 0a08479b4b01a07ae60c70d9de843c05e1e4bef1..26fc09d52d2788a9d564bd97716556bda628d2b1 100644 (file)
@@ -2069,27 +2069,25 @@ SecureBootExtractConfigFromVariable (
 {\r
   UINT8   *SecureBootEnable;\r
   UINT8   *SetupMode;\r
+  UINT8   *SecureBoot;\r
   UINT8   *SecureBootMode;\r
 \r
   SecureBootEnable = NULL;\r
   SetupMode        = NULL;\r
+  SecureBoot       = NULL;\r
   SecureBootMode   = NULL;\r
   \r
-  //\r
-  // Get the SecureBootEnable Variable\r
-  //\r
-  GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);\r
-\r
   //\r
   // If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable\r
   // Checkbox.\r
   //\r
+  GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);\r
   if (SecureBootEnable == NULL) {\r
     ConfigData->HideSecureBoot = TRUE;\r
   } else {\r
     ConfigData->HideSecureBoot = FALSE;\r
-    ConfigData->SecureBootState = *SecureBootEnable;\r
   }\r
+  \r
   //\r
   // If it is Physical Presence User, set the PhysicalPresent to true.\r
   //\r
@@ -2103,11 +2101,21 @@ SecureBootExtractConfigFromVariable (
   // If there is no PK then the Delete Pk button will be gray.\r
   //\r
   GetVariable2 (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SetupMode, NULL);\r
-  if (SetupMode == NULL || (*SetupMode) == 1) {\r
+  if (SetupMode == NULL || (*SetupMode) == SETUP_MODE) {\r
     ConfigData->HasPk = FALSE;\r
   } else  {\r
     ConfigData->HasPk = TRUE;\r
   }\r
+  \r
+  //\r
+  // If the value of SecureBoot variable is 1, the platform is operating in secure boot mode.\r
+  //\r
+  GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SecureBoot, NULL);\r
+  if (SecureBoot != NULL && *SecureBoot == SECURE_BOOT_MODE_ENABLE) {\r
+    ConfigData->SecureBootState = TRUE;\r
+  } else {\r
+    ConfigData->SecureBootState = FALSE;\r
+  }\r
 \r
   //\r
   // Get the SecureBootMode from CustomMode variable.\r