From: Richard Levitte Date: Wed, 4 Sep 2019 19:55:58 +0000 (+0200) Subject: include/openssl/err.h: Depend on OPENSSL_NO_FILENAMES, not OPENSSL_NO_ERR X-Git-Tag: openssl-3.0.0-alpha1~1372 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=06ff79bd773d0b4214e4b6a8a1332a3355b17742;ds=sidebyside include/openssl/err.h: Depend on OPENSSL_NO_FILENAMES, not OPENSSL_NO_ERR The configuration option 'no-err' is documented to be used to avoid loading error related string tables. For some reason, it was also used to define if ERR_PUT_error() would pass the source file name and line information or not. The configuration option 'no-filenames' is documented to be used to avoid passing the source file name and line anywhere. So, the definition of ERR_PUT_error() should depend on OPENSSL_NO_FILENAMES rather than OPENSSL_NO_ERR. Furthermore, the definition of OPENSSL_FILE and OPENSSL_LINE depends on if OPENSSL_NO_FILENAMES is defined or not, so there was never any need to do extra macro gymnastics in include/openssl/err.h, so we simply remove it and use OPENSSL_FILE and OPENSSL_LINE directly. Finally, the macro OPENSSL_FUNC is unaffected by all these configuration options, so it should be used in all macros that call ERR_set_debug(). Fixes #9756 Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/9756) --- diff --git a/include/openssl/err.h b/include/openssl/err.h index 03c3593f34..0da66092b4 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -26,7 +26,7 @@ extern "C" { #endif # if !OPENSSL_API_3 -# ifndef OPENSSL_NO_ERR +# ifndef OPENSSL_NO_FILENAMES # define ERR_PUT_error(l,f,r,fn,ln) ERR_put_error(l,f,r,fn,ln) # else # define ERR_PUT_error(l,f,r,fn,ln) ERR_put_error(l,f,r,NULL,0) @@ -242,28 +242,18 @@ void ERR_set_debug(const char *file, int line, const char *func); void ERR_set_error(int lib, int reason, const char *fmt, ...); void ERR_vset_error(int lib, int reason, const char *fmt, va_list args); -# ifndef OPENSSL_NO_ERR -# define ERR_DBG_FILE OPENSSL_FILE -# define ERR_DBG_LINE OPENSSL_LINE -# define ERR_DBG_FUNC OPENSSL_FUNC -# else -# define ERR_DBG_FILE NULL -# define ERR_DBG_LINE 0 -# define ERR_DBG_FUNC NULL -# endif - /* Main error raising functions */ # define ERR_raise(lib, reason) ERR_raise_data((lib),(reason),NULL) # define ERR_raise_data \ (ERR_new(), \ - ERR_set_debug(ERR_DBG_FILE,ERR_DBG_LINE,ERR_DBG_FUNC), \ + ERR_set_debug(OPENSSL_FILE,OPENSSL_LINE,OPENSSL_FUNC), \ ERR_set_error) # if !OPENSSL_API_3 /* Backward compatibility */ # define ERR_put_error(lib, func, reason, file, line) \ (ERR_new(), \ - ERR_set_debug((file), (line), NULL), \ + ERR_set_debug((file), (line), OPENSSL_FUNC), \ ERR_set_error((lib), (reason), NULL)) # endif