Revision: 18229
http://sourceforge.net/p/edk2/code/18229
Author: jyao1
Date: 2015-08-18 02:11:10 +0000 (Tue, 18 Aug 2015)
Log Message:
-----------
Add restriction that HashFinal() must be after at least one HashUpdate().
Just follow UEFI spec.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <[email protected]>
Reviewed-by: "Zhang, Chao B" <[email protected]>
Modified Paths:
--------------
trunk/edk2/SecurityPkg/Hash2DxeCrypto/Driver.h
trunk/edk2/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
Modified: trunk/edk2/SecurityPkg/Hash2DxeCrypto/Driver.h
===================================================================
--- trunk/edk2/SecurityPkg/Hash2DxeCrypto/Driver.h 2015-08-17 12:02:50 UTC
(rev 18228)
+++ trunk/edk2/SecurityPkg/Hash2DxeCrypto/Driver.h 2015-08-18 02:11:10 UTC
(rev 18229)
@@ -57,6 +57,7 @@
EFI_HASH2_PROTOCOL Hash2Protocol;
VOID *HashContext;
VOID *HashInfoContext;
+ BOOLEAN Updated;
} HASH2_INSTANCE_DATA;
#define HASH2_INSTANCE_DATA_FROM_THIS(a) \
Modified: trunk/edk2/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
===================================================================
--- trunk/edk2/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 2015-08-17
12:02:50 UTC (rev 18228)
+++ trunk/edk2/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 2015-08-18
02:11:10 UTC (rev 18229)
@@ -500,6 +500,7 @@
//
Instance->HashContext = HashCtx;
Instance->HashInfoContext = HashInfo;
+ Instance->Updated = FALSE;
return EFI_SUCCESS;
}
@@ -551,6 +552,8 @@
return EFI_OUT_OF_RESOURCES;
}
+ Instance->Updated = TRUE;
+
return EFI_SUCCESS;
}
@@ -590,7 +593,8 @@
// 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 @@
FreePool (HashCtx);
Instance->HashInfoContext = NULL;
Instance->HashContext = NULL;
+ Instance->Updated = FALSE;
if (!Ret) {
return EFI_OUT_OF_RESOURCES;
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits