Skip to content

Commit

Permalink
Updated Crypto Tests (#372)
Browse files Browse the repository at this point in the history
Updated the crypto tests to reference the crypto functionality PCDs
before attempting to test them. This will only test the enabled
functionality for the different crypto flavors of the shared crypto
binaries. Tests for functionality that are not enabled are skipped and
labelled that way in the report.

Additionally, a new PCD dsc file was created for test purposes where all
the Crypto PCDs are enabled. This should only be used for testing.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [x] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

Ran the test on QemuQ35 and Adl physical platforms. Checked the
different flavors to make sure tests were passed/failed/skipped as
expected without any problems.

When building the shell app or host based unit test include the relevant
PCDs that correspond to the flavor of Shared Crypto used for DXE.
  • Loading branch information
kenlautner committed May 4, 2023
1 parent e74f4fc commit 18f9b28
Show file tree
Hide file tree
Showing 18 changed files with 438 additions and 60 deletions.
1 change: 1 addition & 0 deletions CryptoPkg/CryptoPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
!include CryptoPkg/Test/Crypto.pcd.ALL.inc.dsc
## MU_CHANGE [END]
}
## MU_CHANGE [END]
Expand Down
145 changes: 145 additions & 0 deletions CryptoPkg/Test/Crypto.pcd.ALL.inc.dsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# List of Crypto PCDs with all functionality enabled. This should only be used for testing.

