trace: Do not produce dead code calling BIO_printf if disabled
authorTomas Mraz <tomas@openssl.org>
Wed, 23 Jun 2021 15:16:36 +0000 (17:16 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 24 Jun 2021 15:51:04 +0000 (17:51 +0200)
Fixes #15880

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15882)

include/openssl/trace.h

index e88ad9d13d89734b10bad9edfe1e5ae63099236d..b3a29ea8c4ef8e336150175a6c3ca64145d68279 100644 (file)
@@ -270,11 +270,19 @@ void OSSL_trace_end(int category, BIO *channel);
  *                42, "What do you get when you multiply six by nine?");
  */
 
-# define OSSL_TRACEV(category, args) \
+# if !defined OPENSSL_NO_TRACE && !defined FIPS_MODULE
+
+#  define OSSL_TRACEV(category, args) \
     OSSL_TRACE_BEGIN(category) \
         BIO_printf args; \
     OSSL_TRACE_END(category)
 
+# else
+
+#  define OSSL_TRACEV(category, args) ((void)0)
+
+# endif
+
 # define OSSL_TRACE(category, text) \
     OSSL_TRACEV(category, (trc_out, "%s", text))