summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Test/UnitTest
diff options
context:
space:
mode:
authorWenxing Hou <wenxing.hou@intel.com>2023-08-16 12:39:51 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-10-12 05:31:19 +0000
commit97f51f2e9b78ce94127c2972841342edaefbcc80 (patch)
treee64b16919815256da1676010c702ffe5069db8a7 /CryptoPkg/Test/UnitTest
parent60222e7eb90e81459a198a6cab3239a446229b1d (diff)
downloadedk2-97f51f2e9b78ce94127c2972841342edaefbcc80.tar.gz
edk2-97f51f2e9b78ce94127c2972841342edaefbcc80.tar.bz2
edk2-97f51f2e9b78ce94127c2972841342edaefbcc80.zip
CryptoPkg: Add RSA functions based on Mbedtls
Add RSA APIs. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4177 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Yi Li <yi1.li@intel.com> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Signed-off-by: Wenxing Hou <wenxing.hou@intel.com> Reviewed-by: Yi Li <yi1.li@intel.com>
Diffstat (limited to 'CryptoPkg/Test/UnitTest')
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
index 3f06e89b3c..c61f2da73d 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
@@ -194,6 +194,9 @@ TestVerifyRsaGenerateKeyComponents (
BOOLEAN Status;
UINTN KeySize;
UINT8 *KeyBuffer;
+ UINT8 TestPublicExponent1[] = { 0x03 };
+ UINT8 TestPublicExponent2[] = { 0x01, 0x01 };
+ UINT8 TestPublicExponent3[] = { 0x01, 0x00, 0x01 };
//
// Generate RSA Key Components
@@ -202,6 +205,13 @@ TestVerifyRsaGenerateKeyComponents (
Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, NULL, 0);
UT_ASSERT_TRUE (Status);
+ Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, TestPublicExponent1, sizeof (TestPublicExponent1));
+ UT_ASSERT_TRUE (Status);
+ Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, TestPublicExponent2, sizeof (TestPublicExponent2));
+ UT_ASSERT_TRUE (Status);
+ Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, TestPublicExponent3, sizeof (TestPublicExponent3));
+ UT_ASSERT_TRUE (Status);
+
KeySize = RSA_MODULUS_LENGTH / 8;
KeyBuffer = AllocatePool (KeySize);
Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);