From 035a5fe3434d32ee857314b1c39f2475044654be Mon Sep 17 00:00:00 2001 From: Pranoy Jayaraj Date: Tue, 29 Oct 2024 12:16:04 +0000 Subject: [PATCH] Crypto: Cmake: Add cmake configure option to enable/disable debug prints inside provider -- Add cmake option ALCP_COMPAT_ENABLE_DEBUG Signed-off-by: Pranoy Jayaraj --- lib/compat/openssl/cmake/ProviderConfig.cmake | 2 ++ lib/compat/openssl/include/debug.h | 9 +++------ lib/compat/openssl/include/provider/config.h.in | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/compat/openssl/cmake/ProviderConfig.cmake b/lib/compat/openssl/cmake/ProviderConfig.cmake index 22c94e6c7..ef8cadf49 100644 --- a/lib/compat/openssl/cmake/ProviderConfig.cmake +++ b/lib/compat/openssl/cmake/ProviderConfig.cmake @@ -30,6 +30,8 @@ # 4. Digest Provider is disabled by default as there is currently a provider overhead ## ######################################################################################## +# generic option to enable debug print in provider +OPTION(ALCP_COMPAT_ENABLE_DEBUG "ENABLE DEBUG PRINTS INSIDE ALCP PROVIDER" OFF) OPTION(ALCP_COMPAT_ENABLE_OPENSSL_DIGEST "ENABLE SUPPORT FOR OPENSSL DIGEST PROVIDER" OFF) OPTION(ALCP_COMPAT_ENABLE_OPENSSL_CIPHER "ENABLE SUPPORT FOR OPENSSL CIPHER PROVIDER" ON) diff --git a/lib/compat/openssl/include/debug.h b/lib/compat/openssl/include/debug.h index e0085048b..4d31cadce 100644 --- a/lib/compat/openssl/include/debug.h +++ b/lib/compat/openssl/include/debug.h @@ -26,6 +26,7 @@ * */ +#include "provider/config.h" #include #include #include @@ -33,19 +34,15 @@ #ifndef _OPENSSL_DEBUG_H #define _OPENSSL_DEBUG_H 2 -// #define DEBUG_PROV - -#ifdef DEBUG_PROV +#ifdef ALCP_COMPAT_ENABLE_DEBUG #define DBG_PRINT(prfx, fmt, ...) printf(prfx##fmt, __VA_ARGS__) -#define ENTRY() DBG_PRINT("Entry: ", "%s\n", __func__) -#define ENTER() printf("Enter : %s\n", __func__) +#define ENTER() printf("Enter : %s:%d\n", __func__, __LINE__); #define HERE() printf("Here : %s:%d\n", __func__, __LINE__) #define EXIT() printf("Exit : %s:%d\n", __func__, __LINE__) #define PRINT(MSG) printf(MSG) #else -#define ENTRY() #define ENTER() #define HERE() #define EXIT() diff --git a/lib/compat/openssl/include/provider/config.h.in b/lib/compat/openssl/include/provider/config.h.in index 29f51b0c3..1d09ac166 100644 --- a/lib/compat/openssl/include/provider/config.h.in +++ b/lib/compat/openssl/include/provider/config.h.in @@ -30,6 +30,8 @@ #ifndef _INCLUDE_PROVIDER_CONFIG_H #define _INCLUDE_PROVIDER_CONFIG_H 2 +#cmakedefine ALCP_COMPAT_ENABLE_DEBUG + #cmakedefine ALCP_COMPAT_ENABLE_OPENSSL_DIGEST #cmakedefine ALCP_COMPAT_ENABLE_OPENSSL_CIPHER #cmakedefine ALCP_COMPAT_ENABLE_OPENSSL_RSA