Skip to content

Commit f415e9a

Browse files
committed
CCBC-1596: Fix deprecation warning from OpenSSL
src/ssl/ssl_common.c:348:29: warning: 'ERR_func_error_string' is deprecated [-Wdeprecated-declarations] ERR_func_error_string(err), ERR_reason_error_string(err)); ^ /usr/include/openssl/err.h:459:1: note: 'ERR_func_error_string' has been explicitly marked deprecated here OSSL_DEPRECATEDIN_3_0 const char *ERR_func_error_string(unsigned long e); ^ /usr/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0' ^ /usr/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED' ^ Change-Id: I121fdee47810fe724b34cb2819e84c35f1c5191b Reviewed-on: https://review.couchbase.org/c/libcouchbase/+/190109 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Brett Lawson <brett19@gmail.com>
1 parent c043822 commit f415e9a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/ssl/ssl_common.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ static long decode_ssl_protocol(const char *protocol)
321321
return disallow;
322322
}
323323

324+
#if (OPENSSL_VERSION_NUMBER < 0x30000000L)
325+
#define lcb_openssl_func_error_string(err) ERR_func_error_string(err)
326+
#else
327+
#define lcb_openssl_func_error_string(err) (char*)NULL
328+
#endif
324329
static lcb_STATUS add_certificate_authority(const lcb_settings *settings, SSL_CTX *ctx, const char *certificate_value,
325330
int certificate_length)
326331
{
@@ -340,7 +345,7 @@ static lcb_STATUS add_certificate_authority(const lcb_settings *settings, SSL_CT
340345
}
341346
lcb_log(LOGARGS_S(settings, LCB_LOG_ERROR),
342347
"Unable to load default certificate: lib=%s, func=%s, reason=%s", ERR_lib_error_string(err),
343-
ERR_func_error_string(err), ERR_reason_error_string(err));
348+
lcb_openssl_func_error_string(err), ERR_reason_error_string(err));
344349
rc = LCB_ERR_SSL_ERROR;
345350
goto GT_CLEANUP;
346351
}
@@ -351,7 +356,7 @@ static lcb_STATUS add_certificate_authority(const lcb_settings *settings, SSL_CT
351356
unsigned long err = ERR_get_error();
352357
lcb_log(LOGARGS_S(settings, LCB_LOG_ERROR),
353358
"Unable to add default certificate: lib=%s, func=%s, reason=%s", ERR_lib_error_string(err),
354-
ERR_func_error_string(err), ERR_reason_error_string(err));
359+
lcb_openssl_func_error_string(err), ERR_reason_error_string(err));
355360
rc = LCB_ERR_SSL_ERROR;
356361
goto GT_CLEANUP;
357362
}

0 commit comments

Comments
 (0)