In CopyDigestListToBuffer() of Tpm2CommandLib, the count in returned
Buffer should be real copied DigestList count.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
{\r
UINTN Index;\r
UINT16 DigestSize;\r
{\r
UINTN Index;\r
UINT16 DigestSize;\r
+ UINT32 DigestListCount;\r
+ UINT32 *DigestListCountPtr;\r
- CopyMem (Buffer, &DigestList->count, sizeof(DigestList->count));\r
+ DigestListCountPtr = (UINT32 *) Buffer;\r
+ DigestListCount = 0;\r
Buffer = (UINT8 *)Buffer + sizeof(DigestList->count);\r
for (Index = 0; Index < DigestList->count; Index++) {\r
if (!IsHashAlgSupportedInHashAlgorithmMask(DigestList->digests[Index].hashAlg, HashAlgorithmMask)) {\r
Buffer = (UINT8 *)Buffer + sizeof(DigestList->count);\r
for (Index = 0; Index < DigestList->count; Index++) {\r
if (!IsHashAlgSupportedInHashAlgorithmMask(DigestList->digests[Index].hashAlg, HashAlgorithmMask)) {\r
DigestSize = GetHashSizeFromAlgo (DigestList->digests[Index].hashAlg);\r
CopyMem (Buffer, &DigestList->digests[Index].digest, DigestSize);\r
Buffer = (UINT8 *)Buffer + DigestSize;\r
DigestSize = GetHashSizeFromAlgo (DigestList->digests[Index].hashAlg);\r
CopyMem (Buffer, &DigestList->digests[Index].digest, DigestSize);\r
Buffer = (UINT8 *)Buffer + DigestSize;\r
+ WriteUnaligned32 (DigestListCountPtr, DigestListCount);\r