summaryrefslogtreecommitdiff
path: root/SecurityPkg/Tcg
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-09-07 01:00:49 +0000
committerhwu1225 <hwu1225@Edk2>2015-09-07 01:00:49 +0000
commit75e4a0767e964a05987da4dce0f75de166636517 (patch)
tree2b46fcfe7f6a0b957b40f750d590d55b2e9157b4 /SecurityPkg/Tcg
parent7027b268bf1887f7393487574dba309fda84bb74 (diff)
downloadedk2-platforms-75e4a0767e964a05987da4dce0f75de166636517.tar.xz
SecurityPkg: Use pointer instead of array to make code readable.
(Sync patch r18403 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Yao Jiewen <Jiewen.Yao@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18407 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/Tcg')
-rw-r--r--SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index 56a8613c59..9ad970a47b 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -1456,6 +1456,7 @@ SetupEventLog (
UINT8 TempBuf[sizeof(TCG_EfiSpecIDEventStruct) + (HASH_COUNT * sizeof(TCG_EfiSpecIdEventAlgorithmSize)) + sizeof(UINT8)];
TCG_PCR_EVENT_HDR FirstPcrEvent;
TCG_EfiSpecIdEventAlgorithmSize *DigestSize;
+ TCG_EfiSpecIdEventAlgorithmSize *TempDigestSize;
UINT8 *VendorInfoSize;
UINT32 NumberOfAlgorithms;
@@ -1501,32 +1502,44 @@ SetupEventLog (
NumberOfAlgorithms = 0;
DigestSize = (TCG_EfiSpecIdEventAlgorithmSize *)((UINT8 *)TcgEfiSpecIdEventStruct + sizeof(*TcgEfiSpecIdEventStruct) + sizeof(NumberOfAlgorithms));
if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA1) != 0) {
- DigestSize[NumberOfAlgorithms].algorithmId = TPM_ALG_SHA1;
- DigestSize[NumberOfAlgorithms].digestSize = SHA1_DIGEST_SIZE;
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ TempDigestSize->algorithmId = TPM_ALG_SHA1;
+ TempDigestSize->digestSize = SHA1_DIGEST_SIZE;
NumberOfAlgorithms++;
}
if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
- DigestSize[NumberOfAlgorithms].algorithmId = TPM_ALG_SHA256;
- DigestSize[NumberOfAlgorithms].digestSize = SHA256_DIGEST_SIZE;
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ TempDigestSize->algorithmId = TPM_ALG_SHA256;
+ TempDigestSize->digestSize = SHA256_DIGEST_SIZE;
NumberOfAlgorithms++;
}
if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
- DigestSize[NumberOfAlgorithms].algorithmId = TPM_ALG_SHA384;
- DigestSize[NumberOfAlgorithms].digestSize = SHA384_DIGEST_SIZE;
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ TempDigestSize->algorithmId = TPM_ALG_SHA384;
+ TempDigestSize->digestSize = SHA384_DIGEST_SIZE;
NumberOfAlgorithms++;
}
if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
- DigestSize[NumberOfAlgorithms].algorithmId = TPM_ALG_SHA512;
- DigestSize[NumberOfAlgorithms].digestSize = SHA512_DIGEST_SIZE;
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ TempDigestSize->algorithmId = TPM_ALG_SHA512;
+ TempDigestSize->digestSize = SHA512_DIGEST_SIZE;
NumberOfAlgorithms++;
}
if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
- DigestSize[NumberOfAlgorithms].algorithmId = TPM_ALG_SM3_256;
- DigestSize[NumberOfAlgorithms].digestSize = SM3_256_DIGEST_SIZE;
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ TempDigestSize->algorithmId = TPM_ALG_SM3_256;
+ TempDigestSize->digestSize = SM3_256_DIGEST_SIZE;
NumberOfAlgorithms++;
}
CopyMem (TcgEfiSpecIdEventStruct + 1, &NumberOfAlgorithms, sizeof(NumberOfAlgorithms));
- VendorInfoSize = (UINT8 *)&DigestSize[NumberOfAlgorithms];
+ TempDigestSize = DigestSize;
+ TempDigestSize += NumberOfAlgorithms;
+ VendorInfoSize = (UINT8 *)TempDigestSize;
*VendorInfoSize = 0;
//