From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web11.1033.1589221649973930155 for ; Mon, 11 May 2020 11:27:31 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: zhichao.gao@intel.com) IronPort-SDR: QRnWGjpqQuueqsb/uxz35YDcOVyqxxeFpTn3+WwmCRHUZQl1O4ZuUKKP6J4GNRJrx2z6jEIuR7 UE9ibQVe3RaQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2020 11:27:31 -0700 IronPort-SDR: H26Z5Lw4HFfNx1i0rxnrp8CAOGk5u6hoGUdgQHSagVYVllEowic+ee4+aRS0Aaf+Kn+fU8mOQ7 9tmD3Bi4ACMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,380,1583222400"; d="scan'208";a="265244828" Received: from fieedk001.ccr.corp.intel.com ([10.239.33.114]) by orsmga006.jf.intel.com with ESMTP; 11 May 2020 11:27:29 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Xiaoyu Lu , Siyuan Fu , Michael D Kinney , Jiewen Yao , Philippe Mathieu-Daude Subject: [PATCH V4 01/11] CryptoPkg/CryptoDxe: Add function to indicate the deprecated algorithm Date: Tue, 12 May 2020 02:27:08 +0800 Message-Id: <20200511182718.7728-2-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200511182718.7728-1-zhichao.gao@intel.com> References: <20200511182718.7728-1-zhichao.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898 Add a internal worker function to indicate the deprecated functions. It would print out debug messages and asserts to inform the consumer they are using a deprecated function. Change the Name of BaseCryptLibServciceNotEnabled to correct spelling BaseCryptLibServiceNotEnabled. Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Siyuan Fu Cc: Michael D Kinney Cc: Jiewen Yao Cc: Philippe Mathieu-Daude Signed-off-by: Zhichao Gao --- CryptoPkg/Driver/Crypto.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c index 35bf2d3d92..ed0083cccf 100644 --- a/CryptoPkg/Driver/Crypto.c +++ b/CryptoPkg/Driver/Crypto.c @@ -41,7 +41,7 @@ #define CALL_BASECRYPTLIB(Enable, Function, Args, ErrorReturnValue) \ EDKII_CRYPTO_PCD->Enable \ ? Function Args \ - : (BaseCryptLibServciceNotEnabled (#Function), ErrorReturnValue) + : (BaseCryptLibServiceNotEnabled (#Function), ErrorReturnValue) /** A macro used to call a void BaseCryptLib function if it is enabled. @@ -61,7 +61,7 @@ #define CALL_VOID_BASECRYPTLIB(Enable, Function, Args) \ EDKII_CRYPTO_PCD->Enable \ ? Function Args \ - : BaseCryptLibServciceNotEnabled (#Function) + : BaseCryptLibServiceNotEnabled (#Function) /** Internal worker function that prints a debug message and asserts if a call is @@ -78,7 +78,7 @@ **/ static VOID -BaseCryptLibServciceNotEnabled ( +BaseCryptLibServiceNotEnabled ( IN CONST CHAR8 *FunctionName ) { @@ -86,6 +86,24 @@ BaseCryptLibServciceNotEnabled ( ASSERT_EFI_ERROR (EFI_UNSUPPORTED); } +/** + Internal worker function that prints a debug message and asserts if a call is + made to a BaseCryptLib function that is deprecated and unsupported any longer. + + @param[in] FunctionName Null-terminated ASCII string that is the name of an + EDK II Crypto service. + +**/ +static +VOID +BaseCryptLibServiceDeprecated ( + IN CONST CHAR8 *FunctionName + ) +{ + DEBUG ((DEBUG_ERROR, "[%a] Function %a() is deprecated and unsupported any longer\n", gEfiCallerBaseName, FunctionName)); + ASSERT_EFI_ERROR (EFI_UNSUPPORTED); +} + /** Returns the version of the EDK II Crypto Protocol. -- 2.21.0.windows.1