Skip to content

Commit

Permalink
openssl: use OPENSSL_init_ssl() with >= 1.0.0
Browse files Browse the repository at this point in the history
Reported-by: Kovalkov Dmitrii and Per Nilsson
Fixes #6254
Fixes #6256
Closes #
  • Loading branch information
bagder committed Nov 30, 2020
1 parent 65d2f56 commit 2f85b70
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/vtls/openssl.c
Expand Up @@ -1111,6 +1111,11 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
#endif
}

#ifdef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
#define INITFLAGS OPENSSL_INIT_NO_LOAD_CONFIG
#else
#define INITFLAGS OPENSSL_INIT_LOAD_CONFIG
#endif
/**
* Global SSL init
*
Expand All @@ -1119,6 +1124,10 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
*/
static int Curl_ossl_init(void)
{
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
!defined(LIBRESSL_VERSION_NUMBER)
OPENSSL_init_ssl(INITFLAGS, NULL);
#else
OPENSSL_load_builtin_modules();

#ifdef USE_OPENSSL_ENGINE
Expand All @@ -1137,10 +1146,6 @@ static int Curl_ossl_init(void)
CONF_MFLAGS_IGNORE_MISSING_FILE);
#endif

#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
!defined(LIBRESSL_VERSION_NUMBER)
/* OpenSSL 1.1.0+ takes care of initialization itself */
#else
/* Lets get nice error messages */
SSL_load_error_strings();

Expand Down

0 comments on commit 2f85b70

Please sign in to comment.