summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Test
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:53:54 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit7c342378317039e632d9a1a5d4cf7c21aec8cb7a (patch)
tree6b34f630a779ee11db93c02cf54fa65c29716aed /CryptoPkg/Test
parent2b16a4fb91b9b31c0d152588f5ac51080c6c0763 (diff)
downloadedk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.tar.gz
edk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.tar.bz2
edk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.zip
CryptoPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the CryptoPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'CryptoPkg/Test')
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c52
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c96
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c205
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c43
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c116
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c108
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c176
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c31
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h172
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c325
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c16
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c67
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPssTests.c173
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c70
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c22
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h98
-rw-r--r--CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c9
17 files changed, 894 insertions, 885 deletions
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
index 8935f289d8..4ced78de37 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
@@ -12,25 +12,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Sample PE/COFF Image Hash Value (Digested by SHA-1).
// This value should be calculated following MSFT's Authenticode Specification
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha1Hash[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha1Hash[] = {
0x44, 0xFD, 0x4F, 0xA9, 0x17, 0xEE, 0xAC, 0xCF, 0x1F, 0x0B, 0xE3, 0xA1, 0x4D, 0x5B, 0xA6, 0x61,
0x82, 0x97, 0xC4, 0xB6
- };
+};
//
// Sample PE/COFF Image Hash Value (Digested by SHA-256).
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha256Hash[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 PeSha256Hash[] = {
0x61, 0x82, 0xB7, 0xF8, 0x8C, 0xFF, 0xC2, 0xEB, 0x79, 0x6E, 0x9D, 0xA9, 0xDD, 0x39, 0x52, 0xDD,
0x36, 0xDD, 0xF1, 0x43, 0x27, 0x58, 0x8C, 0xA7, 0xCC, 0xAE, 0xDE, 0xDD, 0x3C, 0x02, 0x12, 0x49
- };
+};
//
// Sample Authenticode Data with SHA-1 hash algorithm.
// This data should be retrieved from signed PE/COFF image according to SECURITY
// directory in PE/COFF Header.
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha1[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha1[] = {
0x30, 0x82, 0x1C, 0x43, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02, 0xA0,
0x82, 0x1C, 0x34, 0x30, 0x82, 0x1C, 0x30, 0x02, 0x01, 0x01, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x05,
0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x68, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01,
@@ -484,14 +484,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha1[] = {
0x0E, 0x99, 0x1F, 0xDF, 0x7E, 0xC9, 0x10, 0x56, 0xC7, 0x00, 0x6D, 0x5F, 0x23, 0x57, 0x12, 0x84,
0xCD, 0xAC, 0x82, 0xAE, 0x39, 0x52, 0xA5, 0x19, 0x23, 0xA3, 0x6B, 0xE7, 0x49, 0x8F, 0x86, 0x74,
0x46, 0x41, 0x2A, 0x0F, 0x3D, 0x29, 0xB7, 0xAE, 0x8C, 0x00
- };
+};
//
// Sample Authenticode Data with SHA-256 hash algorithm.
// This data should be retrieved from signed PE/COFF image according to SECURITY
// directory in PE/COFF Header.
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha256[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha256[] = {
0x30, 0x82, 0x0e, 0xd1, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
0x82, 0x0e, 0xc2, 0x30, 0x82, 0x0e, 0xbe, 0x02, 0x01, 0x01, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x09,
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x5c, 0x06, 0x0a, 0x2b,
@@ -730,14 +730,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithSha256[] = {
0x22, 0xb6, 0x17, 0x3f, 0x4f, 0x33, 0xed, 0xa6, 0xd9, 0x0f, 0x74, 0xfa, 0x97, 0x8d, 0x98, 0x55,
0x42, 0x14, 0x76, 0xd4, 0x89, 0x07, 0xf2, 0x30, 0x5a, 0x27, 0x96, 0x1b, 0x92, 0x70, 0x5a, 0x83,
0x89, 0x0f, 0xdb, 0x47, 0x7a, 0x00, 0x00, 0x00, 0x0a
- };
+};
//
// Sample root certificate for code signing.
// A trusted certificate with self-signing, will be used to construct the certificate chains for
// authority checking.
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert1[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert1[] = {
0x30, 0x82, 0x05, 0x99, 0x30, 0x82, 0x03, 0x81, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x79,
0xAD, 0x16, 0xA1, 0x4A, 0xA0, 0xA5, 0xAD, 0x4C, 0x73, 0x58, 0xF4, 0x07, 0x13, 0x2E, 0x65, 0x30,
0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5F,
@@ -830,7 +830,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert1[] = {
0x6B, 0x9D, 0x4A, 0xFD, 0xD1, 0xA1, 0x9D, 0x99, 0x43, 0x77, 0x3F, 0xB0, 0xDA
};
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert2[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert2[] = {
0x30, 0x82, 0x05, 0xfd, 0x30, 0x82, 0x03, 0xe5, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x74,
0x45, 0xc8, 0x78, 0x4e, 0x0c, 0xc9, 0x96, 0x4a, 0xb4, 0x2f, 0xbc, 0xda, 0x29, 0xe1, 0xbc, 0x30,
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x81,
@@ -928,24 +928,24 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TestRootCert2[] = {
0x5f, 0x70, 0x44, 0xfa, 0x89, 0x59, 0x93, 0xb0, 0x7b, 0x12, 0x0f, 0x5e, 0x62, 0x62, 0x51, 0x11,
0xbd, 0xba, 0x5a, 0xd0, 0xce, 0xa1, 0xb6, 0xef, 0x80, 0x20, 0xe6, 0x73, 0x4b, 0x11, 0x06, 0x56,
0xe2, 0x0a
- };
+};
//
// OID ASN.1 Value for Hash Algorithms
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 HashOidValue[] = {
- 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, // OBJ_md5
- 0x2B, 0x0E, 0x03, 0x02, 0x1A, // OBJ_sha1
- 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, // OBJ_sha224
- 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, // OBJ_sha256
- 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, // OBJ_sha384
- 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, // OBJ_sha512
- };
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 HashOidValue[] = {
+ 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, // OBJ_md5
+ 0x2B, 0x0E, 0x03, 0x02, 0x1A, // OBJ_sha1
+ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, // OBJ_sha224
+ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, // OBJ_sha256
+ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, // OBJ_sha384
+ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, // OBJ_sha512
+};
UNIT_TEST_STATUS
EFIAPI
TestVerifyAuthenticodeVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -992,11 +992,11 @@ TestVerifyAuthenticodeVerify (
return UNIT_TEST_PASSED;
}
-TEST_DESC mAuthenticodeTest[] = {
- //
- // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyAuthenticodeVerify()", "CryptoPkg.BaseCryptLib.Authenticode", TestVerifyAuthenticodeVerify, NULL, NULL, NULL},
+TEST_DESC mAuthenticodeTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyAuthenticodeVerify()", "CryptoPkg.BaseCryptLib.Authenticode", TestVerifyAuthenticodeVerify, NULL, NULL, NULL },
};
-UINTN mAuthenticodeTestNum = ARRAY_SIZE(mAuthenticodeTest);
+UINTN mAuthenticodeTestNum = ARRAY_SIZE (mAuthenticodeTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
index 3873de9730..3c57aead1e 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c
@@ -8,60 +8,64 @@
#include "TestBaseCryptLib.h"
SUITE_DESC mSuiteDesc[] = {
- //
- // Title--------------------------Package-------------------Sup--Tdn----TestNum------------TestDesc
- //
- {"EKU verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7EkuTestNum, mPkcs7EkuTest},
- {"HASH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHashTestNum, mHashTest},
- {"HMAC verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHmacTestNum, mHmacTest},
- {"BlockCipher verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mBlockCipherTestNum, mBlockCipherTest},
- {"RSA verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaTestNum, mRsaTest},
- {"RSA PSS verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaPssTestNum, mRsaPssTest},
- {"RSACert verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaCertTestNum, mRsaCertTest},
- {"PKCS7 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7TestNum, mPkcs7Test},
- {"PKCS5 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs5TestNum, mPkcs5Test},
- {"Authenticode verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mAuthenticodeTestNum, mAuthenticodeTest},
- {"ImageTimestamp verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mImageTimestampTestNum, mImageTimestampTest},
- {"DH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mDhTestNum, mDhTest},
- {"PRNG verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPrngTestNum, mPrngTest},
- {"OAEP encrypt verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mOaepTestNum, mOaepTest},
+ //
+ // Title--------------------------Package-------------------Sup--Tdn----TestNum------------TestDesc
+ //
+ { "EKU verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7EkuTestNum, mPkcs7EkuTest },
+ { "HASH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHashTestNum, mHashTest },
+ { "HMAC verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mHmacTestNum, mHmacTest },
+ { "BlockCipher verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mBlockCipherTestNum, mBlockCipherTest },
+ { "RSA verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaTestNum, mRsaTest },
+ { "RSA PSS verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaPssTestNum, mRsaPssTest },
+ { "RSACert verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mRsaCertTestNum, mRsaCertTest },
+ { "PKCS7 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs7TestNum, mPkcs7Test },
+ { "PKCS5 verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPkcs5TestNum, mPkcs5Test },
+ { "Authenticode verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mAuthenticodeTestNum, mAuthenticodeTest },
+ { "ImageTimestamp verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mImageTimestampTestNum, mImageTimestampTest },
+ { "DH verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mDhTestNum, mDhTest },
+ { "PRNG verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mPrngTestNum, mPrngTest },
+ { "OAEP encrypt verify tests", "CryptoPkg.BaseCryptLib", NULL, NULL, &mOaepTestNum, mOaepTest },
};
EFI_STATUS
EFIAPI
CreateUnitTest (
- IN CHAR8* UnitTestName,
- IN CHAR8* UnitTestVersion,
- IN OUT UNIT_TEST_FRAMEWORK_HANDLE* Framework
-) {
- EFI_STATUS Status;
- UINTN SuiteIndex;
- UINTN TestIndex;
+ IN CHAR8 *UnitTestName,
+ IN CHAR8 *UnitTestVersion,
+ IN OUT UNIT_TEST_FRAMEWORK_HANDLE *Framework
+ )
+{
+ EFI_STATUS Status;
+ UINTN SuiteIndex;
+ UINTN TestIndex;
- if ( Framework == NULL || UnitTestVersion == NULL || UnitTestName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- Status = EFI_SUCCESS;
- //
- // Start setting up the test framework for running the tests.
- //
- Status = InitUnitTestFramework (Framework, UnitTestName, gEfiCallerBaseName, UnitTestVersion);
+ if ((Framework == NULL) || (UnitTestVersion == NULL) || (UnitTestName == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = EFI_SUCCESS;
+ //
+ // Start setting up the test framework for running the tests.
+ //
+ Status = InitUnitTestFramework (Framework, UnitTestName, gEfiCallerBaseName, UnitTestVersion);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
+ goto EXIT;
+ }
+
+ for (SuiteIndex = 0; SuiteIndex < ARRAY_SIZE (mSuiteDesc); SuiteIndex++) {
+ UNIT_TEST_SUITE_HANDLE Suite = NULL;
+ Status = CreateUnitTestSuite (&Suite, *Framework, mSuiteDesc[SuiteIndex].Title, mSuiteDesc[SuiteIndex].Package, mSuiteDesc[SuiteIndex].Sup, mSuiteDesc[SuiteIndex].Tdn);
if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
- goto EXIT;
+ Status = EFI_OUT_OF_RESOURCES;
+ goto EXIT;
}
- for (SuiteIndex = 0; SuiteIndex < ARRAY_SIZE(mSuiteDesc); SuiteIndex++) {
- UNIT_TEST_SUITE_HANDLE Suite = NULL;
- Status = CreateUnitTestSuite (&Suite, *Framework, mSuiteDesc[SuiteIndex].Title, mSuiteDesc[SuiteIndex].Package, mSuiteDesc[SuiteIndex].Sup, mSuiteDesc[SuiteIndex].Tdn);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
- for (TestIndex = 0; TestIndex < *mSuiteDesc[SuiteIndex].TestNum; TestIndex++) {
- AddTestCase (Suite, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Description, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->ClassName, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Func, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->PreReq, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->CleanUp, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Context);
- }
+ for (TestIndex = 0; TestIndex < *mSuiteDesc[SuiteIndex].TestNum; TestIndex++) {
+ AddTestCase (Suite, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Description, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->ClassName, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Func, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->PreReq, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->CleanUp, (mSuiteDesc[SuiteIndex].TestDesc + TestIndex)->Context);
}
- EXIT:
- return Status;
+ }
+
+EXIT:
+ return Status;
}
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
index b349307396..fe51cafa5b 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
@@ -11,130 +11,129 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// TDES test vectors are extracted from OpenSSL 0.9.8l, crypto\des\destest.c
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbData[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbKey[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbCipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcbCipher[] = {
0x8C, 0xA6, 0x4D, 0xE9, 0xC1, 0xB1, 0x23, 0xA7,
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcb2Cipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesEcb2Cipher[] = {
0x92, 0x95, 0xB5, 0x9B, 0xB3, 0x84, 0x73, 0x6E,
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcData[] = {
0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x20
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbcKey[] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0xf1, 0xe0, 0xd3, 0xc2, 0xb5, 0xa4, 0x97, 0x86,
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TdesCbcIvec[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TdesCbcIvec[] = {
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbc3Cipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TdesCbc3Cipher[] = {
0x3F, 0xE3, 0x01, 0xC9, 0x62, 0xAC, 0x01, 0xD0,
0x22, 0x13, 0x76, 0x3C, 0x1C, 0xBD, 0x4C, 0xDC,
0x79, 0x96, 0x57, 0xC0, 0x64, 0xEC, 0xF5, 0xD4
- };
+};
//
// AES test vectors are from NIST KAT of AES
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbData[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbKey[] = {
0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbCipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128EcbCipher[] = {
0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbData[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbKey[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbCipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes192EcbCipher[] = {
0xdd, 0x8a, 0x49, 0x35, 0x14, 0x23, 0x1c, 0xbf, 0x56, 0xec, 0xce, 0xe4, 0xc4, 0x08, 0x89, 0xfb
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbData[] = {
0x01, 0x47, 0x30, 0xf8, 0x0a, 0xc6, 0x25, 0xfe, 0x84, 0xf0, 0x26, 0xc6, 0x0b, 0xfd, 0x54, 0x7d
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbKey[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbCipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes256EcbCipher[] = {
0x5c, 0x9d, 0x84, 0x4e, 0xd4, 0x6f, 0x98, 0x85, 0x08, 0x5e, 0x5d, 0x6a, 0x4f, 0x94, 0xc7, 0xd7
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcData[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcData[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcKey[] = {
0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0, 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcIvec[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcIvec[] = {
0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28, 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcCipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Aes128CbcCipher[] = {
0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a, 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9, 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1
- };
+};
//
// ARC4 Test Vector defined in "Appendix A.1 Test Vectors from [CRYPTLIB]" of
// IETF Draft draft-kaukonen-cipher-arcfour-03 ("A Stream Cipher Encryption Algorithm 'Arcfour'").
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Data[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Data[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Key[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Key[] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Cipher[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Arc4Cipher[] = {
0x74, 0x94, 0xC2, 0xE7, 0x10, 0x4B, 0x08, 0x79
- };
-
+};
typedef
UINTN
-(EFIAPI *EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE) (
+(EFIAPI *EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE)(
VOID
);
typedef
BOOLEAN
-(EFIAPI *EFI_BLOCK_CIPHER_INIT) (
+(EFIAPI *EFI_BLOCK_CIPHER_INIT)(
OUT VOID *BlockCipherContext,
IN CONST UINT8 *Key,
IN UINTN KeyLength
@@ -142,7 +141,7 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT) (
+(EFIAPI *EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT)(
IN VOID *BlockCipherContext,
IN CONST UINT8 *Input,
IN UINTN InputSize,
@@ -151,7 +150,7 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT) (
+(EFIAPI *EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT)(
IN VOID *BlockCipherContext,
IN CONST UINT8 *Input,
IN UINTN InputSize,
@@ -161,49 +160,48 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_BLOCK_CIPHER_RESET) (
+(EFIAPI *EFI_BLOCK_CIPHER_RESET)(
IN OUT VOID *BlockCipherContext
);
typedef struct {
- EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE GetContextSize;
- EFI_BLOCK_CIPHER_INIT Init;
- EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbEncrypt;
- EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbDecrypt;
- EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcEncrypt;
- EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcDecrypt;
- EFI_BLOCK_CIPHER_RESET Reset;
- CONST UINT8 *Key;
- UINTN KeySize;
- CONST UINT8 *Ivec;
- CONST UINT8 *Data;
- UINTN DataSize;
- CONST UINT8 *Cipher;
- UINTN CipherSize;
- VOID *Ctx;
+ EFI_BLOCK_CIPHER_GET_CONTEXT_SIZE GetContextSize;
+ EFI_BLOCK_CIPHER_INIT Init;
+ EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbEncrypt;
+ EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT EcbDecrypt;
+ EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcEncrypt;
+ EFI_BLOCK_CIPHER_CBC_ENCRYPT_DECRYPT CbcDecrypt;
+ EFI_BLOCK_CIPHER_RESET Reset;
+ CONST UINT8 *Key;
+ UINTN KeySize;
+ CONST UINT8 *Ivec;
+ CONST UINT8 *Data;
+ UINTN DataSize;
+ CONST UINT8 *Cipher;
+ UINTN CipherSize;
+ VOID *Ctx;
} BLOCK_CIPHER_TEST_CONTEXT;
// These are commented out as they are deprecated, but are left in should they be used again
-//BLOCK_CIPHER_TEST_CONTEXT mTdesEcbTestCtx = {TdesGetContextSize, TdesInit, TdesEcbEncrypt, TdesEcbDecrypt, NULL, NULL, NULL, TdesEcbKey, 64, NULL, TdesEcbData, 8, TdesEcbCipher, 8};
-//BLOCK_CIPHER_TEST_CONTEXT mTdesCbcTestCtx = {TdesGetContextSize, TdesInit, NULL, NULL, TdesCbcEncrypt, TdesCbcDecrypt, NULL, TdesCbcKey, 192, TdesCbcIvec, TdesCbcData, sizeof(TdesCbcData), TdesCbc3Cipher, sizeof(TdesCbc3Cipher)};
-//BLOCK_CIPHER_TEST_CONTEXT mAes128EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes128EcbKey, 128, NULL, Aes128EcbData, sizeof(Aes128EcbData), Aes128EcbCipher, sizeof(Aes128EcbCipher)};
-//BLOCK_CIPHER_TEST_CONTEXT mAes192EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes192EcbKey, 192, NULL, Aes192EcbData, sizeof(Aes192EcbData), Aes192EcbCipher, sizeof(Aes192EcbCipher)};
-//BLOCK_CIPHER_TEST_CONTEXT mAes256EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes256EcbKey, 256, NULL, Aes256EcbData, sizeof(Aes256EcbData), Aes256EcbCipher, sizeof(Aes256EcbCipher)};
-//BLOCK_CIPHER_TEST_CONTEXT mArc4TestCtx = {Arc4GetContextSize, Arc4Init, Arc4Encrypt, (EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT), Arc4Decrypt, NULL, NULL, Arc4Reset, Arc4Key, sizeof(Arc4Key), NULL, Arc4Data, sizeof(Arc4Data), Arc4Cipher, sizeof(Arc4Cipher)};
-BLOCK_CIPHER_TEST_CONTEXT mAes128CbcTestCtx = {AesGetContextSize, AesInit, NULL, NULL, AesCbcEncrypt, AesCbcDecrypt, NULL, Aes128CbcKey, 128, Aes128CbcIvec, Aes128CbcData, sizeof(Aes128CbcData), Aes128CbcCipher, sizeof(Aes128CbcCipher)};
-
+// BLOCK_CIPHER_TEST_CONTEXT mTdesEcbTestCtx = {TdesGetContextSize, TdesInit, TdesEcbEncrypt, TdesEcbDecrypt, NULL, NULL, NULL, TdesEcbKey, 64, NULL, TdesEcbData, 8, TdesEcbCipher, 8};
+// BLOCK_CIPHER_TEST_CONTEXT mTdesCbcTestCtx = {TdesGetContextSize, TdesInit, NULL, NULL, TdesCbcEncrypt, TdesCbcDecrypt, NULL, TdesCbcKey, 192, TdesCbcIvec, TdesCbcData, sizeof(TdesCbcData), TdesCbc3Cipher, sizeof(TdesCbc3Cipher)};
+// BLOCK_CIPHER_TEST_CONTEXT mAes128EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes128EcbKey, 128, NULL, Aes128EcbData, sizeof(Aes128EcbData), Aes128EcbCipher, sizeof(Aes128EcbCipher)};
+// BLOCK_CIPHER_TEST_CONTEXT mAes192EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes192EcbKey, 192, NULL, Aes192EcbData, sizeof(Aes192EcbData), Aes192EcbCipher, sizeof(Aes192EcbCipher)};
+// BLOCK_CIPHER_TEST_CONTEXT mAes256EcbTestCtx = {AesGetContextSize, AesInit, AesEcbEncrypt, AesEcbDecrypt, NULL, NULL, NULL, Aes256EcbKey, 256, NULL, Aes256EcbData, sizeof(Aes256EcbData), Aes256EcbCipher, sizeof(Aes256EcbCipher)};
+// BLOCK_CIPHER_TEST_CONTEXT mArc4TestCtx = {Arc4GetContextSize, Arc4Init, Arc4Encrypt, (EFI_BLOCK_CIPHER_ECB_ENCRYPT_DECRYPT), Arc4Decrypt, NULL, NULL, Arc4Reset, Arc4Key, sizeof(Arc4Key), NULL, Arc4Data, sizeof(Arc4Data), Arc4Cipher, sizeof(Arc4Cipher)};
+BLOCK_CIPHER_TEST_CONTEXT mAes128CbcTestCtx = { AesGetContextSize, AesInit, NULL, NULL, AesCbcEncrypt, AesCbcDecrypt, NULL, Aes128CbcKey, 128, Aes128CbcIvec, Aes128CbcData, sizeof (Aes128CbcData), Aes128CbcCipher, sizeof (Aes128CbcCipher) };
UNIT_TEST_STATUS
EFIAPI
TestVerifyBLockCiperPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- BLOCK_CIPHER_TEST_CONTEXT *TestContext;
- UINTN CtxSize;
+ BLOCK_CIPHER_TEST_CONTEXT *TestContext;
+ UINTN CtxSize;
- TestContext = Context;
- CtxSize = TestContext->GetContextSize ();
+ TestContext = Context;
+ CtxSize = TestContext->GetContextSize ();
TestContext->Ctx = AllocatePool (CtxSize);
if (TestContext->Ctx == NULL) {
return UNIT_TEST_ERROR_TEST_FAILED;
@@ -215,10 +213,10 @@ TestVerifyBLockCiperPreReq (
VOID
EFIAPI
TestVerifyBLockCiperCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- BLOCK_CIPHER_TEST_CONTEXT *TestContext;
+ BLOCK_CIPHER_TEST_CONTEXT *TestContext;
TestContext = Context;
if (TestContext->Ctx != NULL) {
@@ -229,13 +227,13 @@ TestVerifyBLockCiperCleanUp (
UNIT_TEST_STATUS
EFIAPI
TestVerifyBLockCiper (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- UINT8 Encrypt[256];
- UINT8 Decrypt[256];
- BOOLEAN Status;
- BLOCK_CIPHER_TEST_CONTEXT *TestContext;
+ UINT8 Encrypt[256];
+ UINT8 Decrypt[256];
+ BOOLEAN Status;
+ BLOCK_CIPHER_TEST_CONTEXT *TestContext;
TestContext = Context;
@@ -256,7 +254,6 @@ TestVerifyBLockCiper (
Status = TestContext->EcbDecrypt (TestContext->Ctx, Encrypt, TestContext->DataSize, Decrypt);
UT_ASSERT_TRUE (Status);
-
} else {
Status = TestContext->CbcEncrypt (TestContext->Ctx, TestContext->Data, TestContext->DataSize, TestContext->Ivec, Encrypt);
UT_ASSERT_TRUE (Status);
@@ -271,23 +268,23 @@ TestVerifyBLockCiper (
}
UT_ASSERT_MEM_EQUAL (Encrypt, TestContext->Cipher, TestContext->CipherSize);
- UT_ASSERT_MEM_EQUAL (Decrypt, TestContext->Data, TestContext->DataSize);
+ UT_ASSERT_MEM_EQUAL (Decrypt, TestContext->Data, TestContext->DataSize);
return UNIT_TEST_PASSED;
}
-TEST_DESC mBlockCipherTest[] = {
- //
- // -----Description-------------------------Class-------------------------Function---------------Pre---------------------------Post------------------Context
- //
- {"TestVerifyAes128Cbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128CbcTestCtx},
- // These are commented out as these functions have been deprecated, but they have been left in for future reference
- //{"TestVerifyTdesEcb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesEcbTestCtx},
- //{"TestVerifyTdesCbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesCbcTestCtx},
- //{"TestVerifyAes128Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128EcbTestCtx},
- //{"TestVerifyAes192Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes192EcbTestCtx},
- //{"TestVerifyAes256Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes256EcbTestCtx},
- //{"TestVerifyArc4()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mArc4TestCtx},
+TEST_DESC mBlockCipherTest[] = {
+ //
+ // -----Description-------------------------Class-------------------------Function---------------Pre---------------------------Post------------------Context
+ //
+ { "TestVerifyAes128Cbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128CbcTestCtx },
+ // These are commented out as these functions have been deprecated, but they have been left in for future reference
+ // {"TestVerifyTdesEcb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesEcbTestCtx},
+ // {"TestVerifyTdesCbc()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mTdesCbcTestCtx},
+ // {"TestVerifyAes128Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes128EcbTestCtx},
+ // {"TestVerifyAes192Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes192EcbTestCtx},
+ // {"TestVerifyAes256Ecb()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mAes256EcbTestCtx},
+ // {"TestVerifyArc4()", "CryptoPkg.BaseCryptLib.BlockCipher", TestVerifyBLockCiper, TestVerifyBLockCiperPreReq, TestVerifyBLockCiperCleanUp, &mArc4TestCtx},
};
-UINTN mBlockCipherTestNum = ARRAY_SIZE(mBlockCipherTest);
+UINTN mBlockCipherTestNum = ARRAY_SIZE (mBlockCipherTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
index 422b990f2c..5cfe8d7053 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
@@ -8,13 +8,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "TestBaseCryptLib.h"
-VOID *mDh1;
-VOID *mDh2;
+VOID *mDh1;
+VOID *mDh2;
UNIT_TEST_STATUS
EFIAPI
TestVerifyDhPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
mDh1 = DhNew ();
@@ -33,13 +33,14 @@ TestVerifyDhPreReq (
VOID
EFIAPI
TestVerifyDhCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
if (mDh1 != NULL) {
DhFree (mDh1);
mDh1 = NULL;
}
+
if (mDh2 != NULL) {
DhFree (mDh2);
mDh2 = NULL;
@@ -49,19 +50,19 @@ TestVerifyDhCleanUp (
UNIT_TEST_STATUS
EFIAPI
TestVerifyDhGenerateKey (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- UINT8 Prime[64];
- UINT8 PublicKey1[64];
- UINTN PublicKey1Length;
- UINT8 PublicKey2[64];
- UINTN PublicKey2Length;
- UINT8 Key1[64];
- UINTN Key1Length;
- UINT8 Key2[64];
- UINTN Key2Length;
- BOOLEAN Status;
+ UINT8 Prime[64];
+ UINT8 PublicKey1[64];
+ UINTN PublicKey1Length;
+ UINT8 PublicKey2[64];
+ UINTN PublicKey2Length;
+ UINT8 Key1[64];
+ UINTN Key1Length;
+ UINT8 Key2[64];
+ UINTN Key2Length;
+ BOOLEAN Status;
//
// Initialize Key Length
@@ -96,11 +97,11 @@ TestVerifyDhGenerateKey (
return UNIT_TEST_PASSED;
}
-TEST_DESC mDhTest[] = {
- //
- // -----Description--------------------------------Class---------------------Function----------------Pre-----------------Post------------Context
- //
- {"TestVerifyDhGenerateKey()", "CryptoPkg.BaseCryptLib.Dh", TestVerifyDhGenerateKey, TestVerifyDhPreReq, TestVerifyDhCleanUp, NULL},
+TEST_DESC mDhTest[] = {
+ //
+ // -----Description--------------------------------Class---------------------Function----------------Pre-----------------Post------------Context
+ //
+ { "TestVerifyDhGenerateKey()", "CryptoPkg.BaseCryptLib.Dh", TestVerifyDhGenerateKey, TestVerifyDhPreReq, TestVerifyDhCleanUp, NULL },
};
-UINTN mDhTestNum = ARRAY_SIZE(mDhTest);
+UINTN mDhTestNum = ARRAY_SIZE (mDhTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
index aebba853e0..e7e67b645b 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c
@@ -11,72 +11,72 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Max Known Digest Size is SHA512 Output (64 bytes) by far
//
-#define MAX_DIGEST_SIZE 64
+#define MAX_DIGEST_SIZE 64
//
// Message string for digest validation
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HashData = "abc";
+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] = {
+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)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha1Digest[SHA1_DIGEST_SIZE] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha1Digest[SHA1_DIGEST_SIZE] = {
0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c,
0x9c, 0xd0, 0xd8, 0x9d
- };
+};
//
// Result for SHA-256("abc"). (From "B.1 SHA-256 Example" of NIST FIPS 180-2)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha256Digest[SHA256_DIGEST_SIZE] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha256Digest[SHA256_DIGEST_SIZE] = {
0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad
- };
+};
//
// Result for SHA-384("abc"). (From "D.1 SHA-384 Example" of NIST FIPS 180-2)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha384Digest[SHA384_DIGEST_SIZE] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha384Digest[SHA384_DIGEST_SIZE] = {
0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7
- };
+};
//
// Result for SHA-512("abc"). (From "C.1 SHA-512 Example" of NIST FIPS 180-2)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha512Digest[SHA512_DIGEST_SIZE] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha512Digest[SHA512_DIGEST_SIZE] = {
0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f
- };
+};
typedef
UINTN
-(EFIAPI *EFI_HASH_GET_CONTEXT_SIZE) (
+(EFIAPI *EFI_HASH_GET_CONTEXT_SIZE)(
VOID
);
typedef
BOOLEAN
-(EFIAPI *EFI_HASH_INIT) (
+(EFIAPI *EFI_HASH_INIT)(
OUT VOID *HashContext
);
typedef
BOOLEAN
-(EFIAPI *EFI_HASH_UPDATE) (
+(EFIAPI *EFI_HASH_UPDATE)(
IN OUT VOID *HashContext,
IN CONST VOID *Data,
IN UINTN DataSize
@@ -84,49 +84,49 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_HASH_FINAL) (
+(EFIAPI *EFI_HASH_FINAL)(
IN OUT VOID *HashContext,
OUT UINT8 *HashValue
);
typedef
BOOLEAN
-(EFIAPI *EFI_HASH_ALL) (
+(EFIAPI *EFI_HASH_ALL)(
IN CONST VOID *Data,
IN UINTN DataSize,
OUT UINT8 *HashValue
);
typedef struct {
- UINT32 DigestSize;
- EFI_HASH_GET_CONTEXT_SIZE GetContextSize;
- EFI_HASH_INIT HashInit;
- EFI_HASH_UPDATE HashUpdate;
- EFI_HASH_FINAL HashFinal;
- EFI_HASH_ALL HashAll;
- CONST UINT8 *Digest;
- VOID *HashCtx;
+ UINT32 DigestSize;
+ EFI_HASH_GET_CONTEXT_SIZE GetContextSize;
+ EFI_HASH_INIT HashInit;
+ EFI_HASH_UPDATE HashUpdate;
+ EFI_HASH_FINAL HashFinal;
+ EFI_HASH_ALL HashAll;
+ CONST UINT8 *Digest;
+ VOID *HashCtx;
} HASH_TEST_CONTEXT;
#ifdef ENABLE_MD5_DEPRECATED_INTERFACES
-HASH_TEST_CONTEXT mMd5TestCtx = {MD5_DIGEST_SIZE, Md5GetContextSize, Md5Init, Md5Update, Md5Final, Md5HashAll, Md5Digest};
+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};
-HASH_TEST_CONTEXT mSha512TestCtx = {SHA512_DIGEST_SIZE, Sha512GetContextSize, Sha512Init, Sha512Update, Sha512Final, Sha512HashAll, Sha512Digest};
+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 };
+HASH_TEST_CONTEXT mSha512TestCtx = { SHA512_DIGEST_SIZE, Sha512GetContextSize, Sha512Init, Sha512Update, Sha512Final, Sha512HashAll, Sha512Digest };
UNIT_TEST_STATUS
EFIAPI
TestVerifyHashPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- HASH_TEST_CONTEXT *HashTestContext;
- UINTN CtxSize;
+ HASH_TEST_CONTEXT *HashTestContext;
+ UINTN CtxSize;
- HashTestContext = Context;
- CtxSize = HashTestContext->GetContextSize ();
+ HashTestContext = Context;
+ CtxSize = HashTestContext->GetContextSize ();
HashTestContext->HashCtx = AllocatePool (CtxSize);
if (HashTestContext->HashCtx == NULL) {
return UNIT_TEST_ERROR_TEST_FAILED;
@@ -138,10 +138,10 @@ TestVerifyHashPreReq (
VOID
EFIAPI
TestVerifyHashCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- HASH_TEST_CONTEXT *HashTestContext;
+ HASH_TEST_CONTEXT *HashTestContext;
HashTestContext = Context;
if (HashTestContext->HashCtx != NULL) {
@@ -152,13 +152,13 @@ TestVerifyHashCleanUp (
UNIT_TEST_STATUS
EFIAPI
TestVerifyHash (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- UINTN DataSize;
- UINT8 Digest[MAX_DIGEST_SIZE];
- BOOLEAN Status;
- HASH_TEST_CONTEXT *HashTestContext;
+ UINTN DataSize;
+ UINT8 Digest[MAX_DIGEST_SIZE];
+ BOOLEAN Status;
+ HASH_TEST_CONTEXT *HashTestContext;
HashTestContext = Context;
@@ -166,19 +166,19 @@ TestVerifyHash (
ZeroMem (Digest, MAX_DIGEST_SIZE);
- Status = HashTestContext->HashInit (HashTestContext->HashCtx);
+ Status = HashTestContext->HashInit (HashTestContext->HashCtx);
UT_ASSERT_TRUE (Status);
- Status = HashTestContext->HashUpdate (HashTestContext->HashCtx, HashData, DataSize);
+ Status = HashTestContext->HashUpdate (HashTestContext->HashCtx, HashData, DataSize);
UT_ASSERT_TRUE (Status);
- Status = HashTestContext->HashFinal (HashTestContext->HashCtx, Digest);
+ Status = HashTestContext->HashFinal (HashTestContext->HashCtx, Digest);
UT_ASSERT_TRUE (Status);
UT_ASSERT_MEM_EQUAL (Digest, HashTestContext->Digest, HashTestContext->DigestSize);
ZeroMem (Digest, MAX_DIGEST_SIZE);
- Status = HashTestContext->HashAll (HashData, DataSize, Digest);
+ Status = HashTestContext->HashAll (HashData, DataSize, Digest);
UT_ASSERT_TRUE (Status);
UT_ASSERT_MEM_EQUAL (Digest, HashTestContext->Digest, HashTestContext->DigestSize);
@@ -186,17 +186,17 @@ TestVerifyHash (
return UNIT_TEST_PASSED;
}
-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},
- {"TestVerifySha512()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha512TestCtx},
+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 },
+ { "TestVerifySha512()", "CryptoPkg.BaseCryptLib.Hash", TestVerifyHash, TestVerifyHashPreReq, TestVerifyHashCleanUp, &mSha512TestCtx },
};
-UINTN mHashTestNum = ARRAY_SIZE(mHashTest);
+UINTN mHashTestNum = ARRAY_SIZE (mHashTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
index 2e0cdd7c45..595729424b 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c
@@ -11,68 +11,68 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Max Known Digest Size is SHA512 Output (64 bytes) by far
//
-#define MAX_DIGEST_SIZE 64
+#define MAX_DIGEST_SIZE 64
//
// Data string for HMAC validation
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HmacData = "Hi There";
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *HmacData = "Hi There";
//
// Key value for HMAC-MD5 validation. (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Key[16] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Key[16] = {
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b
- };
+};
//
// Result for HMAC-MD5("Hi There"). (From "2. Test Cases for HMAC-MD5" of IETF RFC2202)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Digest[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacMd5Digest[] = {
0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c, 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d
- };
+};
//
// Key value for HMAC-SHA-1 validation. (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Key[20] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Key[20] = {
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b
- };
+};
//
// Result for HMAC-SHA-1 ("Hi There"). (From "3. Test Cases for HMAC-SHA-1" of IETF RFC2202)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Digest[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha1Digest[] = {
0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e,
0xf1, 0x46, 0xbe, 0x00
- };
+};
//
// Key value for HMAC-SHA-256 validation. (From "4. Test Vectors" of IETF RFC4231)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Key[20] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Key[20] = {
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b
- };
+};
//
// Result for HMAC-SHA-256 ("Hi There"). (From "4. Test Vectors" of IETF RFC4231)
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Digest[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 HmacSha256Digest[] = {
0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b,
0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7
- };
+};
typedef
-VOID*
-(EFIAPI *EFI_HMAC_NEW) (
+VOID *
+(EFIAPI *EFI_HMAC_NEW)(
VOID
);
typedef
BOOLEAN
-(EFIAPI *EFI_HMAC_INIT) (
+(EFIAPI *EFI_HMAC_INIT)(
IN OUT VOID *HashContext,
IN CONST UINT8 *Key,
IN UINTN KeySize
@@ -80,7 +80,7 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_HMAC_UPDATE) (
+(EFIAPI *EFI_HMAC_UPDATE)(
IN OUT VOID *HashContext,
IN CONST VOID *Data,
IN UINTN DataSize
@@ -88,39 +88,38 @@ BOOLEAN
typedef
BOOLEAN
-(EFIAPI *EFI_HMAC_FINAL) (
+(EFIAPI *EFI_HMAC_FINAL)(
IN OUT VOID *HashContext,
OUT UINT8 *HashValue
);
typedef struct {
- UINT32 DigestSize;
- EFI_HMAC_NEW HmacNew;
- EFI_HMAC_INIT HmacInit;
- EFI_HMAC_UPDATE HmacUpdate;
- EFI_HMAC_FINAL HmacFinal;
- CONST UINT8 *Key;
- UINTN KeySize;
- CONST UINT8 *Digest;
- VOID *HmacCtx;
+ UINT32 DigestSize;
+ EFI_HMAC_NEW HmacNew;
+ EFI_HMAC_INIT HmacInit;
+ EFI_HMAC_UPDATE HmacUpdate;
+ EFI_HMAC_FINAL HmacFinal;
+ CONST UINT8 *Key;
+ UINTN KeySize;
+ CONST UINT8 *Digest;
+ VOID *HmacCtx;
} HMAC_TEST_CONTEXT;
// These functions have been deprecated but they've been left commented out for future reference
-//HMAC_TEST_CONTEXT mHmacMd5TestCtx = {MD5_DIGEST_SIZE, HmacMd5New, HmacMd5SetKey, HmacMd5Update, HmacMd5Final, HmacMd5Key, sizeof(HmacMd5Key), HmacMd5Digest};
-//HMAC_TEST_CONTEXT mHmacSha1TestCtx = {SHA1_DIGEST_SIZE, HmacSha1New, HmacSha1SetKey, HmacSha1Update, HmacSha1Final, HmacSha1Key, sizeof(HmacSha1Key), HmacSha1Digest};
-HMAC_TEST_CONTEXT mHmacSha256TestCtx = {SHA256_DIGEST_SIZE, HmacSha256New, HmacSha256SetKey, HmacSha256Update, HmacSha256Final, HmacSha256Key, sizeof(HmacSha256Key), HmacSha256Digest};
-
+// HMAC_TEST_CONTEXT mHmacMd5TestCtx = {MD5_DIGEST_SIZE, HmacMd5New, HmacMd5SetKey, HmacMd5Update, HmacMd5Final, HmacMd5Key, sizeof(HmacMd5Key), HmacMd5Digest};
+// HMAC_TEST_CONTEXT mHmacSha1TestCtx = {SHA1_DIGEST_SIZE, HmacSha1New, HmacSha1SetKey, HmacSha1Update, HmacSha1Final, HmacSha1Key, sizeof(HmacSha1Key), HmacSha1Digest};
+HMAC_TEST_CONTEXT mHmacSha256TestCtx = { SHA256_DIGEST_SIZE, HmacSha256New, HmacSha256SetKey, HmacSha256Update, HmacSha256Final, HmacSha256Key, sizeof (HmacSha256Key), HmacSha256Digest };
UNIT_TEST_STATUS
EFIAPI
TestVerifyHmacPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- HMAC_TEST_CONTEXT *HmacTestContext;
+ HMAC_TEST_CONTEXT *HmacTestContext;
- HmacTestContext = Context;
- HmacTestContext->HmacCtx = HmacTestContext->HmacNew();
+ HmacTestContext = Context;
+ HmacTestContext->HmacCtx = HmacTestContext->HmacNew ();
if (HmacTestContext->HmacCtx == NULL) {
return UNIT_TEST_ERROR_TEST_FAILED;
}
@@ -131,10 +130,10 @@ TestVerifyHmacPreReq (
VOID
EFIAPI
TestVerifyHmacCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
- HMAC_TEST_CONTEXT *HmacTestContext;
+ HMAC_TEST_CONTEXT *HmacTestContext;
HmacTestContext = Context;
if (HmacTestContext->HmacCtx != NULL) {
@@ -145,24 +144,24 @@ TestVerifyHmacCleanUp (
UNIT_TEST_STATUS
EFIAPI
TestVerifyHmac (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- UINT8 Digest[MAX_DIGEST_SIZE];
- BOOLEAN Status;
- HMAC_TEST_CONTEXT *HmacTestContext;
+ UINT8 Digest[MAX_DIGEST_SIZE];
+ BOOLEAN Status;
+ HMAC_TEST_CONTEXT *HmacTestContext;
HmacTestContext = Context;
ZeroMem (Digest, MAX_DIGEST_SIZE);
- Status = HmacTestContext->HmacInit (HmacTestContext->HmacCtx, HmacTestContext->Key, HmacTestContext->KeySize);
+ Status = HmacTestContext->HmacInit (HmacTestContext->HmacCtx, HmacTestContext->Key, HmacTestContext->KeySize);
UT_ASSERT_TRUE (Status);
- Status = HmacTestContext->HmacUpdate (HmacTestContext->HmacCtx, HmacData, 8);
+ Status = HmacTestContext->HmacUpdate (HmacTestContext->HmacCtx, HmacData, 8);
UT_ASSERT_TRUE (Status);
- Status = HmacTestContext->HmacFinal (HmacTestContext->HmacCtx, Digest);
+ Status = HmacTestContext->HmacFinal (HmacTestContext->HmacCtx, Digest);
UT_ASSERT_TRUE (Status);
UT_ASSERT_MEM_EQUAL (Digest, HmacTestContext->Digest, HmacTestContext->DigestSize);
@@ -170,15 +169,14 @@ TestVerifyHmac (
return UNIT_TEST_PASSED;
}
-TEST_DESC mHmacTest[] = {
- //
- // -----Description---------------------Class---------------------Function---------------Pre------------------Post------------Context
- //
- {"TestVerifyHmacSha256()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha256TestCtx},
- // These functions have been deprecated but they've been left commented out for future reference
- //{"TestVerifyHmacMd5()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacMd5TestCtx},
- //{"TestVerifyHmacSha1()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha1TestCtx},
-
+TEST_DESC mHmacTest[] = {
+ //
+ // -----Description---------------------Class---------------------Function---------------Pre------------------Post------------Context
+ //
+ { "TestVerifyHmacSha256()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha256TestCtx },
+ // These functions have been deprecated but they've been left commented out for future reference
+ // {"TestVerifyHmacMd5()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacMd5TestCtx},
+ // {"TestVerifyHmacSha1()", "CryptoPkg.BaseCryptLib.Hmac", TestVerifyHmac, TestVerifyHmacPreReq, TestVerifyHmacCleanUp, &mHmacSha1TestCtx},
};
-UINTN mHmacTestNum = ARRAY_SIZE(mHmacTest);
+UINTN mHmacTestNum = ARRAY_SIZE (mHmacTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
index 404020f967..22a4ea7e46 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
@@ -14,7 +14,7 @@ CONST UINT8 RandSeed[] = "This is the random seed for PRNG verification.";
// CN = ca.self
// O = Intel
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
0x30, 0x82, 0x03, 0x90, 0x30, 0x82, 0x02, 0x78, 0x02, 0x09, 0x00, 0xE4, 0xDF, 0x47, 0x80, 0xEF,
0x4B, 0x3C, 0x6D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B,
0x05, 0x00, 0x30, 0x81, 0x89, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
@@ -73,9 +73,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 SelfTestCert[] = {
0xF2, 0x6C, 0xCC, 0x57, 0x36, 0x20, 0x06, 0xE6, 0xA7, 0x24, 0x22, 0xB0, 0xB1, 0xC4, 0xBC, 0x2C,
0x5C, 0xCE, 0x92, 0x11, 0xFF, 0x6F, 0x8C, 0x14, 0x7E, 0xC4, 0x10, 0x02, 0xF6, 0x69, 0x86, 0x6D,
0x5B, 0x64, 0x81, 0x13,
- };
+};
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
0x30, 0x82, 0x04, 0xA4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBC, 0xE4, 0x67, 0xDC,
0xC7, 0xEA, 0x6F, 0x8A, 0xA7, 0xCC, 0xB2, 0x54, 0x47, 0x48, 0x6A, 0xE2, 0x39, 0xFF, 0xC2, 0x48,
0x58, 0x34, 0x07, 0x03, 0x6D, 0x39, 0xB3, 0x67, 0x46, 0x4C, 0xBC, 0xA0, 0xFA, 0x4E, 0x64, 0x23,
@@ -151,20 +151,20 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 PrivateKey[] = {
0x6E, 0x35, 0x24, 0xA6, 0xDA, 0x42, 0x63, 0xC6, 0xBF, 0xCA, 0xE8, 0x32, 0xFD, 0x61, 0xC0, 0x80,
0x39, 0xD2, 0xB7, 0x0D, 0xF3, 0xA2, 0xF3, 0xE4, 0x49, 0x26, 0x89, 0xD0, 0xA0, 0x24, 0xC8, 0x27,
0x86, 0x10, 0x09, 0x88, 0x6C, 0x35, 0x60, 0xF2,
- };
+};
UNIT_TEST_STATUS
EFIAPI
TestVerifyOaepEncrypt (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- BOOLEAN Status;
- UINT8 File[4];
- UINT8 *OutBuffer;
- UINTN OutBufferSize;
- UINT8 *OutBuffer2;
- UINTN OutBuffer2Size;
+ BOOLEAN Status;
+ UINT8 File[4];
+ UINT8 *OutBuffer;
+ UINTN OutBufferSize;
+ UINT8 *OutBuffer2;
+ UINTN OutBuffer2Size;
// Create a file and add content '123' in it
File[0] = '1';
@@ -172,33 +172,33 @@ TestVerifyOaepEncrypt (
File[2] = '3';
File[3] = 0;
- OutBuffer = NULL;
- OutBufferSize = 0;
- OutBuffer2 = NULL;
+ OutBuffer = NULL;
+ OutBufferSize = 0;
+ OutBuffer2 = NULL;
OutBuffer2Size = 0;
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)sizeof (File),
- NULL,
- 0,
- &OutBuffer,
- (UINTN *)&OutBufferSize
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)sizeof (File),
+ NULL,
+ 0,
+ &OutBuffer,
+ (UINTN *)&OutBufferSize
+ );
UT_ASSERT_TRUE (Status);
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- NULL,
- 0,
- &OutBuffer2,
- (UINTN *)&OutBuffer2Size
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ NULL,
+ 0,
+ &OutBuffer2,
+ (UINTN *)&OutBuffer2Size
+ );
UT_ASSERT_TRUE (Status);
// TRUE - the two OutBuffers are indentical. That means the Oaep encrypt result is incorrect.
@@ -207,38 +207,38 @@ TestVerifyOaepEncrypt (
if (OutBuffer) {
FreePool (OutBuffer);
- OutBuffer = NULL;
+ OutBuffer = NULL;
OutBufferSize = 0;
}
if (OutBuffer2) {
FreePool (OutBuffer2);
- OutBuffer2 = NULL;
+ OutBuffer2 = NULL;
OutBuffer2Size = 0;
}
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- RandSeed,
- (UINTN)sizeof (RandSeed),
- &OutBuffer,
- (UINTN *)&OutBufferSize
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ RandSeed,
+ (UINTN)sizeof (RandSeed),
+ &OutBuffer,
+ (UINTN *)&OutBufferSize
+ );
UT_ASSERT_TRUE (Status);
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- RandSeed,
- (UINTN)sizeof (RandSeed),
- &OutBuffer2,
- (UINTN *)&OutBuffer2Size
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ RandSeed,
+ (UINTN)sizeof (RandSeed),
+ &OutBuffer2,
+ (UINTN *)&OutBuffer2Size
+ );
UT_ASSERT_TRUE (Status);
// TRUE - the two OutBuffers are indentical. That means the Oaep encrypt result is incorrect.
@@ -247,62 +247,60 @@ TestVerifyOaepEncrypt (
if (OutBuffer) {
FreePool (OutBuffer);
- OutBuffer = NULL;
+ OutBuffer = NULL;
OutBufferSize = 0;
}
if (OutBuffer2) {
FreePool (OutBuffer2);
- OutBuffer2 = NULL;
+ OutBuffer2 = NULL;
OutBuffer2Size = 0;
}
Status = Pkcs1v2Encrypt (
- NULL,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- NULL,
- 0,
- &OutBuffer,
- (UINTN *)&OutBufferSize
- );
+ NULL,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ NULL,
+ 0,
+ &OutBuffer,
+ (UINTN *)&OutBufferSize
+ );
UT_ASSERT_FALSE (Status);
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- NULL,
- 0,
- (UINT8 **)NULL,
- (UINTN *)&OutBufferSize
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ NULL,
+ 0,
+ (UINT8 **)NULL,
+ (UINTN *)&OutBufferSize
+ );
UT_ASSERT_FALSE (Status);
Status = Pkcs1v2Encrypt (
- SelfTestCert,
- (UINTN)sizeof (SelfTestCert),
- File,
- (UINTN)4,
- NULL,
- 0,
- &OutBuffer,
- (UINTN *)NULL
- );
+ SelfTestCert,
+ (UINTN)sizeof (SelfTestCert),
+ File,
+ (UINTN)4,
+ NULL,
+ 0,
+ &OutBuffer,
+ (UINTN *)NULL
+ );
UT_ASSERT_FALSE (Status);
return UNIT_TEST_PASSED;
}
-TEST_DESC mOaepTest[] = {
- //
- // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyOaepEncrypt()", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt", TestVerifyOaepEncrypt, NULL, NULL, NULL},
+TEST_DESC mOaepTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyOaepEncrypt()", "CryptoPkg.BaseCryptLib.Pkcs1v2Encrypt", TestVerifyOaepEncrypt, NULL, NULL, NULL },
};
-UINTN mOaepTestNum = ARRAY_SIZE(mOaepTest);
-
-
+UINTN mOaepTestNum = ARRAY_SIZE (mOaepTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
index b64248aa56..376188f9a3 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
@@ -11,21 +11,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// PBKDF2 HMAC-SHA1 Test Vector from RFC6070
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Password = "password"; // Input Password
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN PassLen = 8; // Length of Input Password
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Salt = "salt"; // Input Salt
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN SaltLen = 4; // Length of Input Salt
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN Count = 2; // InterationCount
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN KeyLen = 20; // Length of derived key
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DerivedKey[] = { // Expected output key
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Password = "password"; // Input Password
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN PassLen = 8; // Length of Input Password
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Salt = "salt"; // Input Salt
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN SaltLen = 4; // Length of Input Salt
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN Count = 2; // InterationCount
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN KeyLen = 20; // Length of derived key
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DerivedKey[] = {
+ // Expected output key
0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c, 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
0xd8, 0xde, 0x89, 0x57
- };
+};
UNIT_TEST_STATUS
EFIAPI
TestVerifyPkcs5Pbkdf2 (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -61,11 +62,11 @@ TestVerifyPkcs5Pbkdf2 (
return EFI_SUCCESS;
}
-TEST_DESC mPkcs5Test[] = {
- //
- // -----Description------------------------------Class----------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyPkcs5Pbkdf2()", "CryptoPkg.BaseCryptLib.Pkcs5", TestVerifyPkcs5Pbkdf2, NULL, NULL, NULL},
+TEST_DESC mPkcs5Test[] = {
+ //
+ // -----Description------------------------------Class----------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyPkcs5Pbkdf2()", "CryptoPkg.BaseCryptLib.Pkcs5", TestVerifyPkcs5Pbkdf2, NULL, NULL, NULL },
};
-UINTN mPkcs5TestNum = ARRAY_SIZE(mPkcs5Test);
+UINTN mPkcs5TestNum = ARRAY_SIZE (mPkcs5Test);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
index 9f5f813ef8..338b0a5fae 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h
@@ -24,91 +24,90 @@ Abstract:
signature files.
--*/
-
//
// This is the ProductionECCSignature.p7b in byte array format. It has one
// EKU in it. (Firmware signing)
// "1.3.6.1.4.1.311.76.9.21.1"
//
-CONST UINT8 ProductionECCSignature[] =
+CONST UINT8 ProductionECCSignature[] =
{
- 0x30, 0x82, 0x04, 0xC0, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
- 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
- 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x03, 0x80, 0x30, 0x82, 0x03, 0x7C, 0x30, 0x82, 0x03,
- 0x22, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03, 0x7E, 0x2E, 0x8F,
- 0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0A, 0x06, 0x08, 0x2A,
- 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
- 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
- 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
- 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
- 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
- 0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
- 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
- 0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
- 0x37, 0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x17, 0x0D, 0x31, 0x39, 0x30, 0x37,
- 0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x30, 0x3A, 0x31, 0x38, 0x30, 0x36, 0x06,
- 0x03, 0x55, 0x04, 0x03, 0x13, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20,
- 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41, 0x63, 0x63, 0x65,
- 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x20, 0x53,
- 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
- 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04,
- 0x7D, 0xDF, 0xDE, 0xFA, 0xEE, 0xA5, 0x66, 0x33, 0xAA, 0xCC, 0xA4, 0x18, 0x65, 0x9E, 0x3A, 0xC6,
- 0x4B, 0xCB, 0xD5, 0x78, 0x94, 0x14, 0xEE, 0xAA, 0xF3, 0x9D, 0xCB, 0x38, 0x6C, 0x5D, 0xFE, 0x3F,
- 0x8A, 0xA9, 0x8D, 0x04, 0xD2, 0xFE, 0xAA, 0x38, 0xF3, 0xD6, 0x4A, 0x7E, 0xCF, 0x12, 0x95, 0xCF,
- 0xAD, 0x92, 0x33, 0xF7, 0x38, 0x83, 0xC5, 0xFD, 0xCF, 0xD0, 0x96, 0x08, 0xCA, 0x62, 0x7D, 0x22,
- 0xA3, 0x82, 0x01, 0xAF, 0x30, 0x82, 0x01, 0xAB, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01,
- 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04,
- 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15, 0x01,
- 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1D,
- 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xE7, 0xD1, 0xD4, 0x74, 0x71, 0xF4, 0xC9,
- 0x35, 0x04, 0xA7, 0x9A, 0x1E, 0x0C, 0xDD, 0xF4, 0x8D, 0x5C, 0x1E, 0xF2, 0x29, 0x30, 0x37, 0x06,
- 0x03, 0x55, 0x1D, 0x11, 0x04, 0x30, 0x30, 0x2E, 0xA4, 0x2C, 0x30, 0x2A, 0x31, 0x10, 0x30, 0x0E,
- 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x07, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x31, 0x16,
- 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x05, 0x13, 0x0D, 0x34, 0x34, 0x30, 0x38, 0x31, 0x31, 0x2B,
- 0x34, 0x34, 0x30, 0x38, 0x36, 0x32, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30,
- 0x16, 0x80, 0x14, 0x6F, 0x3A, 0xCC, 0x1B, 0x2F, 0x17, 0x5C, 0xED, 0xEB, 0xC8, 0xBF, 0x93, 0xA7,
- 0xB5, 0x93, 0xD1, 0x4D, 0x40, 0xAA, 0x03, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x6E,
- 0x30, 0x6C, 0x30, 0x6A, 0xA0, 0x68, 0xA0, 0x66, 0x86, 0x64, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
- 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63,
- 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x4D, 0x69,
- 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45, 0x43, 0x43, 0x25, 0x32, 0x30,
- 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
- 0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x25, 0x32,
- 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x81,
- 0x82, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x76, 0x30, 0x74, 0x30,
- 0x72, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x66, 0x68, 0x74, 0x74,
- 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x65, 0x72,
- 0x74, 0x73, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45,
- 0x43, 0x43, 0x25, 0x32, 0x30, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41,
- 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77,
- 0x61, 0x72, 0x65, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E,
- 0x63, 0x72, 0x74, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03,
- 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x3D, 0xCF, 0xEF, 0xB8, 0xF0, 0x87, 0xEE, 0x7E, 0x80, 0x71,
- 0x04, 0x77, 0x68, 0xDC, 0x66, 0x2F, 0x09, 0xA7, 0xF0, 0x76, 0x57, 0x7C, 0x12, 0x5A, 0xE4, 0x80,
- 0x5A, 0xA0, 0xF2, 0x2C, 0x45, 0x1B, 0x02, 0x21, 0x00, 0xEB, 0x5F, 0x89, 0xD5, 0xEB, 0x03, 0x46,
- 0x9E, 0x08, 0x95, 0x2A, 0x39, 0x30, 0x5D, 0x49, 0xB6, 0x24, 0xCE, 0x78, 0x1B, 0xB8, 0x1D, 0x0F,
- 0xD1, 0x24, 0xD0, 0xA9, 0x18, 0x0F, 0x45, 0x4F, 0xF6, 0x31, 0x82, 0x01, 0x17, 0x30, 0x82, 0x01,
- 0x13, 0x02, 0x01, 0x01, 0x30, 0x81, 0xA7, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
- 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
- 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
- 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
- 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
- 0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
- 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
- 0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03,
- 0x7E, 0x2E, 0x8F, 0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0D,
- 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06,
- 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x48, 0x30, 0x46, 0x02, 0x21,
- 0x00, 0x85, 0xC7, 0x25, 0x5C, 0xF8, 0x5A, 0x13, 0xB7, 0xB6, 0x3A, 0xF1, 0x04, 0x72, 0xAC, 0xB3,
- 0xF8, 0xC3, 0xE0, 0xE3, 0xD7, 0x98, 0x1B, 0xCF, 0x04, 0xA8, 0x0C, 0x7B, 0xBB, 0x7D, 0x40, 0xC2,
- 0x99, 0x02, 0x21, 0x00, 0xA3, 0x83, 0x12, 0xE4, 0xB6, 0x3C, 0xC9, 0x3F, 0x05, 0xCF, 0x70, 0x57,
- 0x54, 0x74, 0x0E, 0xEC, 0x14, 0xAD, 0x2C, 0x66, 0x9D, 0x72, 0x73, 0x62, 0x41, 0xA6, 0xC7, 0x90,
- 0x05, 0x35, 0xF5, 0x80,
+ 0x30, 0x82, 0x04, 0xC0, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
+ 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
+ 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x82, 0x03, 0x80, 0x30, 0x82, 0x03, 0x7C, 0x30, 0x82, 0x03,
+ 0x22, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03, 0x7E, 0x2E, 0x8F,
+ 0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0A, 0x06, 0x08, 0x2A,
+ 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
+ 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
+ 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
+ 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
+ 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
+ 0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
+ 0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
+ 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
+ 0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x38, 0x30,
+ 0x37, 0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x17, 0x0D, 0x31, 0x39, 0x30, 0x37,
+ 0x31, 0x32, 0x31, 0x38, 0x33, 0x37, 0x30, 0x37, 0x5A, 0x30, 0x3A, 0x31, 0x38, 0x30, 0x36, 0x06,
+ 0x03, 0x55, 0x04, 0x03, 0x13, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20,
+ 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41, 0x63, 0x63, 0x65,
+ 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x20, 0x53,
+ 0x69, 0x67, 0x6E, 0x65, 0x72, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D,
+ 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04,
+ 0x7D, 0xDF, 0xDE, 0xFA, 0xEE, 0xA5, 0x66, 0x33, 0xAA, 0xCC, 0xA4, 0x18, 0x65, 0x9E, 0x3A, 0xC6,
+ 0x4B, 0xCB, 0xD5, 0x78, 0x94, 0x14, 0xEE, 0xAA, 0xF3, 0x9D, 0xCB, 0x38, 0x6C, 0x5D, 0xFE, 0x3F,
+ 0x8A, 0xA9, 0x8D, 0x04, 0xD2, 0xFE, 0xAA, 0x38, 0xF3, 0xD6, 0x4A, 0x7E, 0xCF, 0x12, 0x95, 0xCF,
+ 0xAD, 0x92, 0x33, 0xF7, 0x38, 0x83, 0xC5, 0xFD, 0xCF, 0xD0, 0x96, 0x08, 0xCA, 0x62, 0x7D, 0x22,
+ 0xA3, 0x82, 0x01, 0xAF, 0x30, 0x82, 0x01, 0xAB, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01,
+ 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04,
+ 0x0F, 0x30, 0x0D, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x4C, 0x09, 0x15, 0x01,
+ 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1D,
+ 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0xE7, 0xD1, 0xD4, 0x74, 0x71, 0xF4, 0xC9,
+ 0x35, 0x04, 0xA7, 0x9A, 0x1E, 0x0C, 0xDD, 0xF4, 0x8D, 0x5C, 0x1E, 0xF2, 0x29, 0x30, 0x37, 0x06,
+ 0x03, 0x55, 0x1D, 0x11, 0x04, 0x30, 0x30, 0x2E, 0xA4, 0x2C, 0x30, 0x2A, 0x31, 0x10, 0x30, 0x0E,
+ 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x07, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x31, 0x16,
+ 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x05, 0x13, 0x0D, 0x34, 0x34, 0x30, 0x38, 0x31, 0x31, 0x2B,
+ 0x34, 0x34, 0x30, 0x38, 0x36, 0x32, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30,
+ 0x16, 0x80, 0x14, 0x6F, 0x3A, 0xCC, 0x1B, 0x2F, 0x17, 0x5C, 0xED, 0xEB, 0xC8, 0xBF, 0x93, 0xA7,
+ 0xB5, 0x93, 0xD1, 0x4D, 0x40, 0xAA, 0x03, 0x30, 0x75, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x6E,
+ 0x30, 0x6C, 0x30, 0x6A, 0xA0, 0x68, 0xA0, 0x66, 0x86, 0x64, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
+ 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63,
+ 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x4D, 0x69,
+ 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45, 0x43, 0x43, 0x25, 0x32, 0x30,
+ 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
+ 0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72, 0x65, 0x25, 0x32,
+ 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x81,
+ 0x82, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x76, 0x30, 0x74, 0x30,
+ 0x72, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x66, 0x68, 0x74, 0x74,
+ 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x6F, 0x70, 0x73, 0x2F, 0x63, 0x65, 0x72,
+ 0x74, 0x73, 0x2F, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x25, 0x32, 0x30, 0x45,
+ 0x43, 0x43, 0x25, 0x32, 0x30, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x25, 0x32, 0x30, 0x41,
+ 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x25, 0x32, 0x30, 0x46, 0x69, 0x72, 0x6D, 0x77,
+ 0x61, 0x72, 0x65, 0x25, 0x32, 0x30, 0x43, 0x41, 0x25, 0x32, 0x30, 0x32, 0x30, 0x31, 0x38, 0x2E,
+ 0x63, 0x72, 0x74, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03,
+ 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x3D, 0xCF, 0xEF, 0xB8, 0xF0, 0x87, 0xEE, 0x7E, 0x80, 0x71,
+ 0x04, 0x77, 0x68, 0xDC, 0x66, 0x2F, 0x09, 0xA7, 0xF0, 0x76, 0x57, 0x7C, 0x12, 0x5A, 0xE4, 0x80,
+ 0x5A, 0xA0, 0xF2, 0x2C, 0x45, 0x1B, 0x02, 0x21, 0x00, 0xEB, 0x5F, 0x89, 0xD5, 0xEB, 0x03, 0x46,
+ 0x9E, 0x08, 0x95, 0x2A, 0x39, 0x30, 0x5D, 0x49, 0xB6, 0x24, 0xCE, 0x78, 0x1B, 0xB8, 0x1D, 0x0F,
+ 0xD1, 0x24, 0xD0, 0xA9, 0x18, 0x0F, 0x45, 0x4F, 0xF6, 0x31, 0x82, 0x01, 0x17, 0x30, 0x82, 0x01,
+ 0x13, 0x02, 0x01, 0x01, 0x30, 0x81, 0xA7, 0x30, 0x81, 0x8F, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
+ 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E,
+ 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E,
+ 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
+ 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x39,
+ 0x30, 0x37, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x30, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
+ 0x66, 0x74, 0x20, 0x45, 0x43, 0x43, 0x20, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x41,
+ 0x63, 0x63, 0x65, 0x73, 0x73, 0x6F, 0x72, 0x79, 0x20, 0x46, 0x69, 0x72, 0x6D, 0x77, 0x61, 0x72,
+ 0x65, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x31, 0x38, 0x02, 0x13, 0x33, 0x00, 0x00, 0x00, 0x03,
+ 0x7E, 0x2E, 0x8F, 0xBD, 0xA5, 0xC9, 0x2C, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x30, 0x0D,
+ 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06,
+ 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x05, 0x00, 0x04, 0x48, 0x30, 0x46, 0x02, 0x21,
+ 0x00, 0x85, 0xC7, 0x25, 0x5C, 0xF8, 0x5A, 0x13, 0xB7, 0xB6, 0x3A, 0xF1, 0x04, 0x72, 0xAC, 0xB3,
+ 0xF8, 0xC3, 0xE0, 0xE3, 0xD7, 0x98, 0x1B, 0xCF, 0x04, 0xA8, 0x0C, 0x7B, 0xBB, 0x7D, 0x40, 0xC2,
+ 0x99, 0x02, 0x21, 0x00, 0xA3, 0x83, 0x12, 0xE4, 0xB6, 0x3C, 0xC9, 0x3F, 0x05, 0xCF, 0x70, 0x57,
+ 0x54, 0x74, 0x0E, 0xEC, 0x14, 0xAD, 0x2C, 0x66, 0x9D, 0x72, 0x73, 0x62, 0x41, 0xA6, 0xC7, 0x90,
+ 0x05, 0x35, 0xF5, 0x80,
};
//
@@ -116,7 +115,7 @@ CONST UINT8 ProductionECCSignature[] =
// format. It has two certs in it, and the leaf has an EKU of
// "1.3.6.1.4.1.311.76.9.21.1"
//
-CONST UINT8 TestSignedMultipleCerts[] =
+CONST UINT8 TestSignedMultipleCerts[] =
{
0x30, 0x82, 0x04, 0x90, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -200,7 +199,7 @@ CONST UINT8 TestSignedMultipleCerts[] =
// "1.3.6.1.4.1.311.76.9.21.1"
// "1.3.6.1.4.1.311.76.9.21.2"
//
-CONST UINT8 TestSignedWithMultipleEKUsInCert[] =
+CONST UINT8 TestSignedWithMultipleEKUsInCert[] =
{
0x30, 0x82, 0x06, 0x2C, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -301,7 +300,6 @@ CONST UINT8 TestSignedWithMultipleEKUsInCert[] =
0xB5, 0xEA, 0xBA, 0x90, 0x51, 0xC0, 0xC6, 0x94, 0x09, 0xE4, 0xB7, 0x15, 0x3F, 0x07, 0x23, 0xE8,
0x46, 0x93, 0xA5, 0x7B, 0x7A, 0x91, 0xDA, 0x8E, 0x7C, 0xAF, 0xBD, 0x41, 0xB9, 0xDE, 0x85, 0x04,
0xBC, 0x08, 0x6C, 0x08, 0x56, 0x16, 0xDB, 0xB5, 0xEE, 0x65, 0x76, 0xE9, 0x78, 0xD3, 0xDD, 0xD8,
-
};
//
@@ -310,7 +308,7 @@ CONST UINT8 TestSignedWithMultipleEKUsInCert[] =
// "1.3.6.1.4.1.311.76.9.21.1"
// "1.3.6.1.4.1.311.76.9.21.1.10001"
//
-CONST UINT8 TestSignedWithProductId10001[] =
+CONST UINT8 TestSignedWithProductId10001[] =
{
0x30, 0x82, 0x06, 0x1E, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -418,7 +416,7 @@ CONST UINT8 TestSignedWithProductId10001[] =
// It has one EKU in it:
// "1.3.6.1.4.1.311.76.9.21.1"
//
-CONST UINT8 TestSignEKUsWith1CertInSignature[] =
+CONST UINT8 TestSignEKUsWith1CertInSignature[] =
{
0x30, 0x82, 0x02, 0x7D, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -468,7 +466,7 @@ CONST UINT8 TestSignEKUsWith1CertInSignature[] =
// It has one EKU in it:
// "1.3.6.1.4.1.311.76.9.21.1"
//
-CONST UINT8 TestSignEKUsWith2CertsInSignature[] =
+CONST UINT8 TestSignEKUsWith2CertsInSignature[] =
{
0x30, 0x82, 0x04, 0x61, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -548,7 +546,7 @@ CONST UINT8 TestSignEKUsWith2CertsInSignature[] =
// It has one EKU in it:
// "1.3.6.1.4.1.311.76.9.21.1"
//
-const UINT8 TestSignEKUsWith3CertsInSignature[] =
+const UINT8 TestSignEKUsWith3CertsInSignature[] =
{
0x30, 0x82, 0x06, 0x65, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
@@ -658,7 +656,7 @@ const UINT8 TestSignEKUsWith3CertsInSignature[] =
//
// This signature was signed with a leaf that has no EKU's present in the certificate.
//
-CONST UINT8 TestSignatureWithNoEKUsPresent[] =
+CONST UINT8 TestSignatureWithNoEKUsPresent[] =
{
0x30, 0x82, 0x07, 0xDB, 0x02, 0x01, 0x01, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
index b5ae4f6a89..7e3dcdc4e6 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c
@@ -50,23 +50,22 @@
EFI_STATUS
EFIAPI
VerifyEKUsInPkcs7Signature (
- IN CONST UINT8 *Pkcs7Signature,
+ IN CONST UINT8 *Pkcs7Signature,
IN CONST UINT32 SignatureSize,
- IN CONST CHAR8 *RequiredEKUs[],
+ IN CONST CHAR8 *RequiredEKUs[],
IN CONST UINT32 RequiredEKUsSize,
IN BOOLEAN RequireAllPresent
);
-///================================================================================================
-///================================================================================================
+/// ================================================================================================
+/// ================================================================================================
///
/// TEST CASES
///
-///================================================================================================
-///================================================================================================
-
-CONST CHAR8 FIRMWARE_SIGNER_EKU[] = "1.3.6.1.4.1.311.76.9.21.1";
+/// ================================================================================================
+/// ================================================================================================
+CONST CHAR8 FIRMWARE_SIGNER_EKU[] = "1.3.6.1.4.1.311.76.9.21.1";
/**
TestVerifyEKUsInSignature()
@@ -85,24 +84,25 @@ static
UNIT_TEST_STATUS
EFIAPI
TestVerifyEKUsInSignature (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
- CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
+ CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
- Status = VerifyEKUsInPkcs7Signature(ProductionECCSignature,
- ARRAY_SIZE(ProductionECCSignature),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ ProductionECCSignature,
+ ARRAY_SIZE (ProductionECCSignature),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestVerifyEKUsInSignature()
-
/**
TestVerifyEKUsWith3CertsInSignature()
@@ -120,18 +120,20 @@ static
UNIT_TEST_STATUS
EFIAPI
TestVerifyEKUsWith3CertsInSignature (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
- CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
+ CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
- Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith3CertsInSignature,
- ARRAY_SIZE(TestSignEKUsWith3CertsInSignature),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignEKUsWith3CertsInSignature,
+ ARRAY_SIZE (TestSignEKUsWith3CertsInSignature),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
@@ -153,24 +155,25 @@ static
UNIT_TEST_STATUS
EFIAPI
TestVerifyEKUsWith2CertsInSignature (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
- CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
+ CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
- Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith2CertsInSignature,
- ARRAY_SIZE(TestSignEKUsWith2CertsInSignature),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignEKUsWith2CertsInSignature,
+ ARRAY_SIZE (TestSignEKUsWith2CertsInSignature),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestVerifyEKUsWith2CertsInSignature()
-
/**
TestVerifyEKUsWith1CertInSignature()
@@ -187,24 +190,25 @@ static
UNIT_TEST_STATUS
EFIAPI
TestVerifyEKUsWith1CertInSignature (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
- CONST CHAR8* RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
+ CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
- Status = VerifyEKUsInPkcs7Signature(TestSignEKUsWith1CertInSignature,
- ARRAY_SIZE(TestSignEKUsWith1CertInSignature),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignEKUsWith1CertInSignature,
+ ARRAY_SIZE (TestSignEKUsWith1CertInSignature),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestVerifyEKUsWith1CertInSignature()
-
/**
TestVerifyEKUsWithMultipleEKUsInCert()
@@ -224,25 +228,28 @@ static
UNIT_TEST_STATUS
EFIAPI
TestVerifyEKUsWithMultipleEKUsInCert (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
-
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1",
- "1.3.6.1.4.1.311.76.9.21.1.2" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithMultipleEKUsInCert,
- ARRAY_SIZE(TestSignedWithMultipleEKUsInCert),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ CONST CHAR8 *RequiredEKUs[] = {
+ "1.3.6.1.4.1.311.76.9.21.1",
+ "1.3.6.1.4.1.311.76.9.21.1.2"
+ };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithMultipleEKUsInCert,
+ ARRAY_SIZE (TestSignedWithMultipleEKUsInCert),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestVerifyEKUsWithMultipleEKUsInCert()
-
/**
TestEkusNotPresentInSignature()
@@ -259,21 +266,23 @@ static
UNIT_TEST_STATUS
EFIAPI
TestEkusNotPresentInSignature (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
//
// This EKU is not in the signature.
//
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.3" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithMultipleEKUsInCert,
- ARRAY_SIZE(TestSignedWithMultipleEKUsInCert),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ CONST CHAR8 *RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.3" };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithMultipleEKUsInCert,
+ ARRAY_SIZE (TestSignedWithMultipleEKUsInCert),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
@@ -292,33 +301,35 @@ TestEkusNotPresentInSignature (
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
**/
-
static
UNIT_TEST_STATUS
EFIAPI
-TestProductId10001PresentInSignature(
- IN UNIT_TEST_CONTEXT Context
-)
+TestProductId10001PresentInSignature (
+ IN UNIT_TEST_CONTEXT Context
+ )
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
//
// These EKU's are present in the leaf signer certificate.
//
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1",
- "1.3.6.1.4.1.311.76.9.21.1.10001" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
- ARRAY_SIZE(TestSignedWithProductId10001),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ CONST CHAR8 *RequiredEKUs[] = {
+ "1.3.6.1.4.1.311.76.9.21.1",
+ "1.3.6.1.4.1.311.76.9.21.1.10001"
+ };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithProductId10001,
+ ARRAY_SIZE (TestSignedWithProductId10001),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestProductId10001PresentInSignature()
-
/**
TestOnlyOneEkuInListRequired()
@@ -337,27 +348,28 @@ TestProductId10001PresentInSignature(
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
**/
-
static
UNIT_TEST_STATUS
EFIAPI
-TestOnlyOneEkuInListRequired(
- IN UNIT_TEST_CONTEXT Context
-)
+TestOnlyOneEkuInListRequired (
+ IN UNIT_TEST_CONTEXT Context
+ )
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
//
// This will test the flag that specifies it is OK to succeed if
// any one of the EKU's passed in is found.
//
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1.10001" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
- ARRAY_SIZE(TestSignedWithProductId10001),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- FALSE);
+ CONST CHAR8 *RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1.10001" };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithProductId10001,
+ ARRAY_SIZE (TestSignedWithProductId10001),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ FALSE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
@@ -376,32 +388,32 @@ TestOnlyOneEkuInListRequired(
@retval UNIT_TEST_PASSED - The required EKUs were found in the signature.
@retval UNIT_TEST_ERROR_TEST_FAILED - Something failed, check the debug output.
**/
-
static
UNIT_TEST_STATUS
EFIAPI
-TestNoEKUsInSignature(
- IN UNIT_TEST_CONTEXT Context
-)
+TestNoEKUsInSignature (
+ IN UNIT_TEST_CONTEXT Context
+ )
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
//
// This EKU is not in the certificate, so it should fail.
//
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignatureWithNoEKUsPresent,
- ARRAY_SIZE(TestSignatureWithNoEKUsPresent),
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ CONST CHAR8 *RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignatureWithNoEKUsPresent,
+ ARRAY_SIZE (TestSignatureWithNoEKUsPresent),
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestNoEKUsInSignature()
-
/**
TestInvalidParameters()
@@ -416,38 +428,41 @@ TestNoEKUsInSignature(
static
UNIT_TEST_STATUS
EFIAPI
-TestInvalidParameters(
- IN UNIT_TEST_CONTEXT Context
-)
+TestInvalidParameters (
+ IN UNIT_TEST_CONTEXT Context
+ )
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
- CONST CHAR8* RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
+ CONST CHAR8 *RequiredEKUs[] = { "1.3.6.1.4.1.311.76.9.21.1" };
//
// Check bad signature.
//
- Status = VerifyEKUsInPkcs7Signature(NULL,
- 0,
- (CONST CHAR8**)RequiredEKUs,
- ARRAY_SIZE(RequiredEKUs),
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ NULL,
+ 0,
+ (CONST CHAR8 **)RequiredEKUs,
+ ARRAY_SIZE (RequiredEKUs),
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_INVALID_PARAMETER);
//
// Check invalid EKU's
//
- Status = VerifyEKUsInPkcs7Signature(TestSignatureWithNoEKUsPresent,
- ARRAY_SIZE(TestSignatureWithNoEKUsPresent),
- (CONST CHAR8**)NULL,
- 0,
- TRUE);
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignatureWithNoEKUsPresent,
+ ARRAY_SIZE (TestSignatureWithNoEKUsPresent),
+ (CONST CHAR8 **)NULL,
+ 0,
+ TRUE
+ );
UT_ASSERT_STATUS_EQUAL (Status, EFI_INVALID_PARAMETER);
return UNIT_TEST_PASSED;
}// TestInvalidParameters()
-
/**
TestEKUSubStringFails()
@@ -463,11 +478,11 @@ TestInvalidParameters(
static
UNIT_TEST_STATUS
EFIAPI
-TestEKUSubsetSupersetFails(
- IN UNIT_TEST_CONTEXT Context
-)
+TestEKUSubsetSupersetFails (
+ IN UNIT_TEST_CONTEXT Context
+ )
{
- EFI_STATUS Status = EFI_SUCCESS;
+ EFI_STATUS Status = EFI_SUCCESS;
//
// This signature has an EKU of:
@@ -476,13 +491,15 @@ TestEKUSubsetSupersetFails(
// "1.3.6.1.4.1.311.76.9.21"
// does not pass.
//
- CONST CHAR8* RequiredEKUs1[] = { "1.3.6.1.4.1.311.76.9.21" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
- ARRAY_SIZE(TestSignedWithProductId10001),
- (CONST CHAR8**)RequiredEKUs1,
- ARRAY_SIZE(RequiredEKUs1),
- TRUE);
+ CONST CHAR8 *RequiredEKUs1[] = { "1.3.6.1.4.1.311.76.9.21" };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithProductId10001,
+ ARRAY_SIZE (TestSignedWithProductId10001),
+ (CONST CHAR8 **)RequiredEKUs1,
+ ARRAY_SIZE (RequiredEKUs1),
+ TRUE
+ );
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
//
@@ -492,33 +509,35 @@ TestEKUSubsetSupersetFails(
// "1.3.6.1.4.1.311.76.9.21.1.10001.1"
// does not pass.
//
- CONST CHAR8* RequiredEKUs2[] = { "1.3.6.1.4.1.311.76.9.21.1.10001.1" };
-
- Status = VerifyEKUsInPkcs7Signature(TestSignedWithProductId10001,
- ARRAY_SIZE(TestSignedWithProductId10001),
- (CONST CHAR8**)RequiredEKUs2,
- ARRAY_SIZE(RequiredEKUs2),
- TRUE);
+ CONST CHAR8 *RequiredEKUs2[] = { "1.3.6.1.4.1.311.76.9.21.1.10001.1" };
+
+ Status = VerifyEKUsInPkcs7Signature (
+ TestSignedWithProductId10001,
+ ARRAY_SIZE (TestSignedWithProductId10001),
+ (CONST CHAR8 **)RequiredEKUs2,
+ ARRAY_SIZE (RequiredEKUs2),
+ TRUE
+ );
UT_ASSERT_NOT_EQUAL (Status, EFI_SUCCESS);
return UNIT_TEST_PASSED;
}// TestEKUSubsetSupersetFails()
-TEST_DESC mPkcs7EkuTest[] = {
- //
- // -----Description--------------------------------Class----------------------------Function------------------------------Pre---Post--Context
- //
- {"TestVerifyEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsInSignature, NULL, NULL, NULL},
- {"TestVerifyEKUsWith3CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith3CertsInSignature, NULL, NULL, NULL},
- {"TestVerifyEKUsWith2CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith2CertsInSignature, NULL, NULL, NULL},
- {"TestVerifyEKUsWith1CertInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith1CertInSignature, NULL, NULL, NULL},
- {"TestVerifyEKUsWithMultipleEKUsInCert()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWithMultipleEKUsInCert, NULL, NULL, NULL},
- {"TestEkusNotPresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestEkusNotPresentInSignature, NULL, NULL, NULL},
- {"TestProductId10001PresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestProductId10001PresentInSignature, NULL, NULL, NULL},
- {"TestOnlyOneEkuInListRequired()", "CryptoPkg.BaseCryptLib.Eku", TestOnlyOneEkuInListRequired, NULL, NULL, NULL},
- {"TestNoEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestNoEKUsInSignature, NULL, NULL, NULL},
- {"TestInvalidParameters()", "CryptoPkg.BaseCryptLib.Eku", TestInvalidParameters, NULL, NULL, NULL},
- {"TestEKUSubsetSupersetFails()", "CryptoPkg.BaseCryptLib.Eku", TestEKUSubsetSupersetFails, NULL, NULL, NULL},
+TEST_DESC mPkcs7EkuTest[] = {
+ //
+ // -----Description--------------------------------Class----------------------------Function------------------------------Pre---Post--Context
+ //
+ { "TestVerifyEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsInSignature, NULL, NULL, NULL },
+ { "TestVerifyEKUsWith3CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith3CertsInSignature, NULL, NULL, NULL },
+ { "TestVerifyEKUsWith2CertsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith2CertsInSignature, NULL, NULL, NULL },
+ { "TestVerifyEKUsWith1CertInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith1CertInSignature, NULL, NULL, NULL },
+ { "TestVerifyEKUsWithMultipleEKUsInCert()", "CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWithMultipleEKUsInCert, NULL, NULL, NULL },
+ { "TestEkusNotPresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestEkusNotPresentInSignature, NULL, NULL, NULL },
+ { "TestProductId10001PresentInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestProductId10001PresentInSignature, NULL, NULL, NULL },
+ { "TestOnlyOneEkuInListRequired()", "CryptoPkg.BaseCryptLib.Eku", TestOnlyOneEkuInListRequired, NULL, NULL, NULL },
+ { "TestNoEKUsInSignature()", "CryptoPkg.BaseCryptLib.Eku", TestNoEKUsInSignature, NULL, NULL, NULL },
+ { "TestInvalidParameters()", "CryptoPkg.BaseCryptLib.Eku", TestInvalidParameters, NULL, NULL, NULL },
+ { "TestEKUSubsetSupersetFails()", "CryptoPkg.BaseCryptLib.Eku", TestEKUSubsetSupersetFails, NULL, NULL, NULL },
};
-UINTN mPkcs7EkuTestNum = ARRAY_SIZE(mPkcs7EkuTest);
+UINTN mPkcs7EkuTestNum = ARRAY_SIZE (mPkcs7EkuTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
index cc6b2ca46b..9d297f0052 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c
@@ -19,7 +19,7 @@ UINT8 RandomBuffer[RANDOM_NUMBER_SIZE] = { 0x0 };
UNIT_TEST_STATUS
EFIAPI
TestVerifyPrngGeneration (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
UINTN Index;
@@ -28,7 +28,7 @@ TestVerifyPrngGeneration (
Status = RandomSeed (SeedString, sizeof (SeedString));
UT_ASSERT_TRUE (Status);
- for (Index = 0; Index < 10; Index ++) {
+ for (Index = 0; Index < 10; Index++) {
Status = RandomBytes (RandomBuffer, RANDOM_NUMBER_SIZE);
UT_ASSERT_TRUE (Status);
@@ -41,11 +41,11 @@ TestVerifyPrngGeneration (
return UNIT_TEST_PASSED;
}
-TEST_DESC mPrngTest[] = {
- //
- // -----Description--------------------------------Class--------------------Function----------------Pre---Post--Context
- //
- {"TestVerifyPrngGeneration()", "CryptoPkg.BaseCryptLib.Prng", TestVerifyPrngGeneration, NULL, NULL, NULL},
+TEST_DESC mPrngTest[] = {
+ //
+ // -----Description--------------------------------Class--------------------Function----------------Pre---Post--Context
+ //
+ { "TestVerifyPrngGeneration()", "CryptoPkg.BaseCryptLib.Prng", TestVerifyPrngGeneration, NULL, NULL, NULL },
};
-UINTN mPrngTestNum = ARRAY_SIZE(mPrngTest);
+UINTN mPrngTestNum = ARRAY_SIZE (mPrngTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
index 85a3d6a5a1..8b464cb694 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c
@@ -9,7 +9,6 @@
#include "TestBaseCryptLib.h"
-
//
// Password-protected PEM Key data for RSA Private Key Retrieving (encryption key is "client").
// (Generated by OpenSSL utility).
@@ -17,8 +16,8 @@
// password should match PemPass in this file
// $ xxd --include TestKeyPem
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestKeyPem[] = {
- 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestKeyPem[] = {
+ 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52,
0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b,
0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x50, 0x72, 0x6f, 0x63,
0x2d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x34, 0x2c, 0x45, 0x4e, 0x43,
@@ -99,12 +98,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestKeyPem[] = {
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41,
0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a
- };
+};
//
// Password for private key retrieving from encrypted PEM ("TestKeyPem").
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *PemPass = "client";
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *PemPass = "client";
//
// Test CA X509 Certificate for X509 Verification Routine (Generated by OpenSSL utility).
@@ -112,7 +111,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *PemPass = "client";
// use password from PemPass variable in this file
// $ xxd --include TestCACert
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCACert[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCACert[] = {
0x30, 0x82, 0x02, 0x98, 0x30, 0x82, 0x02, 0x01, 0xa0, 0x03, 0x02, 0x01,
0x02, 0x02, 0x14, 0x39, 0xde, 0x9e, 0xce, 0x3a, 0x36, 0x11, 0x38, 0x6f,
0x64, 0xb4, 0x69, 0xa7, 0x93, 0xdd, 0xff, 0xbd, 0x3e, 0x75, 0x6a, 0x30,
@@ -177,7 +176,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCACert[] = {
// $ openssl x509 -days 10000 -CA TestCACert.pem -CAkey TestKeyPem -req -out TestCert -set_serial 3432 --outform DER -in TestCertCsr
// password should be in the PemPass variable
// $ xxd --include TestCert
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCert[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCert[] = {
0x30, 0x82, 0x02, 0x31, 0x30, 0x82, 0x01, 0x9a, 0x02, 0x02, 0x0d, 0x68,
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
0x0b, 0x05, 0x00, 0x30, 0x5e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
@@ -231,21 +230,20 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 TestCert[] = {
//
// Message Hash for Signing & Verification Validation.
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 MsgHash[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 MsgHash[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
- };
+};
//
// Payload for PKCS#7 Signing & Verification Validation.
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Payload = "Payload Data for PKCS#7 Signing";
-
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *Payload = "Payload Data for PKCS#7 Signing";
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaCertPkcs1SignVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -296,9 +294,9 @@ TestVerifyRsaCertPkcs1SignVerify (
// X509 Certificate Subject Retrieving.
//
SubjectSize = 0;
- Status = X509GetSubjectName (TestCert, sizeof (TestCert), NULL, &SubjectSize);
- Subject = (UINT8 *)AllocatePool (SubjectSize);
- Status = X509GetSubjectName (TestCert, sizeof (TestCert), Subject, &SubjectSize);
+ Status = X509GetSubjectName (TestCert, sizeof (TestCert), NULL, &SubjectSize);
+ Subject = (UINT8 *)AllocatePool (SubjectSize);
+ Status = X509GetSubjectName (TestCert, sizeof (TestCert), Subject, &SubjectSize);
UT_ASSERT_TRUE (Status);
//
@@ -329,8 +327,8 @@ TestVerifyRsaCertPkcs1SignVerify (
//
// Release Resources.
//
- RsaFree (RsaPubKey);
- RsaFree (RsaPrivKey);
+ RsaFree (RsaPubKey);
+ RsaFree (RsaPrivKey);
FreePool (Signature);
FreePool (Subject);
@@ -340,7 +338,7 @@ TestVerifyRsaCertPkcs1SignVerify (
UNIT_TEST_STATUS
EFIAPI
TestVerifyPkcs7SignVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -354,7 +352,7 @@ TestVerifyPkcs7SignVerify (
//
// Construct Signer Certificate from RAW data.
//
- Status = X509ConstructCertificate (TestCert, sizeof (TestCert), (UINT8 **) &SignCert);
+ Status = X509ConstructCertificate (TestCert, sizeof (TestCert), (UINT8 **)&SignCert);
UT_ASSERT_TRUE (Status);
UT_ASSERT_NOT_NULL (SignCert);
@@ -365,8 +363,8 @@ TestVerifyPkcs7SignVerify (
Status = Pkcs7Sign (
TestKeyPem,
sizeof (TestKeyPem),
- (CONST UINT8 *) PemPass,
- (UINT8 *) Payload,
+ (CONST UINT8 *)PemPass,
+ (UINT8 *)Payload,
AsciiStrLen (Payload),
SignCert,
NULL,
@@ -381,7 +379,7 @@ TestVerifyPkcs7SignVerify (
P7SignedDataSize,
TestCACert,
sizeof (TestCACert),
- (UINT8 *) Payload,
+ (UINT8 *)Payload,
AsciiStrLen (Payload)
);
UT_ASSERT_TRUE (Status);
@@ -389,6 +387,7 @@ TestVerifyPkcs7SignVerify (
if (P7SignedData != NULL) {
FreePool (P7SignedData);
}
+
if (SignCert != NULL) {
X509Free (SignCert);
}
@@ -396,20 +395,20 @@ TestVerifyPkcs7SignVerify (
return UNIT_TEST_PASSED;
}
-TEST_DESC mRsaCertTest[] = {
- //
- // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyRsaCertPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.RsaCert", TestVerifyRsaCertPkcs1SignVerify, NULL, NULL, NULL},
+TEST_DESC mRsaCertTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyRsaCertPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.RsaCert", TestVerifyRsaCertPkcs1SignVerify, NULL, NULL, NULL },
};
-UINTN mRsaCertTestNum = ARRAY_SIZE(mRsaCertTest);
+UINTN mRsaCertTestNum = ARRAY_SIZE (mRsaCertTest);
-TEST_DESC mPkcs7Test[] = {
- //
- // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyPkcs7SignVerify()", "CryptoPkg.BaseCryptLib.Pkcs7", TestVerifyPkcs7SignVerify, NULL, NULL, NULL},
+TEST_DESC mPkcs7Test[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyPkcs7SignVerify()", "CryptoPkg.BaseCryptLib.Pkcs7", TestVerifyPkcs7SignVerify, NULL, NULL, NULL },
};
-UINTN mPkcs7TestNum = ARRAY_SIZE(mPkcs7Test);
+UINTN mPkcs7TestNum = ARRAY_SIZE (mPkcs7Test);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPssTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPssTests.c
index 7970523c5f..42baf88524 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPssTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPssTests.c
@@ -15,103 +15,102 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Public Modulus of RSA Key
//
-UINT8 RsaPssN[]={
- 0xa4, 0x7d, 0x04, 0xe7, 0xca, 0xcd, 0xba, 0x4e, 0xa2, 0x6e, 0xca, 0x8a, 0x4c, 0x6e, 0x14, 0x56,
- 0x3c, 0x2c, 0xe0, 0x3b, 0x62, 0x3b, 0x76, 0x8c, 0x0d, 0x49, 0x86, 0x8a, 0x57, 0x12, 0x13, 0x01,
- 0xdb, 0xf7, 0x83, 0xd8, 0x2f, 0x4c, 0x05, 0x5e, 0x73, 0x96, 0x0e, 0x70, 0x55, 0x01, 0x87, 0xd0,
- 0xaf, 0x62, 0xac, 0x34, 0x96, 0xf0, 0xa3, 0xd9, 0x10, 0x3c, 0x2e, 0xb7, 0x91, 0x9a, 0x72, 0x75,
- 0x2f, 0xa7, 0xce, 0x8c, 0x68, 0x8d, 0x81, 0xe3, 0xae, 0xe9, 0x94, 0x68, 0x88, 0x7a, 0x15, 0x28,
- 0x8a, 0xfb, 0xb7, 0xac, 0xb8, 0x45, 0xb7, 0xc5, 0x22, 0xb5, 0xc6, 0x4e, 0x67, 0x8f, 0xcd, 0x3d,
- 0x22, 0xfe, 0xb8, 0x4b, 0x44, 0x27, 0x27, 0x00, 0xbe, 0x52, 0x7d, 0x2b, 0x20, 0x25, 0xa3, 0xf8,
- 0x3c, 0x23, 0x83, 0xbf, 0x6a, 0x39, 0xcf, 0x5b, 0x4e, 0x48, 0xb3, 0xcf, 0x2f, 0x56, 0xee, 0xf0,
- 0xdf, 0xff, 0x18, 0x55, 0x5e, 0x31, 0x03, 0x7b, 0x91, 0x52, 0x48, 0x69, 0x48, 0x76, 0xf3, 0x04,
- 0x78, 0x14, 0x41, 0x51, 0x64, 0xf2, 0xc6, 0x60, 0x88, 0x1e, 0x69, 0x4b, 0x58, 0xc2, 0x80, 0x38,
- 0xa0, 0x32, 0xad, 0x25, 0x63, 0x4a, 0xad, 0x7b, 0x39, 0x17, 0x1d, 0xee, 0x36, 0x8e, 0x3d, 0x59,
- 0xbf, 0xb7, 0x29, 0x9e, 0x46, 0x01, 0xd4, 0x58, 0x7e, 0x68, 0xca, 0xaf, 0x8d, 0xb4, 0x57, 0xb7,
- 0x5a, 0xf4, 0x2f, 0xc0, 0xcf, 0x1a, 0xe7, 0xca, 0xce, 0xd2, 0x86, 0xd7, 0x7f, 0xac, 0x6c, 0xed,
- 0xb0, 0x3a, 0xd9, 0x4f, 0x14, 0x33, 0xd2, 0xc9, 0x4d, 0x08, 0xe6, 0x0b, 0xc1, 0xfd, 0xef, 0x05,
- 0x43, 0xcd, 0x29, 0x51, 0xe7, 0x65, 0xb3, 0x82, 0x30, 0xfd, 0xd1, 0x8d, 0xe5, 0xd2, 0xca, 0x62,
- 0x7d, 0xdc, 0x03, 0x2f, 0xe0, 0x5b, 0xbd, 0x2f, 0xf2, 0x1e, 0x2d, 0xb1, 0xc2, 0xf9, 0x4d, 0x8b,
- };
+UINT8 RsaPssN[] = {
+ 0xa4, 0x7d, 0x04, 0xe7, 0xca, 0xcd, 0xba, 0x4e, 0xa2, 0x6e, 0xca, 0x8a, 0x4c, 0x6e, 0x14, 0x56,
+ 0x3c, 0x2c, 0xe0, 0x3b, 0x62, 0x3b, 0x76, 0x8c, 0x0d, 0x49, 0x86, 0x8a, 0x57, 0x12, 0x13, 0x01,
+ 0xdb, 0xf7, 0x83, 0xd8, 0x2f, 0x4c, 0x05, 0x5e, 0x73, 0x96, 0x0e, 0x70, 0x55, 0x01, 0x87, 0xd0,
+ 0xaf, 0x62, 0xac, 0x34, 0x96, 0xf0, 0xa3, 0xd9, 0x10, 0x3c, 0x2e, 0xb7, 0x91, 0x9a, 0x72, 0x75,
+ 0x2f, 0xa7, 0xce, 0x8c, 0x68, 0x8d, 0x81, 0xe3, 0xae, 0xe9, 0x94, 0x68, 0x88, 0x7a, 0x15, 0x28,
+ 0x8a, 0xfb, 0xb7, 0xac, 0xb8, 0x45, 0xb7, 0xc5, 0x22, 0xb5, 0xc6, 0x4e, 0x67, 0x8f, 0xcd, 0x3d,
+ 0x22, 0xfe, 0xb8, 0x4b, 0x44, 0x27, 0x27, 0x00, 0xbe, 0x52, 0x7d, 0x2b, 0x20, 0x25, 0xa3, 0xf8,
+ 0x3c, 0x23, 0x83, 0xbf, 0x6a, 0x39, 0xcf, 0x5b, 0x4e, 0x48, 0xb3, 0xcf, 0x2f, 0x56, 0xee, 0xf0,
+ 0xdf, 0xff, 0x18, 0x55, 0x5e, 0x31, 0x03, 0x7b, 0x91, 0x52, 0x48, 0x69, 0x48, 0x76, 0xf3, 0x04,
+ 0x78, 0x14, 0x41, 0x51, 0x64, 0xf2, 0xc6, 0x60, 0x88, 0x1e, 0x69, 0x4b, 0x58, 0xc2, 0x80, 0x38,
+ 0xa0, 0x32, 0xad, 0x25, 0x63, 0x4a, 0xad, 0x7b, 0x39, 0x17, 0x1d, 0xee, 0x36, 0x8e, 0x3d, 0x59,
+ 0xbf, 0xb7, 0x29, 0x9e, 0x46, 0x01, 0xd4, 0x58, 0x7e, 0x68, 0xca, 0xaf, 0x8d, 0xb4, 0x57, 0xb7,
+ 0x5a, 0xf4, 0x2f, 0xc0, 0xcf, 0x1a, 0xe7, 0xca, 0xce, 0xd2, 0x86, 0xd7, 0x7f, 0xac, 0x6c, 0xed,
+ 0xb0, 0x3a, 0xd9, 0x4f, 0x14, 0x33, 0xd2, 0xc9, 0x4d, 0x08, 0xe6, 0x0b, 0xc1, 0xfd, 0xef, 0x05,
+ 0x43, 0xcd, 0x29, 0x51, 0xe7, 0x65, 0xb3, 0x82, 0x30, 0xfd, 0xd1, 0x8d, 0xe5, 0xd2, 0xca, 0x62,
+ 0x7d, 0xdc, 0x03, 0x2f, 0xe0, 0x5b, 0xbd, 0x2f, 0xf2, 0x1e, 0x2d, 0xb1, 0xc2, 0xf9, 0x4d, 0x8b,
+};
//
// Public Exponent of RSA Key
//
-UINT8 RsaPssE[]={ 0x10, 0xe4, 0x3f };
+UINT8 RsaPssE[] = { 0x10, 0xe4, 0x3f };
//
// Private Exponent of RSA Key
//
-UINT8 RsaPssD[]={
- 0x11, 0xa0, 0xdd, 0x28, 0x5f, 0x66, 0x47, 0x1a, 0x8d, 0xa3, 0x0b, 0xcb, 0x8c, 0x24, 0xa1, 0xd5,
- 0xc8, 0xdb, 0x94, 0x2f, 0xc9, 0x92, 0x07, 0x97, 0xca, 0x44, 0x24, 0x60, 0xa8, 0x00, 0xb7, 0x5b,
- 0xbc, 0x73, 0x8b, 0xeb, 0x8e, 0xe0, 0xe8, 0x74, 0xb0, 0x53, 0xe6, 0x47, 0x07, 0xdf, 0x4c, 0xfc,
- 0x78, 0x37, 0xc4, 0x0e, 0x5b, 0xe6, 0x8b, 0x8a, 0x8e, 0x1d, 0x01, 0x45, 0x16, 0x9c, 0xa6, 0x27,
- 0x1d, 0x81, 0x88, 0x7e, 0x19, 0xa1, 0xcd, 0x95, 0xb2, 0xfd, 0x0d, 0xe0, 0xdb, 0xa3, 0x47, 0xfe,
- 0x63, 0x7b, 0xcc, 0x6c, 0xdc, 0x24, 0xee, 0xbe, 0x03, 0xc2, 0x4d, 0x4c, 0xf3, 0xa5, 0xc6, 0x15,
- 0x4d, 0x78, 0xf1, 0x41, 0xfe, 0x34, 0x16, 0x99, 0x24, 0xd0, 0xf8, 0x95, 0x33, 0x65, 0x8e, 0xac,
- 0xfd, 0xea, 0xe9, 0x9c, 0xe1, 0xa8, 0x80, 0x27, 0xc1, 0x8f, 0xf9, 0x26, 0x53, 0xa8, 0x35, 0xaa,
- 0x38, 0x91, 0xbf, 0xff, 0xcd, 0x38, 0x8f, 0xfc, 0x23, 0x88, 0xce, 0x2b, 0x10, 0x56, 0x85, 0x43,
- 0x75, 0x05, 0x02, 0xcc, 0xbc, 0x69, 0xc0, 0x08, 0x8f, 0x1d, 0x69, 0x0e, 0x97, 0xa5, 0xf5, 0xbd,
- 0xd1, 0x88, 0x8c, 0xd2, 0xfa, 0xa4, 0x3c, 0x04, 0xae, 0x24, 0x53, 0x95, 0x22, 0xdd, 0xe2, 0xd9,
- 0xc2, 0x02, 0xf6, 0x55, 0xfc, 0x55, 0x75, 0x44, 0x40, 0xb5, 0x3a, 0x15, 0x32, 0xaa, 0xb4, 0x78,
- 0x51, 0xf6, 0x0b, 0x7a, 0x06, 0x7e, 0x24, 0x0b, 0x73, 0x8e, 0x1b, 0x1d, 0xaa, 0xe6, 0xca, 0x0d,
- 0x59, 0xee, 0xae, 0x27, 0x68, 0x6c, 0xd8, 0x88, 0x57, 0xe9, 0xad, 0xad, 0xc2, 0xd4, 0xb8, 0x2b,
- 0x07, 0xa6, 0x1a, 0x35, 0x84, 0x56, 0xaa, 0xf8, 0x07, 0x66, 0x96, 0x93, 0xff, 0xb1, 0x3c, 0x99,
- 0x64, 0xa6, 0x36, 0x54, 0xca, 0xdc, 0x81, 0xee, 0x59, 0xdf, 0x51, 0x1c, 0xa3, 0xa4, 0xbd, 0x67,
- };
+UINT8 RsaPssD[] = {
+ 0x11, 0xa0, 0xdd, 0x28, 0x5f, 0x66, 0x47, 0x1a, 0x8d, 0xa3, 0x0b, 0xcb, 0x8c, 0x24, 0xa1, 0xd5,
+ 0xc8, 0xdb, 0x94, 0x2f, 0xc9, 0x92, 0x07, 0x97, 0xca, 0x44, 0x24, 0x60, 0xa8, 0x00, 0xb7, 0x5b,
+ 0xbc, 0x73, 0x8b, 0xeb, 0x8e, 0xe0, 0xe8, 0x74, 0xb0, 0x53, 0xe6, 0x47, 0x07, 0xdf, 0x4c, 0xfc,
+ 0x78, 0x37, 0xc4, 0x0e, 0x5b, 0xe6, 0x8b, 0x8a, 0x8e, 0x1d, 0x01, 0x45, 0x16, 0x9c, 0xa6, 0x27,
+ 0x1d, 0x81, 0x88, 0x7e, 0x19, 0xa1, 0xcd, 0x95, 0xb2, 0xfd, 0x0d, 0xe0, 0xdb, 0xa3, 0x47, 0xfe,
+ 0x63, 0x7b, 0xcc, 0x6c, 0xdc, 0x24, 0xee, 0xbe, 0x03, 0xc2, 0x4d, 0x4c, 0xf3, 0xa5, 0xc6, 0x15,
+ 0x4d, 0x78, 0xf1, 0x41, 0xfe, 0x34, 0x16, 0x99, 0x24, 0xd0, 0xf8, 0x95, 0x33, 0x65, 0x8e, 0xac,
+ 0xfd, 0xea, 0xe9, 0x9c, 0xe1, 0xa8, 0x80, 0x27, 0xc1, 0x8f, 0xf9, 0x26, 0x53, 0xa8, 0x35, 0xaa,
+ 0x38, 0x91, 0xbf, 0xff, 0xcd, 0x38, 0x8f, 0xfc, 0x23, 0x88, 0xce, 0x2b, 0x10, 0x56, 0x85, 0x43,
+ 0x75, 0x05, 0x02, 0xcc, 0xbc, 0x69, 0xc0, 0x08, 0x8f, 0x1d, 0x69, 0x0e, 0x97, 0xa5, 0xf5, 0xbd,
+ 0xd1, 0x88, 0x8c, 0xd2, 0xfa, 0xa4, 0x3c, 0x04, 0xae, 0x24, 0x53, 0x95, 0x22, 0xdd, 0xe2, 0xd9,
+ 0xc2, 0x02, 0xf6, 0x55, 0xfc, 0x55, 0x75, 0x44, 0x40, 0xb5, 0x3a, 0x15, 0x32, 0xaa, 0xb4, 0x78,
+ 0x51, 0xf6, 0x0b, 0x7a, 0x06, 0x7e, 0x24, 0x0b, 0x73, 0x8e, 0x1b, 0x1d, 0xaa, 0xe6, 0xca, 0x0d,
+ 0x59, 0xee, 0xae, 0x27, 0x68, 0x6c, 0xd8, 0x88, 0x57, 0xe9, 0xad, 0xad, 0xc2, 0xd4, 0xb8, 0x2b,
+ 0x07, 0xa6, 0x1a, 0x35, 0x84, 0x56, 0xaa, 0xf8, 0x07, 0x66, 0x96, 0x93, 0xff, 0xb1, 0x3c, 0x99,
+ 0x64, 0xa6, 0x36, 0x54, 0xca, 0xdc, 0x81, 0xee, 0x59, 0xdf, 0x51, 0x1c, 0xa3, 0xa4, 0xbd, 0x67,
+};
//
// Binary message to be signed and verified
//
-UINT8 PssMessage[]={
- 0xe0, 0x02, 0x37, 0x7a, 0xff, 0xb0, 0x4f, 0x0f, 0xe4, 0x59, 0x8d, 0xe9, 0xd9, 0x2d, 0x31, 0xd6,
- 0xc7, 0x86, 0x04, 0x0d, 0x57, 0x76, 0x97, 0x65, 0x56, 0xa2, 0xcf, 0xc5, 0x5e, 0x54, 0xa1, 0xdc,
- 0xb3, 0xcb, 0x1b, 0x12, 0x6b, 0xd6, 0xa4, 0xbe, 0xd2, 0xa1, 0x84, 0x99, 0x0c, 0xce, 0xa7, 0x73,
- 0xfc, 0xc7, 0x9d, 0x24, 0x65, 0x53, 0xe6, 0xc6, 0x4f, 0x68, 0x6d, 0x21, 0xad, 0x41, 0x52, 0x67,
- 0x3c, 0xaf, 0xec, 0x22, 0xae, 0xb4, 0x0f, 0x6a, 0x08, 0x4e, 0x8a, 0x5b, 0x49, 0x91, 0xf4, 0xc6,
- 0x4c, 0xf8, 0xa9, 0x27, 0xef, 0xfd, 0x0f, 0xd7, 0x75, 0xe7, 0x1e, 0x83, 0x29, 0xe4, 0x1f, 0xdd,
- 0x44, 0x57, 0xb3, 0x91, 0x11, 0x73, 0x18, 0x7b, 0x4f, 0x09, 0xa8, 0x17, 0xd7, 0x9e, 0xa2, 0x39,
- 0x7f, 0xc1, 0x2d, 0xfe, 0x3d, 0x9c, 0x9a, 0x02, 0x90, 0xc8, 0xea, 0xd3, 0x1b, 0x66, 0x90, 0xa6,
- };
+UINT8 PssMessage[] = {
+ 0xe0, 0x02, 0x37, 0x7a, 0xff, 0xb0, 0x4f, 0x0f, 0xe4, 0x59, 0x8d, 0xe9, 0xd9, 0x2d, 0x31, 0xd6,
+ 0xc7, 0x86, 0x04, 0x0d, 0x57, 0x76, 0x97, 0x65, 0x56, 0xa2, 0xcf, 0xc5, 0x5e, 0x54, 0xa1, 0xdc,
+ 0xb3, 0xcb, 0x1b, 0x12, 0x6b, 0xd6, 0xa4, 0xbe, 0xd2, 0xa1, 0x84, 0x99, 0x0c, 0xce, 0xa7, 0x73,
+ 0xfc, 0xc7, 0x9d, 0x24, 0x65, 0x53, 0xe6, 0xc6, 0x4f, 0x68, 0x6d, 0x21, 0xad, 0x41, 0x52, 0x67,
+ 0x3c, 0xaf, 0xec, 0x22, 0xae, 0xb4, 0x0f, 0x6a, 0x08, 0x4e, 0x8a, 0x5b, 0x49, 0x91, 0xf4, 0xc6,
+ 0x4c, 0xf8, 0xa9, 0x27, 0xef, 0xfd, 0x0f, 0xd7, 0x75, 0xe7, 0x1e, 0x83, 0x29, 0xe4, 0x1f, 0xdd,
+ 0x44, 0x57, 0xb3, 0x91, 0x11, 0x73, 0x18, 0x7b, 0x4f, 0x09, 0xa8, 0x17, 0xd7, 0x9e, 0xa2, 0x39,
+ 0x7f, 0xc1, 0x2d, 0xfe, 0x3d, 0x9c, 0x9a, 0x02, 0x90, 0xc8, 0xea, 0xd3, 0x1b, 0x66, 0x90, 0xa6,
+};
//
// Binary message to be signed and verified
//
-UINT8 PssSalt[]={
- 0xd6, 0x6f, 0x72, 0xf1, 0x0b, 0x69, 0x00, 0x1a, 0x5b, 0x59, 0xcf, 0x10, 0x92, 0xad, 0x27, 0x4d,
- 0x50, 0x56, 0xc4, 0xe9, 0x5c, 0xcc, 0xcf, 0xbe, 0x3b, 0x53, 0x0d, 0xcb, 0x02, 0x7e, 0x57, 0xd6
- };
+UINT8 PssSalt[] = {
+ 0xd6, 0x6f, 0x72, 0xf1, 0x0b, 0x69, 0x00, 0x1a, 0x5b, 0x59, 0xcf, 0x10, 0x92, 0xad, 0x27, 0x4d,
+ 0x50, 0x56, 0xc4, 0xe9, 0x5c, 0xcc, 0xcf, 0xbe, 0x3b, 0x53, 0x0d, 0xcb, 0x02, 0x7e, 0x57, 0xd6
+};
//
// RSASSA-PSS Signature over above message using above keys, salt and SHA256 digest(and MGF1) algo.
//
-UINT8 TestVectorSignature[]={
- 0x4f, 0x9b, 0x42, 0x5c, 0x20, 0x58, 0x46, 0x0e, 0x4a, 0xb2, 0xf5, 0xc9, 0x63, 0x84, 0xda, 0x23,
- 0x27, 0xfd, 0x29, 0x15, 0x0f, 0x01, 0x95, 0x5a, 0x76, 0xb4, 0xef, 0xe9, 0x56, 0xaf, 0x06, 0xdc,
- 0x08, 0x77, 0x9a, 0x37, 0x4e, 0xe4, 0x60, 0x7e, 0xab, 0x61, 0xa9, 0x3a, 0xdc, 0x56, 0x08, 0xf4,
- 0xec, 0x36, 0xe4, 0x7f, 0x2a, 0x0f, 0x75, 0x4e, 0x8f, 0xf8, 0x39, 0xa8, 0xa1, 0x9b, 0x1d, 0xb1,
- 0xe8, 0x84, 0xea, 0x4c, 0xf3, 0x48, 0xcd, 0x45, 0x50, 0x69, 0xeb, 0x87, 0xaf, 0xd5, 0x36, 0x45,
- 0xb4, 0x4e, 0x28, 0xa0, 0xa5, 0x68, 0x08, 0xf5, 0x03, 0x1d, 0xa5, 0xba, 0x91, 0x12, 0x76, 0x8d,
- 0xfb, 0xfc, 0xa4, 0x4e, 0xbe, 0x63, 0xa0, 0xc0, 0x57, 0x2b, 0x73, 0x1d, 0x66, 0x12, 0x2f, 0xb7,
- 0x16, 0x09, 0xbe, 0x14, 0x80, 0xfa, 0xa4, 0xe4, 0xf7, 0x5e, 0x43, 0x95, 0x51, 0x59, 0xd7, 0x0f,
- 0x08, 0x1e, 0x2a, 0x32, 0xfb, 0xb1, 0x9a, 0x48, 0xb9, 0xf1, 0x62, 0xcf, 0x6b, 0x2f, 0xb4, 0x45,
- 0xd2, 0xd6, 0x99, 0x4b, 0xc5, 0x89, 0x10, 0xa2, 0x6b, 0x59, 0x43, 0x47, 0x78, 0x03, 0xcd, 0xaa,
- 0xa1, 0xbd, 0x74, 0xb0, 0xda, 0x0a, 0x5d, 0x05, 0x3d, 0x8b, 0x1d, 0xc5, 0x93, 0x09, 0x1d, 0xb5,
- 0x38, 0x83, 0x83, 0xc2, 0x60, 0x79, 0xf3, 0x44, 0xe2, 0xae, 0xa6, 0x00, 0xd0, 0xe3, 0x24, 0x16,
- 0x4b, 0x45, 0x0f, 0x7b, 0x9b, 0x46, 0x51, 0x11, 0xb7, 0x26, 0x5f, 0x3b, 0x1b, 0x06, 0x30, 0x89,
- 0xae, 0x7e, 0x26, 0x23, 0xfc, 0x0f, 0xda, 0x80, 0x52, 0xcf, 0x4b, 0xf3, 0x37, 0x91, 0x02, 0xfb,
- 0xf7, 0x1d, 0x7c, 0x98, 0xe8, 0x25, 0x86, 0x64, 0xce, 0xed, 0x63, 0x7d, 0x20, 0xf9, 0x5f, 0xf0,
- 0x11, 0x18, 0x81, 0xe6, 0x50, 0xce, 0x61, 0xf2, 0x51, 0xd9, 0xc3, 0xa6, 0x29, 0xef, 0x22, 0x2d,
- };
-
-
-STATIC VOID *mRsa;
+UINT8 TestVectorSignature[] = {
+ 0x4f, 0x9b, 0x42, 0x5c, 0x20, 0x58, 0x46, 0x0e, 0x4a, 0xb2, 0xf5, 0xc9, 0x63, 0x84, 0xda, 0x23,
+ 0x27, 0xfd, 0x29, 0x15, 0x0f, 0x01, 0x95, 0x5a, 0x76, 0xb4, 0xef, 0xe9, 0x56, 0xaf, 0x06, 0xdc,
+ 0x08, 0x77, 0x9a, 0x37, 0x4e, 0xe4, 0x60, 0x7e, 0xab, 0x61, 0xa9, 0x3a, 0xdc, 0x56, 0x08, 0xf4,
+ 0xec, 0x36, 0xe4, 0x7f, 0x2a, 0x0f, 0x75, 0x4e, 0x8f, 0xf8, 0x39, 0xa8, 0xa1, 0x9b, 0x1d, 0xb1,
+ 0xe8, 0x84, 0xea, 0x4c, 0xf3, 0x48, 0xcd, 0x45, 0x50, 0x69, 0xeb, 0x87, 0xaf, 0xd5, 0x36, 0x45,
+ 0xb4, 0x4e, 0x28, 0xa0, 0xa5, 0x68, 0x08, 0xf5, 0x03, 0x1d, 0xa5, 0xba, 0x91, 0x12, 0x76, 0x8d,
+ 0xfb, 0xfc, 0xa4, 0x4e, 0xbe, 0x63, 0xa0, 0xc0, 0x57, 0x2b, 0x73, 0x1d, 0x66, 0x12, 0x2f, 0xb7,
+ 0x16, 0x09, 0xbe, 0x14, 0x80, 0xfa, 0xa4, 0xe4, 0xf7, 0x5e, 0x43, 0x95, 0x51, 0x59, 0xd7, 0x0f,
+ 0x08, 0x1e, 0x2a, 0x32, 0xfb, 0xb1, 0x9a, 0x48, 0xb9, 0xf1, 0x62, 0xcf, 0x6b, 0x2f, 0xb4, 0x45,
+ 0xd2, 0xd6, 0x99, 0x4b, 0xc5, 0x89, 0x10, 0xa2, 0x6b, 0x59, 0x43, 0x47, 0x78, 0x03, 0xcd, 0xaa,
+ 0xa1, 0xbd, 0x74, 0xb0, 0xda, 0x0a, 0x5d, 0x05, 0x3d, 0x8b, 0x1d, 0xc5, 0x93, 0x09, 0x1d, 0xb5,
+ 0x38, 0x83, 0x83, 0xc2, 0x60, 0x79, 0xf3, 0x44, 0xe2, 0xae, 0xa6, 0x00, 0xd0, 0xe3, 0x24, 0x16,
+ 0x4b, 0x45, 0x0f, 0x7b, 0x9b, 0x46, 0x51, 0x11, 0xb7, 0x26, 0x5f, 0x3b, 0x1b, 0x06, 0x30, 0x89,
+ 0xae, 0x7e, 0x26, 0x23, 0xfc, 0x0f, 0xda, 0x80, 0x52, 0xcf, 0x4b, 0xf3, 0x37, 0x91, 0x02, 0xfb,
+ 0xf7, 0x1d, 0x7c, 0x98, 0xe8, 0x25, 0x86, 0x64, 0xce, 0xed, 0x63, 0x7d, 0x20, 0xf9, 0x5f, 0xf0,
+ 0x11, 0x18, 0x81, 0xe6, 0x50, 0xce, 0x61, 0xf2, 0x51, 0xd9, 0xc3, 0xa6, 0x29, 0xef, 0x22, 0x2d,
+};
+
+STATIC VOID *mRsa;
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaPssPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
mRsa = RsaNew ();
@@ -126,7 +125,7 @@ TestVerifyRsaPssPreReq (
VOID
EFIAPI
TestVerifyRsaPssCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
if (mRsa != NULL) {
@@ -135,11 +134,10 @@ TestVerifyRsaPssCleanUp (
}
}
-
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaPssSignVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
UINT8 *Signature;
@@ -156,36 +154,35 @@ TestVerifyRsaPssSignVerify (
UT_ASSERT_TRUE (Status);
SigSize = 0;
- Status = RsaPssSign (mRsa, PssMessage, sizeof(PssMessage), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE, NULL, &SigSize);
+ Status = RsaPssSign (mRsa, PssMessage, sizeof (PssMessage), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE, NULL, &SigSize);
UT_ASSERT_FALSE (Status);
UT_ASSERT_NOT_EQUAL (SigSize, 0);
Signature = AllocatePool (SigSize);
- Status = RsaPssSign (mRsa, PssMessage, sizeof(PssMessage), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE, Signature, &SigSize);
+ Status = RsaPssSign (mRsa, PssMessage, sizeof (PssMessage), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE, Signature, &SigSize);
UT_ASSERT_TRUE (Status);
//
// Verify RSA PSS encoded Signature generated in above step
//
- Status = RsaPssVerify (mRsa, PssMessage, sizeof(PssMessage), Signature, SigSize, SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE);
+ Status = RsaPssVerify (mRsa, PssMessage, sizeof (PssMessage), Signature, SigSize, SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE);
UT_ASSERT_TRUE (Status);
//
// Verify NIST FIPS 186-3 RSA test vector signature
//
- Status = RsaPssVerify (mRsa, PssMessage, sizeof(PssMessage), TestVectorSignature, sizeof(TestVectorSignature), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE);
+ Status = RsaPssVerify (mRsa, PssMessage, sizeof (PssMessage), TestVectorSignature, sizeof (TestVectorSignature), SHA256_DIGEST_SIZE, SHA256_DIGEST_SIZE);
UT_ASSERT_TRUE (Status);
- FreePool(Signature);
+ FreePool (Signature);
return UNIT_TEST_PASSED;
}
-
-TEST_DESC mRsaPssTest[] = {
- //
- // -----Description--------------------------------------Class----------------------Function---------------------------------Pre---------------------Post---------Context
- //
- {"TestVerifyRsaPssSignVerify()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaPssSignVerify, TestVerifyRsaPssPreReq, TestVerifyRsaPssCleanUp, NULL},
+TEST_DESC mRsaPssTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function---------------------------------Pre---------------------Post---------Context
+ //
+ { "TestVerifyRsaPssSignVerify()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaPssSignVerify, TestVerifyRsaPssPreReq, TestVerifyRsaPssCleanUp, NULL },
};
-UINTN mRsaPssTestNum = ARRAY_SIZE(mRsaPssTest);
+UINTN mRsaPssTestNum = ARRAY_SIZE (mRsaPssTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
index 0969b6aea6..3f06e89b3c 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
@@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Public Modulus of RSA Key
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaN[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaN[] = {
0xBB, 0xF8, 0x2F, 0x09, 0x06, 0x82, 0xCE, 0x9C, 0x23, 0x38, 0xAC, 0x2B, 0x9D, 0xA8, 0x71, 0xF7,
0x36, 0x8D, 0x07, 0xEE, 0xD4, 0x10, 0x43, 0xA4, 0x40, 0xD6, 0xB6, 0xF0, 0x74, 0x54, 0xF5, 0x1F,
0xB8, 0xDF, 0xBA, 0xAF, 0x03, 0x5C, 0x02, 0xAB, 0x61, 0xEA, 0x48, 0xCE, 0xEB, 0x6F, 0xCD, 0x48,
@@ -26,17 +26,17 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaN[] = {
0xEE, 0x6A, 0x64, 0x9D, 0x06, 0x09, 0x53, 0x74, 0x88, 0x34, 0xB2, 0x45, 0x45, 0x98, 0x39, 0x4E,
0xE0, 0xAA, 0xB1, 0x2D, 0x7B, 0x61, 0xA5, 0x1F, 0x52, 0x7A, 0x9A, 0x41, 0xF6, 0xC1, 0x68, 0x7F,
0xE2, 0x53, 0x72, 0x98, 0xCA, 0x2A, 0x8F, 0x59, 0x46, 0xF8, 0xE5, 0xFD, 0x09, 0x1D, 0xBD, 0xCB
- };
+};
//
// Public Exponent of RSA Key
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaE[] = { 0x11 };
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaE[] = { 0x11 };
//
// Private Exponent of RSA Key
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaD[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaD[] = {
0xA5, 0xDA, 0xFC, 0x53, 0x41, 0xFA, 0xF2, 0x89, 0xC4, 0xB9, 0x88, 0xDB, 0x30, 0xC1, 0xCD, 0xF8,
0x3F, 0x31, 0x25, 0x1E, 0x06, 0x68, 0xB4, 0x27, 0x84, 0x81, 0x38, 0x01, 0x57, 0x96, 0x41, 0xB2,
0x94, 0x10, 0xB3, 0xC7, 0x99, 0x8D, 0x6B, 0xC4, 0x65, 0x74, 0x5E, 0x5C, 0x39, 0x26, 0x69, 0xD6,
@@ -45,17 +45,17 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaD[] = {
0xE5, 0x6A, 0xAF, 0x68, 0xC5, 0x6C, 0x09, 0x2C, 0xD3, 0x8D, 0xC3, 0xBE, 0xF5, 0xD2, 0x0A, 0x93,
0x99, 0x26, 0xED, 0x4F, 0x74, 0xA1, 0x3E, 0xDD, 0xFB, 0xE1, 0xA1, 0xCE, 0xCC, 0x48, 0x94, 0xAF,
0x94, 0x28, 0xC2, 0xB7, 0xB8, 0x88, 0x3F, 0xE4, 0x46, 0x3A, 0x4B, 0xC8, 0x5B, 0x1C, 0xB3, 0xC1
- };
+};
//
// Known Answer Test (KAT) Data for RSA PKCS#1 Signing
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 RsaSignData[] = "OpenSSL FIPS 140-2 Public Key RSA KAT";
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 RsaSignData[] = "OpenSSL FIPS 140-2 Public Key RSA KAT";
//
// Known Signature for the above message, under SHA-1 Digest
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaPkcs1Signature[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaPkcs1Signature[] = {
0x71, 0xEE, 0x1A, 0xC0, 0xFE, 0x01, 0x93, 0x54, 0x79, 0x5C, 0xF2, 0x4C, 0x4A, 0xFD, 0x1A, 0x05,
0x8F, 0x64, 0xB1, 0x6D, 0x61, 0x33, 0x8D, 0x9B, 0xE7, 0xFD, 0x60, 0xA3, 0x83, 0xB5, 0xA3, 0x51,
0x55, 0x77, 0x90, 0xCF, 0xDC, 0x22, 0x37, 0x8E, 0xD0, 0xE1, 0xAE, 0x09, 0xE3, 0x3D, 0x1E, 0xF8,
@@ -64,21 +64,21 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 RsaPkcs1Signature[] = {
0x4E, 0xCA, 0x2E, 0x4E, 0xBC, 0x29, 0xA8, 0x67, 0x13, 0xB7, 0x9F, 0x1D, 0x04, 0x44, 0xE5, 0x5F,
0x35, 0x07, 0x11, 0xBC, 0xED, 0x19, 0x37, 0x21, 0xCF, 0x23, 0x48, 0x1F, 0x72, 0x05, 0xDE, 0xE6,
0xE8, 0x7F, 0x33, 0x8A, 0x76, 0x4B, 0x2F, 0x95, 0xDF, 0xF1, 0x5F, 0x84, 0x80, 0xD9, 0x46, 0xB4
- };
+};
//
// Default public key 0x10001 = 65537
//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DefaultPublicKey[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 DefaultPublicKey[] = {
0x01, 0x00, 0x01
};
-VOID *mRsa;
+VOID *mRsa;
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaPreReq (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
mRsa = RsaNew ();
@@ -93,7 +93,7 @@ TestVerifyRsaPreReq (
VOID
EFIAPI
TestVerifyRsaCleanUp (
- UNIT_TEST_CONTEXT Context
+ UNIT_TEST_CONTEXT Context
)
{
if (mRsa != NULL) {
@@ -105,7 +105,7 @@ TestVerifyRsaCleanUp (
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaSetGetKeyComponents (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -123,12 +123,12 @@ TestVerifyRsaSetGetKeyComponents (
UT_ASSERT_TRUE (Status);
KeySize = 0;
- Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
UT_ASSERT_FALSE (Status);
UT_ASSERT_EQUAL (KeySize, sizeof (RsaN));
KeyBuffer = AllocatePool (KeySize);
- Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, sizeof (RsaN));
@@ -143,12 +143,12 @@ TestVerifyRsaSetGetKeyComponents (
UT_ASSERT_TRUE (Status);
KeySize = 0;
- Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
UT_ASSERT_FALSE (Status);
UT_ASSERT_EQUAL (KeySize, sizeof (RsaE));
KeyBuffer = AllocatePool (KeySize);
- Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, sizeof (RsaE));
@@ -167,7 +167,7 @@ TestVerifyRsaSetGetKeyComponents (
UT_ASSERT_TRUE (Status);
KeySize = 1;
- Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyN, NULL, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, 0);
@@ -178,7 +178,7 @@ TestVerifyRsaSetGetKeyComponents (
UT_ASSERT_TRUE (Status);
KeySize = 1;
- Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyE, NULL, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, 0);
@@ -188,7 +188,7 @@ TestVerifyRsaSetGetKeyComponents (
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaGenerateKeyComponents (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -202,15 +202,15 @@ TestVerifyRsaGenerateKeyComponents (
Status = RsaGenerateKey (mRsa, RSA_MODULUS_LENGTH, NULL, 0);
UT_ASSERT_TRUE (Status);
- KeySize = RSA_MODULUS_LENGTH / 8;
+ KeySize = RSA_MODULUS_LENGTH / 8;
KeyBuffer = AllocatePool (KeySize);
- Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyE, KeyBuffer, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, 3);
UT_ASSERT_MEM_EQUAL (KeyBuffer, DefaultPublicKey, 3);
KeySize = RSA_MODULUS_LENGTH / 8;
- Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
+ Status = RsaGetKey (mRsa, RsaKeyN, KeyBuffer, &KeySize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (KeySize, RSA_MODULUS_LENGTH / 8);
@@ -246,7 +246,7 @@ TestVerifyRsaGenerateKeyComponents (
UNIT_TEST_STATUS
EFIAPI
TestVerifyRsaPkcs1SignVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
UINT8 HashValue[SHA1_DIGEST_SIZE];
@@ -261,7 +261,7 @@ TestVerifyRsaPkcs1SignVerify (
HashSize = SHA1_DIGEST_SIZE;
ZeroMem (HashValue, HashSize);
- Status = Sha1HashAll (RsaSignData, AsciiStrLen (RsaSignData), HashValue);
+ Status = Sha1HashAll (RsaSignData, AsciiStrLen (RsaSignData), HashValue);
UT_ASSERT_TRUE (Status);
//
@@ -283,7 +283,7 @@ TestVerifyRsaPkcs1SignVerify (
UT_ASSERT_NOT_EQUAL (SigSize, 0);
Signature = AllocatePool (SigSize);
- Status = RsaPkcs1Sign (mRsa, HashValue, HashSize, Signature, &SigSize);
+ Status = RsaPkcs1Sign (mRsa, HashValue, HashSize, Signature, &SigSize);
UT_ASSERT_TRUE (Status);
UT_ASSERT_EQUAL (SigSize, sizeof (RsaPkcs1Signature));
@@ -295,18 +295,18 @@ TestVerifyRsaPkcs1SignVerify (
Status = RsaPkcs1Verify (mRsa, HashValue, HashSize, Signature, SigSize);
UT_ASSERT_TRUE (Status);
- FreePool(Signature);
+ FreePool (Signature);
return UNIT_TEST_PASSED;
}
-TEST_DESC mRsaTest[] = {
- //
- // -----Description--------------------------------------Class----------------------Function---------------------------------Pre---------------------Post---------Context
- //
- {"TestVerifyRsaSetGetKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaSetGetKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
- {"TestVerifyRsaGenerateKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaGenerateKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
- {"TestVerifyRsaPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaPkcs1SignVerify, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL},
+TEST_DESC mRsaTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------Function---------------------------------Pre---------------------Post---------Context
+ //
+ { "TestVerifyRsaSetGetKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaSetGetKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL },
+ { "TestVerifyRsaGenerateKeyComponents()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaGenerateKeyComponents, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL },
+ { "TestVerifyRsaPkcs1SignVerify()", "CryptoPkg.BaseCryptLib.Rsa", TestVerifyRsaPkcs1SignVerify, TestVerifyRsaPreReq, TestVerifyRsaCleanUp, NULL },
};
-UINTN mRsaTestNum = ARRAY_SIZE(mRsaTest);
+UINTN mRsaTestNum = ARRAY_SIZE (mRsaTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
index 2a891ef8bc..225ec3e597 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c
@@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// signtool sign /ac <xxx.cer> / f <xxx.pfx> /p <pass> /fd <digestAlg>
// /tr http://timestamp.comodoca.com/rfc3161 sample.efi
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithTS[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithTS[] = {
0x30, 0x82, 0x0c, 0x00, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
0x82, 0x0b, 0xf1, 0x30, 0x82, 0x0b, 0xed, 0x02, 0x01, 0x01, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x09,
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x78, 0x06, 0x0a, 0x2b,
@@ -210,12 +210,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithTS[] = {
0xb2, 0x6d, 0x75, 0xf4, 0x23, 0x58, 0x13, 0x78, 0x73, 0x1a, 0xb2, 0x84, 0xde, 0xad, 0xe8, 0x6d,
0xe6, 0xe7, 0x5c, 0xb6, 0xe6, 0x5b, 0x10, 0x37, 0x1f, 0xe3, 0x6e, 0xbd, 0x83, 0xd7, 0x51, 0xb1,
0x00, 0x00, 0x00, 0x00, 0x0a
- };
+};
//
// The Comodo Time Stamping Signer Certificate Used for the verification of TimeStamp signature.
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSTrustedCert[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSTrustedCert[] = {
0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47,
0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2, 0x87, 0x07, 0xbe, 0x30,
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81,
@@ -290,12 +290,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSTrustedCert[] = {
0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b, 0xae, 0x4f, 0x0a, 0x2c,
0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f, 0xae, 0xf1, 0xa6, 0xf0,
0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x0a
- };
+};
UNIT_TEST_STATUS
EFIAPI
TestVerifyImageTimestampVerify (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
BOOLEAN Status;
@@ -325,11 +325,11 @@ TestVerifyImageTimestampVerify (
return Status;
}
-TEST_DESC mImageTimestampTest[] = {
- //
- // -----Description--------------------------------------Class----------------------------Function-----------------Pre---Post--Context
- //
- {"TestVerifyImageTimestampVerify()", "CryptoPkg.BaseCryptLib.ImageTimestamp", TestVerifyImageTimestampVerify, NULL, NULL, NULL},
+TEST_DESC mImageTimestampTest[] = {
+ //
+ // -----Description--------------------------------------Class----------------------------Function-----------------Pre---Post--Context
+ //
+ { "TestVerifyImageTimestampVerify()", "CryptoPkg.BaseCryptLib.ImageTimestamp", TestVerifyImageTimestampVerify, NULL, NULL, NULL },
};
-UINTN mImageTimestampTestNum = ARRAY_SIZE(mImageTimestampTest);
+UINTN mImageTimestampTestNum = ARRAY_SIZE (mImageTimestampTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
index 25c1379f1a..a6b3482742 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
@@ -19,81 +19,81 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
-//#include <UnitTestTypes.h>
+// #include <UnitTestTypes.h>
#include <Library/UnitTestLib.h>
-//#include <Library/UnitTestAssertLib.h>
+// #include <Library/UnitTestAssertLib.h>
-#define UNIT_TEST_NAME "BaseCryptLib Unit Test"
-#define UNIT_TEST_VERSION "1.0"
+#define UNIT_TEST_NAME "BaseCryptLib Unit Test"
+#define UNIT_TEST_VERSION "1.0"
typedef struct {
- CHAR8 *Description;
- CHAR8 *ClassName;
- UNIT_TEST_FUNCTION Func;
- UNIT_TEST_PREREQUISITE PreReq;
- UNIT_TEST_CLEANUP CleanUp;
- UNIT_TEST_CONTEXT Context;
+ CHAR8 *Description;
+ CHAR8 *ClassName;
+ UNIT_TEST_FUNCTION Func;
+ UNIT_TEST_PREREQUISITE PreReq;
+ UNIT_TEST_CLEANUP CleanUp;
+ UNIT_TEST_CONTEXT Context;
} TEST_DESC;
typedef struct {
- CHAR8 *Title;
- CHAR8 *Package;
- UNIT_TEST_SUITE_SETUP Sup;
- UNIT_TEST_SUITE_TEARDOWN Tdn;
- UINTN *TestNum;
- TEST_DESC *TestDesc;
+ CHAR8 *Title;
+ CHAR8 *Package;
+ UNIT_TEST_SUITE_SETUP Sup;
+ UNIT_TEST_SUITE_TEARDOWN Tdn;
+ UINTN *TestNum;
+ TEST_DESC *TestDesc;
} SUITE_DESC;
-extern UINTN mPkcs7EkuTestNum;
-extern TEST_DESC mPkcs7EkuTest[];
+extern UINTN mPkcs7EkuTestNum;
+extern TEST_DESC mPkcs7EkuTest[];
-extern UINTN mHashTestNum;
-extern TEST_DESC mHashTest[];
+extern UINTN mHashTestNum;
+extern TEST_DESC mHashTest[];
-extern UINTN mHmacTestNum;
-extern TEST_DESC mHmacTest[];
+extern UINTN mHmacTestNum;
+extern TEST_DESC mHmacTest[];
-extern UINTN mBlockCipherTestNum;
-extern TEST_DESC mBlockCipherTest[];
+extern UINTN mBlockCipherTestNum;
+extern TEST_DESC mBlockCipherTest[];
-extern UINTN mRsaTestNum;
-extern TEST_DESC mRsaTest[];
+extern UINTN mRsaTestNum;
+extern TEST_DESC mRsaTest[];
-extern UINTN mRsaCertTestNum;
-extern TEST_DESC mRsaCertTest[];
+extern UINTN mRsaCertTestNum;
+extern TEST_DESC mRsaCertTest[];
-extern UINTN mPkcs7TestNum;
-extern TEST_DESC mPkcs7Test[];
+extern UINTN mPkcs7TestNum;
+extern TEST_DESC mPkcs7Test[];
-extern UINTN mPkcs5TestNum;
-extern TEST_DESC mPkcs5Test[];
+extern UINTN mPkcs5TestNum;
+extern TEST_DESC mPkcs5Test[];
-extern UINTN mAuthenticodeTestNum;
-extern TEST_DESC mAuthenticodeTest[];
+extern UINTN mAuthenticodeTestNum;
+extern TEST_DESC mAuthenticodeTest[];
-extern UINTN mImageTimestampTestNum;
-extern TEST_DESC mImageTimestampTest[];
+extern UINTN mImageTimestampTestNum;
+extern TEST_DESC mImageTimestampTest[];
-extern UINTN mDhTestNum;
-extern TEST_DESC mDhTest[];
+extern UINTN mDhTestNum;
+extern TEST_DESC mDhTest[];
-extern UINTN mPrngTestNum;
-extern TEST_DESC mPrngTest[];
+extern UINTN mPrngTestNum;
+extern TEST_DESC mPrngTest[];
-extern UINTN mOaepTestNum;
-extern TEST_DESC mOaepTest[];
+extern UINTN mOaepTestNum;
+extern TEST_DESC mOaepTest[];
-extern UINTN mRsaPssTestNum;
-extern TEST_DESC mRsaPssTest[];
+extern UINTN mRsaPssTestNum;
+extern TEST_DESC mRsaPssTest[];
/** Creates a framework you can use */
EFI_STATUS
EFIAPI
CreateUnitTest (
- IN CHAR8* UnitTestName,
- IN CHAR8* UnitTestVersion,
- IN OUT UNIT_TEST_FRAMEWORK_HANDLE* Framework
-);
+ IN CHAR8 *UnitTestName,
+ IN CHAR8 *UnitTestVersion,
+ IN OUT UNIT_TEST_FRAMEWORK_HANDLE *Framework
+ );
/**
Validate UEFI-OpenSSL DH Interfaces.
@@ -119,6 +119,4 @@ ValidateCryptPrng (
VOID
);
-
-
#endif
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
index 88a3f96305..d0c1c7a4f7 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
@@ -8,7 +8,6 @@
**/
#include "TestBaseCryptLib.h"
-
/**
Initialize the unit test framework, suite, and unit tests for the
sample unit tests and run the unit tests.
@@ -26,8 +25,8 @@ UefiTestMain (
EFI_STATUS Status;
UNIT_TEST_FRAMEWORK_HANDLE Framework;
- DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION ));
- CreateUnitTest(UNIT_TEST_NAME, UNIT_TEST_VERSION, &Framework);
+ DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION));
+ CreateUnitTest (UNIT_TEST_NAME, UNIT_TEST_VERSION, &Framework);
//
// Execute the tests.
@@ -73,8 +72,8 @@ DxeEntryPoint (
**/
int
main (
- int argc,
- char *argv[]
+ int argc,
+ char *argv[]
)
{
return UefiTestMain ();