From 77e55cf4e283942766d6178eca375aeec055bff2 Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Wed, 14 Sep 2016 10:07:45 +0800 Subject: SecurityPkg/TPM2: Move GetDigestListSize() to Tpm2CommandLib This patch just moves function GetDigestListSize() from drivers to library and no functionality change. Cc: Chao B Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Signed-off-by: Star Zeng Reviewed-by: Chao Zhang --- SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c') diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c index 2df18dfe07..96753b79d5 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c @@ -165,6 +165,32 @@ CopyAuthSessionResponse ( return (UINT32)(UINTN)(Buffer - (UINT8 *)AuthSessionIn); } +/** + Get TPML_DIGEST_VALUES data size. + + @param[in] DigestList TPML_DIGEST_VALUES data. + + @return TPML_DIGEST_VALUES data size. +**/ +UINT32 +EFIAPI +GetDigestListSize ( + IN TPML_DIGEST_VALUES *DigestList + ) +{ + UINTN Index; + UINT16 DigestSize; + UINT32 TotalSize; + + TotalSize = sizeof(DigestList->count); + for (Index = 0; Index < DigestList->count; Index++) { + DigestSize = GetHashSizeFromAlgo (DigestList->digests[Index].hashAlg); + TotalSize += sizeof(DigestList->digests[Index].hashAlg) + DigestSize; + } + + return TotalSize; +} + /** This function get digest from digest list. -- cgit v1.2.3