summaryrefslogtreecommitdiff
path: root/SecurityPkg/VariableAuthenticated/Pei
diff options
context:
space:
mode:
Diffstat (limited to 'SecurityPkg/VariableAuthenticated/Pei')
-rw-r--r--SecurityPkg/VariableAuthenticated/Pei/Variable.c9
-rw-r--r--SecurityPkg/VariableAuthenticated/Pei/Variable.h1
-rw-r--r--SecurityPkg/VariableAuthenticated/Pei/VariablePei.inf1
3 files changed, 11 insertions, 0 deletions
diff --git a/SecurityPkg/VariableAuthenticated/Pei/Variable.c b/SecurityPkg/VariableAuthenticated/Pei/Variable.c
index 7549be2dca..d27f679073 100644
--- a/SecurityPkg/VariableAuthenticated/Pei/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/Pei/Variable.c
@@ -359,6 +359,15 @@ GetVariableStore (
PcdGet64 (PcdFlashNvStorageVariableBase64) :
PcdGet32 (PcdFlashNvStorageVariableBase)
);
+
+ //
+ // Check if the Firmware Volume is not corrupted
+ //
+ if ((FvHeader->Signature != EFI_FVH_SIGNATURE) || (!CompareGuid (&gEfiSystemNvDataFvGuid, &FvHeader->FileSystemGuid))) {
+ DEBUG ((EFI_D_ERROR, "Firmware Volume for Variable Store is corrupted\n"));
+ break;
+ }
+
VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINT8 *) FvHeader + FvHeader->HeaderLength);
if (IndexTable != NULL) {
diff --git a/SecurityPkg/VariableAuthenticated/Pei/Variable.h b/SecurityPkg/VariableAuthenticated/Pei/Variable.h
index 75d32dac5f..a85d3bbab6 100644
--- a/SecurityPkg/VariableAuthenticated/Pei/Variable.h
+++ b/SecurityPkg/VariableAuthenticated/Pei/Variable.h
@@ -29,6 +29,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/AuthenticatedVariableFormat.h>
#include <Guid/VariableIndexTable.h>
+#include <Guid/SystemNvDataGuid.h>
typedef enum {
VariableStoreTypeHob,
diff --git a/SecurityPkg/VariableAuthenticated/Pei/VariablePei.inf b/SecurityPkg/VariableAuthenticated/Pei/VariablePei.inf
index 7863293ff8..e74143cd19 100644
--- a/SecurityPkg/VariableAuthenticated/Pei/VariablePei.inf
+++ b/SecurityPkg/VariableAuthenticated/Pei/VariablePei.inf
@@ -46,6 +46,7 @@
[Guids]
gEfiAuthenticatedVariableGuid
gEfiVariableIndexTableGuid
+ gEfiSystemNvDataFvGuid
[Ppis]
gEfiPeiReadOnlyVariable2PpiGuid ## SOMETIMES_PRODUCES (Not for boot mode RECOVERY)