48#include "Pkcs7EkuTestSignatures.h"
56 IN CONST UINT32 RequiredEKUsSize,
57 IN BOOLEAN RequireAllPresent
68CONST CHAR8 FIRMWARE_SIGNER_EKU[] =
"1.3.6.1.4.1.311.76.9.21.1";
86TestVerifyEKUsInSignature (
92 CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
95 ProductionECCSignature,
97 (
CONST CHAR8 **)RequiredEKUs,
103 return UNIT_TEST_PASSED;
122TestVerifyEKUsWith3CertsInSignature (
128 CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
131 TestSignEKUsWith3CertsInSignature,
132 ARRAY_SIZE (TestSignEKUsWith3CertsInSignature),
133 (
CONST CHAR8 **)RequiredEKUs,
139 return UNIT_TEST_PASSED;
157TestVerifyEKUsWith2CertsInSignature (
163 CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
166 TestSignEKUsWith2CertsInSignature,
167 ARRAY_SIZE (TestSignEKUsWith2CertsInSignature),
168 (
CONST CHAR8 **)RequiredEKUs,
174 return UNIT_TEST_PASSED;
192TestVerifyEKUsWith1CertInSignature (
198 CONST CHAR8 *RequiredEKUs[] = { FIRMWARE_SIGNER_EKU };
201 TestSignEKUsWith1CertInSignature,
202 ARRAY_SIZE (TestSignEKUsWith1CertInSignature),
203 (
CONST CHAR8 **)RequiredEKUs,
209 return UNIT_TEST_PASSED;
230TestVerifyEKUsWithMultipleEKUsInCert (
236 CONST CHAR8 *RequiredEKUs[] = {
237 "1.3.6.1.4.1.311.76.9.21.1",
238 "1.3.6.1.4.1.311.76.9.21.1.2"
242 TestSignedWithMultipleEKUsInCert,
243 ARRAY_SIZE (TestSignedWithMultipleEKUsInCert),
244 (
CONST CHAR8 **)RequiredEKUs,
250 return UNIT_TEST_PASSED;
268TestEkusNotPresentInSignature (
277 CONST CHAR8 *RequiredEKUs[] = {
"1.3.6.1.4.1.311.76.9.21.3" };
280 TestSignedWithMultipleEKUsInCert,
281 ARRAY_SIZE (TestSignedWithMultipleEKUsInCert),
282 (
CONST CHAR8 **)RequiredEKUs,
288 return UNIT_TEST_PASSED;
307TestProductId10001PresentInSignature (
316 CONST CHAR8 *RequiredEKUs[] = {
317 "1.3.6.1.4.1.311.76.9.21.1",
318 "1.3.6.1.4.1.311.76.9.21.1.10001"
322 TestSignedWithProductId10001,
324 (
CONST CHAR8 **)RequiredEKUs,
330 return UNIT_TEST_PASSED;
354TestOnlyOneEkuInListRequired (
364 CONST CHAR8 *RequiredEKUs[] = {
"1.3.6.1.4.1.311.76.9.21.1.10001" };
367 TestSignedWithProductId10001,
369 (
CONST CHAR8 **)RequiredEKUs,
375 return UNIT_TEST_PASSED;
394TestNoEKUsInSignature (
403 CONST CHAR8 *RequiredEKUs[] = {
"1.3.6.1.4.1.311.76.9.21.1" };
406 TestSignatureWithNoEKUsPresent,
408 (
CONST CHAR8 **)RequiredEKUs,
414 return UNIT_TEST_PASSED;
431TestInvalidParameters (
437 CONST CHAR8 *RequiredEKUs[] = {
"1.3.6.1.4.1.311.76.9.21.1" };
445 (
CONST CHAR8 **)RequiredEKUs,
455 TestSignatureWithNoEKUsPresent,
463 return UNIT_TEST_PASSED;
481TestEKUSubsetSupersetFails (
494 CONST CHAR8 *RequiredEKUs1[] = {
"1.3.6.1.4.1.311.76.9.21" };
497 TestSignedWithProductId10001,
499 (
CONST CHAR8 **)RequiredEKUs1,
512 CONST CHAR8 *RequiredEKUs2[] = {
"1.3.6.1.4.1.311.76.9.21.1.10001.1" };
515 TestSignedWithProductId10001,
517 (
CONST CHAR8 **)RequiredEKUs2,
523 return UNIT_TEST_PASSED;
530 {
"TestVerifyEKUsInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsInSignature,
NULL,
NULL,
NULL },
531 {
"TestVerifyEKUsWith3CertsInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith3CertsInSignature,
NULL,
NULL,
NULL },
532 {
"TestVerifyEKUsWith2CertsInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith2CertsInSignature,
NULL,
NULL,
NULL },
533 {
"TestVerifyEKUsWith1CertInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWith1CertInSignature,
NULL,
NULL,
NULL },
534 {
"TestVerifyEKUsWithMultipleEKUsInCert()",
"CryptoPkg.BaseCryptLib.Eku", TestVerifyEKUsWithMultipleEKUsInCert,
NULL,
NULL,
NULL },
535 {
"TestEkusNotPresentInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestEkusNotPresentInSignature,
NULL,
NULL,
NULL },
536 {
"TestProductId10001PresentInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestProductId10001PresentInSignature,
NULL,
NULL,
NULL },
537 {
"TestOnlyOneEkuInListRequired()",
"CryptoPkg.BaseCryptLib.Eku", TestOnlyOneEkuInListRequired,
NULL,
NULL,
NULL },
538 {
"TestNoEKUsInSignature()",
"CryptoPkg.BaseCryptLib.Eku", TestNoEKUsInSignature,
NULL,
NULL,
NULL },
539 {
"TestInvalidParameters()",
"CryptoPkg.BaseCryptLib.Eku", TestInvalidParameters,
NULL,
NULL,
NULL },
540 {
"TestEKUSubsetSupersetFails()",
"CryptoPkg.BaseCryptLib.Eku", TestEKUSubsetSupersetFails,
NULL,
NULL,
NULL },
RETURN_STATUS EFIAPI VerifyEKUsInPkcs7Signature(IN CONST UINT8 *Pkcs7Signature, IN CONST UINT32 SignatureSize, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPresent)
#define ARRAY_SIZE(Array)
#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB)
#define UT_ASSERT_STATUS_EQUAL(Status, Expected)