From nobody Tue Feb 10 19:14:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+94997+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94997+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1665500687; cv=none; d=zohomail.com; s=zohoarc; b=g+it1zpryv3UaF2j0rNJtNGvGJ/261n9GzB0XemXAoULtGt1CBVjxHveB7WTmR8QGU3/P2iSAvdXNE7hWic9UPVHPzxtBmeoGZUN4G2PN7V8y8ooDa8cPobw7snu40mURC6z/DwN5EGa1H2huQZCGAXyJjNSaIj0HC+FMjur0V4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665500687; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=MtvAMFD56dY6a7AO0FbXjTZDTdgW+DljWLWTuRCQDf0=; b=lksLM3y3VwZydV+S5d0aWnHa/zlAPxNN5C7qcs0x0mXHIcr5d6MYMh4P6OEzKvkdfBtkKlzOapbJFabPhNq7J3GIviwy3tu7ba/ZpkL3i4Ij98K2QkA01BX29JWOCbZVfK2tGeaBDYqRkUEwUe22zTg/AAc+69+RNiHZfjKcyZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+94997+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1665500687630808.1530321710123; Tue, 11 Oct 2022 08:04:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XRs8YY1788612xZ7G4MJ6s6t; Tue, 11 Oct 2022 08:04:44 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web08.8432.1665500682958145987 for ; Tue, 11 Oct 2022 08:04:43 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="305581045" X-IronPort-AV: E=Sophos;i="5.95,176,1661842800"; d="scan'208";a="305581045" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2022 08:04:07 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="604172817" X-IronPort-AV: E=Sophos;i="5.95,176,1661842800"; d="scan'208";a="604172817" X-Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.79.249]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2022 08:04:07 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Xiaoyu Lu , Guomin Jiang , Christopher Zurcher Subject: [edk2-devel] [Patch 04/12] CryptoPkg/Test/UnitTest/Library/BaseCryptLib: Unit test fixes Date: Tue, 11 Oct 2022 08:03:50 -0700 Message-Id: <20221011150358.1332-5-michael.d.kinney@intel.com> In-Reply-To: <20221011150358.1332-1-michael.d.kinney@intel.com> References: <20221011150358.1332-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: 1uCdUjhzdHj3KMw29wJy7SAkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1665500684; bh=hpbXlVcC5XtcccXKMWBGjYIE4L8w8sW0IpiGtAb3kRk=; h=Cc:Date:From:Reply-To:Subject:To; b=EX0yGHUWqqzzMnDJN9VhCaYWn0Kq/SCUrp3PJokMUzxk+qoy0waJTSIeXGLfvLZpMV+ ERjGcPO1rHGqCnt4D7625NNxCOt7kPurpVT4Qt9v/doBBPrpE6RNzbN39JmKWzf+O7hi7 8RRyidGSvRhm6dy7yuqAD9mZLU0W4wWiz5k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1665500690960100001 Content-Type: text/plain; charset="utf-8" * Update ImageTimeStampTest to return UNIT_TEST_PASSED instead of Status. On success Status is TRUE(1), which was returning a unit test status of UNIT_TEST_ERROR_PREREQUISITE_NOT_MET. * Update HmacTests to use the *Free() service from the HMAC family instead of FreePool(). Using FreePool() generates ASSERT() because the context being freed was not allocated using AllocatePool(). Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang Cc: Christopher Zurcher Signed-off-by: Michael D Kinney --- .../UnitTest/Library/BaseCryptLib/HmacTests.c | 17 ++++++++++++----- .../UnitTest/Library/BaseCryptLib/TSTests.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c b/Cry= ptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c index 9c5b39410d0f..b347cb4cb4f8 100644 --- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c +++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c @@ -87,6 +87,12 @@ VOID * VOID ); =20 +typedef +VOID +(EFIAPI *EFI_HMAC_FREE)( + IN VOID *HashContext + ); + typedef BOOLEAN (EFIAPI *EFI_HMAC_INIT)( @@ -113,6 +119,7 @@ BOOLEAN typedef struct { UINT32 DigestSize; EFI_HMAC_NEW HmacNew; + EFI_HMAC_FREE HmacFree; EFI_HMAC_INIT HmacInit; EFI_HMAC_UPDATE HmacUpdate; EFI_HMAC_FINAL HmacFinal; @@ -123,10 +130,10 @@ typedef struct { } HMAC_TEST_CONTEXT; =20 // These functions have been deprecated but they've been left commented ou= t for future reference -// HMAC_TEST_CONTEXT mHmacMd5TestCtx =3D {MD5_DIGEST_SIZE, Hma= cMd5New, HmacMd5SetKey, HmacMd5Update, HmacMd5Final, HmacMd5Key= , sizeof(HmacMd5Key), HmacMd5Digest}; -// HMAC_TEST_CONTEXT mHmacSha1TestCtx =3D {SHA1_DIGEST_SIZE, Hma= cSha1New, HmacSha1SetKey, HmacSha1Update, HmacSha1Final, HmacSha1Ke= y, sizeof(HmacSha1Key), HmacSha1Digest}; -HMAC_TEST_CONTEXT mHmacSha256TestCtx =3D { SHA256_DIGEST_SIZE, HmacSha256= New, HmacSha256SetKey, HmacSha256Update, HmacSha256Final, HmacSha256Key, si= zeof (HmacSha256Key), HmacSha256Digest }; -HMAC_TEST_CONTEXT mHmacSha384TestCtx =3D { SHA384_DIGEST_SIZE, HmacSha384= New, HmacSha384SetKey, HmacSha384Update, HmacSha384Final, HmacSha384Key, si= zeof (HmacSha384Key), HmacSha384Digest }; +// HMAC_TEST_CONTEXT mHmacMd5TestCtx =3D {MD5_DIGEST_SIZE, Hma= cMd5New, HmacMd5Free, HmacMd5SetKey, HmacMd5Update, HmacMd5Final,= HmacMd5Key, sizeof(HmacMd5Key), HmacMd5Digest}; +// HMAC_TEST_CONTEXT mHmacSha1TestCtx =3D {SHA1_DIGEST_SIZE, Hma= cSha1New, HmacSha1Free, HmacSha1SetKey, HmacSha1Update, HmacSha1Final= , HmacSha1Key, sizeof(HmacSha1Key), HmacSha1Digest}; +HMAC_TEST_CONTEXT mHmacSha256TestCtx =3D { SHA256_DIGEST_SIZE, HmacSha256= New, HmacSha256Free, HmacSha256SetKey, HmacSha256Update, HmacSha256Final, H= macSha256Key, sizeof (HmacSha256Key), HmacSha256Digest }; +HMAC_TEST_CONTEXT mHmacSha384TestCtx =3D { SHA384_DIGEST_SIZE, HmacSha384= New, HmacSha384Free, HmacSha384SetKey, HmacSha384Update, HmacSha384Final, H= macSha384Key, sizeof (HmacSha384Key), HmacSha384Digest }; =20 UNIT_TEST_STATUS EFIAPI @@ -155,7 +162,7 @@ TestVerifyHmacCleanUp ( =20 HmacTestContext =3D Context; if (HmacTestContext->HmacCtx !=3D NULL) { - FreePool (HmacTestContext->HmacCtx); + HmacTestContext->HmacFree (HmacTestContext->HmacCtx); } } =20 diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c b/Crypt= oPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c index 225ec3e59746..226e57e66f04 100644 --- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c +++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c @@ -322,7 +322,7 @@ TestVerifyImageTimestampVerify ( UT_ASSERT_EQUAL (SigningTime.Minute, 50); UT_ASSERT_EQUAL (SigningTime.Second, 3); =20 - return Status; + return UNIT_TEST_PASSED; } =20 TEST_DESC mImageTimestampTest[] =3D { --=20 2.37.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94997): https://edk2.groups.io/g/devel/message/94997 Mute This Topic: https://groups.io/mt/94260736/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-