From 9f3e8b24004a790f0a4e3a9f0d7b3cc6e3ae273f Mon Sep 17 00:00:00 2001 From: Bret Barkelew Date: Sat, 5 Mar 2022 12:41:42 -0800 Subject: [PATCH] [Binary Crypto] Remove the functions and macros from Crypto.c template Some of these macros and functions were present for the EDK2 upstream submission, but 1) that submission never landed and 2) we don't currently support them in Mu. --- CryptoPkg/Driver/Packaging/Crypto.template.c | 79 ++------------------ 1 file changed, 5 insertions(+), 74 deletions(-) diff --git a/CryptoPkg/Driver/Packaging/Crypto.template.c b/CryptoPkg/Driver/Packaging/Crypto.template.c index 9f0c791c1b..7e3f1f8427 100644 --- a/CryptoPkg/Driver/Packaging/Crypto.template.c +++ b/CryptoPkg/Driver/Packaging/Crypto.template.c @@ -13,80 +13,11 @@ #include #include -/** - A macro used to retrieve the FixedAtBuild PcdCryptoServiceFamilyEnable with a - typecast to its associcted structure type PCD_CRYPTO_SERVICE_FAMILY_ENABLE. -**/ -#define EDKII_CRYPTO_PCD(Name) \ - (FixedPcdGetBool (PcdCryptoService##Name)) - -/** - A macro used to call a non-void BaseCryptLib function if it is enabled. - - If a BaseCryptLib function is not enabled, there will be no references to it - from this module and will be optimized away reducing the size of this module. - - @param Function The name of the BaseCryptLib function. - @param Args The argument list to pass to Function. - @param ErrorReturnValue The value to return if the BaseCryptLib function is - not enabled. - -**/ -#define CALL_BASECRYPTLIB(Function, Args, ErrorReturnValue) \ - EDKII_CRYPTO_PCD(Function) \ - ? Function Args \ - : (BaseCryptLibServiceNotEnabled (#Function), ErrorReturnValue) - -/** - A macro used to call a void BaseCryptLib function if it is enabled. - - If a BaseCryptLib function is not enabled, there will be no references to it - from this module and will be optimized away reducing the size of this module. - - @param Enable The name of the enable field in PCD - PcdCryptoServiceFamilyEnable for the BaseCryptLib - function being called. If the value of this field - is non-zero, then the BaseCryptLib function is - enabled. - @param Function The name of the BaseCryptLib function. - @param Args The argument list to pass to Function. - -**/ -#define CALL_VOID_BASECRYPTLIB(Function, Args) \ - EDKII_CRYPTO_PCD(Function) \ - ? Function Args \ - : BaseCryptLibServiceNotEnabled (#Function) - -/** - * A macro that will check if the PCD is enabled for RELEASE builds -*/ -#define NULL_IF_DISABLED(Function) \ - EDKII_CRYPTO_PCD(Function) \ - ? CryptoService##Function \ - : NULL - -/** - Internal worker function that prints a debug message and asserts if a call is - made to a BaseCryptLib function that is not enabled in the EDK II Crypto - Protocol/PPI. - - If this debug message and assert are observed, then a module is using - BaseCryptLib function that is not enabled in a Crypto driver. The - PcdCryptoServiceFamilyEnable should be updated to enable the missing service. - - @param[in] FunctionName Null-terminated ASCII string that is the name of an - EDK II Crypto service. - -**/ -static -VOID -BaseCryptLibServiceNotEnabled ( - IN CONST CHAR8 *FunctionName - ) -{ - DEBUG ((DEBUG_ERROR, "[%a] Function %a() is not enabled\n", gEfiCallerBaseName, FunctionName)); - ASSERT_EFI_ERROR (EFI_UNSUPPORTED); -} +// MU_CHANGE - Remove BaseCryptLibServiceNotEnabled and macros +// These were added for upstreaming into EDK2 and are +// not used by Mu. They may eventually land in EDK2, at +// which point we will need to make a decision about +// their inclusion here. /** Returns the version of the EDK II Crypto Protocol.