Topics

[PATCH v6 0/2] Add Unit Tests for BaseCryptLib to CryptoPkg


Matthew Carlson
 

From: Matthew Carlson <matthewfcarlson@...>

This turns adds Host Based Unit Tests for CryptoPkg, adds a new BaseCryptLib
implementation that is meant for unit testing and turns on HBUT for CryptoPkg
CI.

Changes for V6:
Told ECC to ignore unit test and new CRT wrapper

Changes for V5:
Remove BaseTimerLibPosix as it is no longer needed
Cleaned up a bit of the documentation around the tests

Cc: Jian J Wang <jian.j.wang@...>
Cc: Xiaoyu Lu <xiaoyux.lu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Guomin Jiang <guomin.jiang@...>
Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>

*** BLURB HERE ***

Matthew Carlson (2):
CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)
AzurePipelines : Pr Gate: Turn on HBUT for CryptoPkg

CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c | 93 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c | 1002 ++++++++++++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c | 66 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c | 293 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c | 106 +++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c | 197 ++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c | 184 ++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c | 308 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c | 71 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c | 524 ++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c | 51 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c | 415 ++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c | 310 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c | 335 +++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c | 81 ++
.azurepipelines/templates/pr-gate-build-job.yml | 2 +-
CryptoPkg/CryptoPkg.ci.yaml | 8 +
CryptoPkg/CryptoPkg.dsc | 23 +
CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf | 90 ++
CryptoPkg/Test/CryptoPkgHostUnitTest.dsc | 35 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h | 789 +++++++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h | 121 +++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf | 46 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf | 49 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/ChainCreationInstructions.txt | 92 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/CreateTestCerts.cmd | 11 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/SignFirmwareWithEKUs.cmd | 76 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingIssuingCA.ini | 45 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSigner.ini | 25 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid1.ini | 24 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid12345.ini | 27 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingNoEKUsInSigner.ini | 16 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingPolicyCA.ini | 28 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingRoot.ini | 28 +
34 files changed, 5570 insertions(+), 1 deletion(-)
create mode 100644 CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
create mode 100644 CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
create mode 100644 CryptoPkg/Test/CryptoPkgHostUnitTest.dsc
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/ChainCreationInstructions.txt
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/CreateTestCerts.cmd
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/SignFirmwareWithEKUs.cmd
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingIssuingCA.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSigner.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid1.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid12345.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingNoEKUsInSigner.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingPolicyCA.ini
create mode 100644 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingRoot.ini

--
2.28.0.vfs.0.0


Yao, Jiewen
 

Pushed.
https://github.com/tianocore/edk2/pull/1026
git-hash: 694bfd6ff5b9a8352b4ca8634ed4ce449f505991, 73e3cb6c7eea4f5db81c87574dcefe1282de4772

-----Original Message-----
From: matthewfcarlson@... <matthewfcarlson@...>
Sent: Friday, October 9, 2020 6:38 AM
To: devel@edk2.groups.io
Cc: Wang, Jian J <jian.j.wang@...>; Lu, XiaoyuX
<xiaoyux.lu@...>; Yao, Jiewen <jiewen.yao@...>; Jiang,
Guomin <guomin.jiang@...>; Sean Brogan
<sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Kinney, Michael D
<michael.d.kinney@...>; Liming Gao <liming.gao@...>
Subject: [PATCH v6 0/2] Add Unit Tests for BaseCryptLib to CryptoPkg

From: Matthew Carlson <matthewfcarlson@...>

This turns adds Host Based Unit Tests for CryptoPkg, adds a new
BaseCryptLib
implementation that is meant for unit testing and turns on HBUT for
CryptoPkg
CI.

Changes for V6:
Told ECC to ignore unit test and new CRT wrapper

Changes for V5:
Remove BaseTimerLibPosix as it is no longer needed
Cleaned up a bit of the documentation around the tests

Cc: Jian J Wang <jian.j.wang@...>
Cc: Xiaoyu Lu <xiaoyux.lu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Guomin Jiang <guomin.jiang@...>
Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>

*** BLURB HERE ***

Matthew Carlson (2):
CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)
AzurePipelines : Pr Gate: Turn on HBUT for CryptoPkg

CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
| 93 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
| 1002 ++++++++++++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
| 66 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
| 293 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
| 106 +++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
| 197 ++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
| 184 ++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
| 308 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
| 71 ++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
| 524 ++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
| 51 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
| 415 ++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
| 310 ++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
| 335 +++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
| 81 ++
.azurepipelines/templates/pr-gate-build-job.yml
| 2 +-
CryptoPkg/CryptoPkg.ci.yaml | 8 +
CryptoPkg/CryptoPkg.dsc | 23 +
CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
| 90 ++
CryptoPkg/Test/CryptoPkgHostUnitTest.dsc
| 35 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
| 789 +++++++++++++++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
| 121 +++
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf
| 46 +
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf
| 49 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/ChainCreationI
nstructions.txt | 92 ++

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/CreateTestCert
s.cmd | 11 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/SignFirmwareW
ithEKUs.cmd | 76 ++

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
IssuingCA.ini | 45 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSigner.ini | 25 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSignerPid1.ini | 24 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSignerPid12345.ini | 27 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
NoEKUsInSigner.ini | 16 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
PolicyCA.ini | 28 +

CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
Root.ini | 28 +
34 files changed, 5570 insertions(+), 1 deletion(-)
create mode 100644
CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
create mode 100644
CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
create mode 100644 CryptoPkg/Test/CryptoPkgHostUnitTest.dsc
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/ChainCreationI
nstructions.txt
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/CreateTestCert
s.cmd
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/SignFirmwareW
ithEKUs.cmd
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
IssuingCA.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSigner.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSignerPid1.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
LeafSignerPid12345.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
NoEKUsInSigner.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
PolicyCA.ini
create mode 100644
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsing
Root.ini

--
2.28.0.vfs.0.0