[edk2-devel] [Patch v2][edk2-stable202011 4/4] CryptoPkg/Test/UnitTest/Library/BaseCryptLib: Fix MD5 Hash tests

Gao, Zhichao zhichao.gao at intel.com
Wed Nov 25 07:31:02 UTC 2020


The patch would disable the MD5 test. Do we need to enable it in the test dsc?

Anyway, Reviewed-by: Zhichao Gao <zhichao.gao at intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Michael D
> Kinney
> Sent: Wednesday, November 25, 2020 1:08 PM
> To: devel at edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao at intel.com>; Wang, Jian J <jian.j.wang at intel.com>;
> Lu, XiaoyuX <xiaoyux.lu at intel.com>; Jiang, Guomin <guomin.jiang at intel.com>
> Subject: [edk2-devel] [Patch v2][edk2-stable202011 4/4]
> CryptoPkg/Test/UnitTest/Library/BaseCryptLib: Fix MD5 Hash tests
> 
> Only include MD5 unit tests if ENABLE_MD5_DEPRECATED_INTERFACES is
> defined.
> 
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Xiaoyu Lu <xiaoyux.lu at intel.com>
> Cc: Guomin Jiang <guomin.jiang at intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney at intel.com>
> ---
>  CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
> b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
> index bc47c5736246..24919053324a 100644
> --- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
> +++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
> @@ -21,10 +21,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8
> *HashData = "abc";  //  // Result for MD5("abc"). (From "A.5 Test suite" of IETF
> RFC1321)  //
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>  GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8
> Md5Digest[MD5_DIGEST_SIZE] = {
>    0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d, 0x28,
> 0xe1, 0x7f, 0x72
> -
>    };
> +#endif
> 
>  //
>  // Result for SHA-1("abc"). (From "A.1 SHA-1 Example" of NIST FIPS 180-2) @@ -
> 107,7 +108,9 @@ typedef struct {
>    VOID                       *HashCtx;
>  } HASH_TEST_CONTEXT;
> 
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>  HASH_TEST_CONTEXT       mMd5TestCtx    = {MD5_DIGEST_SIZE,
> Md5GetContextSize,    Md5Init,    Md5Update,    Md5Final,    Md5HashAll,
> Md5Digest};
> +#endif
>  HASH_TEST_CONTEXT       mSha1TestCtx   = {SHA1_DIGEST_SIZE,
> Sha1GetContextSize,   Sha1Init,   Sha1Update,   Sha1Final,   Sha1HashAll,
> Sha1Digest};
>  HASH_TEST_CONTEXT       mSha256TestCtx = {SHA256_DIGEST_SIZE,
> Sha256GetContextSize, Sha256Init, Sha256Update, Sha256Final, Sha256HashAll,
> Sha256Digest};
>  HASH_TEST_CONTEXT       mSha384TestCtx = {SHA384_DIGEST_SIZE,
> Sha384GetContextSize, Sha384Init, Sha384Update, Sha384Final, Sha384HashAll,
> Sha384Digest};
> @@ -187,7 +190,9 @@ TEST_DESC mHashTest[] = {
>      //
>      // -----Description----------------Class---------------------Function---------------
> Pre------------------Post------------Context
>      //
> +#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
>      {"TestVerifyMd5()",    "CryptoPkg.BaseCryptLib.Hash",   TestVerifyHash,
> TestVerifyHashPreReq, TestVerifyHashCleanUp, &mMd5TestCtx},
> +#endif
>      {"TestVerifySha1()",   "CryptoPkg.BaseCryptLib.Hash",   TestVerifyHash,
> TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha1TestCtx},
>      {"TestVerifySha256()", "CryptoPkg.BaseCryptLib.Hash",   TestVerifyHash,
> TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha256TestCtx},
>      {"TestVerifySha384()", "CryptoPkg.BaseCryptLib.Hash",   TestVerifyHash,
> TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha384TestCtx},
> --
> 2.29.2.windows.2
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67941): https://edk2.groups.io/g/devel/message/67941
Mute This Topic: https://groups.io/mt/78494334/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list