summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Library/Tpm2CommandLib
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2016-09-14 10:07:45 +0800
committerStar Zeng <star.zeng@intel.com>2016-09-21 18:20:18 +0800
commit77e55cf4e283942766d6178eca375aeec055bff2 (patch)
treecff9a89ca41c3c6a3d98f4c1a38839fb68ebc8aa /SecurityPkg/Library/Tpm2CommandLib
parentf28ab8494664411ac9b3ec22b82d714d8a3ca4c1 (diff)
downloadedk2-77e55cf4e283942766d6178eca375aeec055bff2.tar.gz
edk2-77e55cf4e283942766d6178eca375aeec055bff2.tar.bz2
edk2-77e55cf4e283942766d6178eca375aeec055bff2.zip
SecurityPkg/TPM2: Move GetDigestListSize() to Tpm2CommandLib
This patch just moves function GetDigestListSize() from drivers to library and no functionality change. Cc: Chao B Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Diffstat (limited to 'SecurityPkg/Library/Tpm2CommandLib')
-rw-r--r--SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c26
1 files changed, 26 insertions, 0 deletions
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
@@ -166,6 +166,32 @@ CopyAuthSessionResponse (
}
/**
+ 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.
@param[in] HashAlg Digest algorithm