diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-09-06 06:22:24 +0000 |
---|---|---|
committer | shenshushi <shenshushi@Edk2> | 2015-09-06 06:22:24 +0000 |
commit | 35e00ace19c108a56f3375bae6eed9d1a8e7f94f (patch) | |
tree | 7b5c3606f7fdfcdf86664568b65d80936658767e /SecurityPkg/Tcg | |
parent | 374ecd04505e028c2eba3f8368f7cd7079c7669f (diff) | |
download | edk2-35e00ace19c108a56f3375bae6eed9d1a8e7f94f.zip edk2-35e00ace19c108a56f3375bae6eed9d1a8e7f94f.tar.gz edk2-35e00ace19c108a56f3375bae6eed9d1a8e7f94f.tar.bz2 |
SecurityPkg: Use pointer instead of array to make code readable.
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/trunk/edk2@18403 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/Tcg')
-rw-r--r-- | SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c index 56a8613..9ad970a 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;
//
|