From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1DA7F1A1DFE for ; Tue, 20 Sep 2016 03:51:50 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP; 20 Sep 2016 03:51:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,367,1470726000"; d="scan'208";a="11682957" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.9]) by orsmga004.jf.intel.com with ESMTP; 20 Sep 2016 03:51:48 -0700 From: Star Zeng To: edk2-devel@lists.01.org Cc: Jiewen Yao , Chao B Zhang , Star Zeng Date: Tue, 20 Sep 2016 18:51:31 +0800 Message-Id: <1474368693-180984-5-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1474368693-180984-1-git-send-email-star.zeng@intel.com> References: <1474368693-180984-1-git-send-email-star.zeng@intel.com> Subject: [PATCH 4/6] SecuriryPkg/TPM2: Move GetDigestListSize() to Tpm2CommandLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2016 10:51:50 -0000 From: Jiewen Yao 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 --- SecurityPkg/Include/Library/Tpm2CommandLib.h | 13 +++++++++++++ SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c | 26 ++++++++++++++++++++++++++ SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 25 ------------------------- SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 25 ------------------------- 4 files changed, 39 insertions(+), 50 deletions(-) diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h b/SecurityPkg/Include/Library/Tpm2CommandLib.h index 1a837fd11f42..563cfc26e367 100644 --- a/SecurityPkg/Include/Library/Tpm2CommandLib.h +++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h @@ -989,6 +989,19 @@ GetHashSizeFromAlgo ( ); /** + 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 + ); + +/** This function get digest from digest list. @param[in] HashAlg Digest algorithm diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Help.c index 2df18dfe070a..96753b79d5e5 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 diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c index 9080e4703233..4d582c03d4c1 100644 --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c @@ -864,31 +864,6 @@ TcgDxeLogEvent ( } /** - Get TPML_DIGEST_VALUES data size. - - @param[in] DigestList TPML_DIGEST_VALUES data. - - @return TPML_DIGEST_VALUES data size. -**/ -UINT32 -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; -} - -/** Get TPML_DIGEST_VALUES compact binary buffer size. @param[in] DigestListBin TPML_DIGEST_VALUES compact binary buffer. diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c index adc0350a48e3..c67cdffe48a8 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -190,31 +190,6 @@ EndofPeiSignalNotifyCallBack ( } /** - Get TPML_DIGEST_VALUES data size. - - @param[in] DigestList TPML_DIGEST_VALUES data. - - @return TPML_DIGEST_VALUES data size. -**/ -UINT32 -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; -} - -/** Return if hash alg is supported in TPM PCR bank. @param HashAlg Hash algorithm to be checked. -- 2.7.0.windows.1