# HMACSHA256
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256New|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Free|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256SetKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Final|TRUE
# PKCS
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs5HashPassword|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs1v2Encrypt|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7GetSigners|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7FreeSigners|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7GetCertificatesList|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7Sign|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7Verify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceVerifyEKUsInPkcs7Signature|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7GetAttachedContent|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAuthenticodeVerify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceImageTimestampVerify|TRUE
# DH
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhNew|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhFree|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhGenerateParameter|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhSetParameter|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhGenerateKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhComputeKey|TRUE
# RANDOM
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRandomSeed|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRandomBytes|TRUE
# RSA
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaNew|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaFree|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaSetKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGenerateKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaCheckKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPkcs1Sign|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPkcs1Verify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPssSign|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPssVerify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetPrivateKeyFromPem|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetPublicKeyFromX509|TRUE
# SHA1
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1GetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1Init|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1Final|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1HashAll|TRUE
# SHA256
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256GetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256Init|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256Final|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256HashAll|TRUE
# SHA384
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384GetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384Init|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384Final|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384HashAll|TRUE
# SHA512
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512GetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512Init|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512Final|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512HashAll|TRUE
# PARALLELHASH256
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceParallelHash256HashAll|TRUE
# X509
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509GetSubjectName|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509GetCommonName|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509GetOrganizationName|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509VerifyCert|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509ConstructCertificate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509ConstructCertificateStackV|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509ConstructCertificateStack|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509Free|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509StackFree|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceX509GetTBSCert|TRUE
# TDES
# AES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesGetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesInit|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesCbcEncrypt|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesCbcDecrypt|TRUE
# ARC4
# SM3
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3GetContextSize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3Init|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3Duplicate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3Update|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3Final|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSm3HashAll|TRUE
# HKDF
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHkdfSha256ExtractAndExpand|TRUE
# TLS
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsInitialize|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsCtxFree|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsCtxNew|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsFree|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsNew|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsInHandshake|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsDoHandshake|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsHandleAlert|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsCloseNotify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsCtrlTrafficOut|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsCtrlTrafficIn|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsRead|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsWrite|TRUE
# TLSSET
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetVersion|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetConnectionEnd|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetCipherList|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetCompressionMethod|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetVerify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetVerifyHost|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetSessionId|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetCaCertificate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetHostPublicCert|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetHostPrivateKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsSetCertRevocationList|TRUE
# TLSGET
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetVersion|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetConnectionEnd|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetCurrentCipher|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetCurrentCompressionId|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetVerify|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetSessionId|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetClientRandom|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetServerRandom|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetKeyMaterial|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetCaCertificate|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetHostPublicCert|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetHostPrivateKey|TRUE
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceTlsGetCertRevocationList|TRUE
# Enable use of EC
gEfiCryptoPkgTokenSpaceGuid.PcdOpensslEcEnabled | TRUE
# AUTOGEN ENDS
# ****************************************************************************
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ TestVerifyAuthenticodeVerify (
{
BOOLEAN Status;

if (!PcdGetBool (PcdCryptoServiceAuthenticodeVerify)) {
return UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
}

//
// Sample Code: Demonstrate how to check the Hash algorithm in PE/COFF Authenticode.
// According to PKCS#7 Definition:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,97 @@
## @file
# BaseCryptLib UnitTest built for execution in UEFI Shell.
#
# Copyright (c) Microsoft Corporation.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x00010006
BASE_NAME = BaseCryptLibUnitTestApp
FILE_GUID = ed54ee8c-ef7a-41f2-83d5-0e0d4cd88c21
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = DxeEntryPoint

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
UnitTestMain.c
BaseCryptLibUnitTests.c
TestBaseCryptLib.h
HashTests.c
HmacTests.c
BlockCipherTests.c
RsaTests.c
RsaPkcs7Tests.c
Pkcs5Pbkdf2Tests.c
AuthenticodeTests.c
TSTests.c
DhTests.c
RandTests.c
Pkcs7EkuTests.c
OaepEncryptTests.c
RsaPssTests.c
HkdfTests.c
AeadAesGcmTests.c
BnTests.c
EcTests.c
X509Tests.c

[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec

[LibraryClasses]
UefiApplicationEntryPoint
BaseLib
DebugLib
UnitTestLib
PrintLib
BaseCryptLib
## @file
# BaseCryptLib UnitTest built for execution in UEFI Shell.
#
# Copyright (c) Microsoft Corporation.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x00010006
BASE_NAME = BaseCryptLibUnitTestApp
FILE_GUID = ed54ee8c-ef7a-41f2-83d5-0e0d4cd88c21
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = DxeEntryPoint

#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
UnitTestMain.c
BaseCryptLibUnitTests.c
TestBaseCryptLib.h
HashTests.c
HmacTests.c
BlockCipherTests.c
RsaTests.c
RsaPkcs7Tests.c
Pkcs5Pbkdf2Tests.c
AuthenticodeTests.c
TSTests.c
DhTests.c
RandTests.c
Pkcs7EkuTests.c
OaepEncryptTests.c
RsaPssTests.c
HkdfTests.c
AeadAesGcmTests.c
BnTests.c
EcTests.c
X509Tests.c

[Packages]
MdePkg/MdePkg.dec
CryptoPkg/CryptoPkg.dec

[LibraryClasses]
UefiApplicationEntryPoint
BaseLib
DebugLib
UnitTestLib
PrintLib
BaseCryptLib
[FixedPcd]
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256New ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Free ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256SetKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Update ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceHmacSha256Final ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs5HashPassword ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs1v2Encrypt ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServicePkcs7Sign ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceVerifyEKUsInPkcs7Signature ##CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAuthenticodeVerify ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceImageTimestampVerify ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhNew ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhFree ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhGenerateParameter ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhSetParameter ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhGenerateKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceDhComputeKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRandomSeed ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRandomBytes ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaSetKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGenerateKey ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPkcs1Sign ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPkcs1Verify ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPssSign ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaPssVerify ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetPrivateKeyFromPem ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceRsaGetPublicKeyFromX509 ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1Init ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256Init ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384Init ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512Init ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha1HashAll ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha256HashAll ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha384HashAll ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceSha512HashAll ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceParallelHash256HashAll ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesGetContextSize ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesInit ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesCbcEncrypt ## CONSUMES
gEfiCryptoPkgTokenSpaceGuid.PcdCryptoServiceAesCbcDecrypt ## CONSUMES
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ TestVerifyBLockCiper (
BOOLEAN Status;
BLOCK_CIPHER_TEST_CONTEXT *TestContext;

if (!PcdGetBool (PcdCryptoServiceAesGetContextSize) || !PcdGetBool (PcdCryptoServiceAesInit) || !PcdGetBool (PcdCryptoServiceAesCbcEncrypt) || !PcdGetBool (PcdCryptoServiceAesCbcDecrypt)) {
return UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
}

TestContext = Context;

ZeroMem (Encrypt, sizeof (Encrypt));
Expand Down
6 changes: 6 additions & 0 deletions CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ TestVerifyDhGenerateKey (
UINTN Key2Length;
BOOLEAN Status;

if ( !PcdGetBool (PcdCryptoServiceDhSetParameter) || !PcdGetBool (PcdCryptoServiceDhGenerateParameter)
|| !PcdGetBool (PcdCryptoServiceDhGenerateKey) || !PcdGetBool (PcdCryptoServiceDhComputeKey))
{
return UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
}

//
// Initialize Key Length
//
Expand Down
Loading

0 comments on commit 18f9b28

Please sign in to comment.