summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Hash2DxeCrypto
diff options
context:
space:
mode:
Diffstat (limited to 'SecurityPkg/Hash2DxeCrypto')
-rw-r--r--SecurityPkg/Hash2DxeCrypto/Driver.h1
-rw-r--r--SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/SecurityPkg/Hash2DxeCrypto/Driver.h b/SecurityPkg/Hash2DxeCrypto/Driver.h
index 771aedc1ed..a145858fa0 100644
--- a/SecurityPkg/Hash2DxeCrypto/Driver.h
+++ b/SecurityPkg/Hash2DxeCrypto/Driver.h
@@ -57,6 +57,7 @@ typedef struct {
EFI_HASH2_PROTOCOL Hash2Protocol;
VOID *HashContext;
VOID *HashInfoContext;
+ BOOLEAN Updated;
} HASH2_INSTANCE_DATA;
#define HASH2_INSTANCE_DATA_FROM_THIS(a) \
diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
index 94057ab2e1..ab34de7351 100644
--- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
+++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
@@ -500,6 +500,7 @@ BaseCrypto2HashInit (
//
Instance->HashContext = HashCtx;
Instance->HashInfoContext = HashInfo;
+ Instance->Updated = FALSE;
return EFI_SUCCESS;
}
@@ -551,6 +552,8 @@ BaseCrypto2HashUpdate (
return EFI_OUT_OF_RESOURCES;
}
+ Instance->Updated = TRUE;
+
return EFI_SUCCESS;
}
@@ -590,7 +593,8 @@ BaseCrypto2HashFinal (
// Consistency Check
//
Instance = HASH2_INSTANCE_DATA_FROM_THIS(This);
- if ((Instance->HashContext == NULL) || (Instance->HashInfoContext == NULL)) {
+ if ((Instance->HashContext == NULL) || (Instance->HashInfoContext == NULL) ||
+ (!Instance->Updated)) {
return EFI_NOT_READY;
}
HashInfo = Instance->HashInfoContext;
@@ -604,6 +608,7 @@ BaseCrypto2HashFinal (
FreePool (HashCtx);
Instance->HashInfoContext = NULL;
Instance->HashContext = NULL;
+ Instance->Updated = FALSE;
if (!Ret) {
return EFI_OUT_OF_RESOURCES;