From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.5316.1662539380536338594 for ; Wed, 07 Sep 2022 01:29:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=jPRXQWT3; spf=permerror, err=too many SPF records (domain: intel.com, ip: 192.55.52.115, mailfrom: yi1.li@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662539380; x=1694075380; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Z3xcvv97U51xSO/S5e5x8Qy5KUF3yw/4Ml/hInZXS5w=; b=jPRXQWT38ygnpQclUSIfLvc7Ybgyjslu11dKssqwyawjd7cDEAftw8f4 9+76pnabapzZDojRlZaJXXozoXxB8rF8+KYVmrFGDyawgDD9IuywdX4LR pfpoY53z1aGrHZFX7kKFteETg/SbLhUwpo93ROrXPKf0ZBvDMlNcuw6lD xRmIvDFT6yJptwS1lV7Ozqpm5wR/L9siokd9UwWi5e0x3VX99ix2hFF8q 3U+LMfC4UT+1/eqF/aFZOScWVql/ahpdLvCDWkisbBKMD5KlNlFUq+45W Kpolb53PCp0XSUZBgsZI0kgGO+aYJGcewuTErzQlwn1nSu2X0EV2wDBAb w==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="296814311" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="296814311" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 01:29:39 -0700 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="591599646" Received: from liyi4-desktop.ccr.corp.intel.com ([10.239.153.82]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 01:29:37 -0700 From: "yi1 li" To: devel@edk2.groups.io Cc: Yi Li , Jiewen Yao , Jian J Wang , Xiaoyu Lu , Guomin Jiang Subject: [PATCH 0/7] CryptoPkg: Add BigNum and EC support to BaseCryptLib Date: Wed, 7 Sep 2022 16:29:17 +0800 Message-Id: X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3828 Review PR: https://github.com/tianocore/edk2/pull/3309 This patch sequence is used to add CryptBn and CryptEc library, which are wrapped over OpenSSL. The implementation provides library functions for EFI BaseCrypt protocol and EFI BaseCrypt Configuration Protocol. All APIs passed unit test and fuzzing test, detail as: 1. Unit test: The purpose of unit testing is to ensure that the function obtains the expected result under specific input, that is, to ensure the correctness of APIs. All test case show in patch 5 and patch 6: CryptoPkg/Test: Add unit test for CryptoBn CryptoPkg/Test: Add unit test for CryptoEc 2. Fuzzing test: Various Fuzz Testing are employed across the all introduced APIs, and the test is used AFL (2.52b) and Libfuzzer (clang+llvm-11.0.0) as the fuzzer, based on HBFA. Fuzzing Pass Rate is 100%; The Code Coverage of CryptBn is 100%; The Code Coverage of CryptEc is 90.3%. All test case show in: https://github.com/liyi77/edk2-staging/tree/HBFA/HBFA/UefiHostFuzzTestCasePkg/TestCase/CryptoPkg Tested-by: Yi Li Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang Signed-off-by: Yi Li Yi Li (7): CryptoPkg: Add BigNum support CryptoPkg: Add BigNum API to DXE and protocol CryptoPkg: Add EC support CryptoPkg: Add EC APIs to DXE and protocol CryptoPkg/Test: Add unit test for CryptoBn CryptoPkg/Test: Add unit test for CryptoEc CryptoPkg: Run uncrustify tools on EC and BN change CryptoPkg/CryptoPkg.dsc | 2 + CryptoPkg/Driver/Crypto.c | 1016 +++++++++++++- CryptoPkg/Include/Library/BaseCryptLib.h | 842 ++++++++++++ .../Pcd/PcdCryptoServiceFamilyEnable.h | 55 + .../Library/BaseCryptLib/BaseCryptLib.inf | 3 + CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c | 581 ++++++++ .../Library/BaseCryptLib/Bn/CryptBnNull.c | 520 ++++++++ .../Library/BaseCryptLib/PeiCryptLib.inf | 2 + CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c | 765 +++++++++++ .../Library/BaseCryptLib/Pk/CryptEcNull.c | 496 +++++++ .../Library/BaseCryptLib/SmmCryptLib.inf | 2 + .../BaseCryptLib/UnitTestHostBaseCryptLib.inf | 3 + .../BaseCryptLibNull/BaseCryptLibNull.inf | 2 + .../Library/BaseCryptLibNull/Bn/CryptBnNull.c | 520 ++++++++ .../Library/BaseCryptLibNull/Pk/CryptEcNull.c | 496 +++++++ .../BaseCryptLibOnProtocolPpi/CryptLib.c | 961 ++++++++++++++ CryptoPkg/Private/Protocol/Crypto.h | 1176 ++++++++++++++--- CryptoPkg/Test/CryptoPkgHostUnitTest.dsc | 3 + .../BaseCryptLib/BaseCryptLibUnitTests.c | 2 + .../UnitTest/Library/BaseCryptLib/BnTests.c | 266 ++++ .../UnitTest/Library/BaseCryptLib/EcTests.c | 290 ++++ .../Library/BaseCryptLib/TestBaseCryptLib.h | 5 + .../BaseCryptLib/TestBaseCryptLibHost.inf | 2 + .../BaseCryptLib/TestBaseCryptLibShell.inf | 2 + 24 files changed, 7852 insertions(+), 160 deletions(-) create mode 100644 CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c create mode 100644 CryptoPkg/Library/BaseCryptLib/Bn/CryptBnNull.c create mode 100644 CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c create mode 100644 CryptoPkg/Library/BaseCryptLib/Pk/CryptEcNull.c create mode 100644 CryptoPkg/Library/BaseCryptLibNull/Bn/CryptBnNull.c create mode 100644 CryptoPkg/Library/BaseCryptLibNull/Pk/CryptEcNull.c create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BnTests.c create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/EcTests.c -- 2.31.1.windows.1