Skip to content

Commit 68f6ab7

Browse files
committed
Don't link against openssl 1.1 in curl
OpenSSL 1.1 does not need crypto locking callbacks, so avoid detecting and linking against it in the first place.
1 parent 74b11e3 commit 68f6ab7

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ext/curl/config.m4

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if test "$PHP_CURL" != "no"; then
2626
save_LDFLAGS="$LDFLAGS"
2727
LDFLAGS="$LDFLAGS $CURL_LIBS"
2828

29-
AC_MSG_CHECKING([for openssl support in libcurl])
29+
AC_MSG_CHECKING([for libcurl linked against old openssl])
3030
AC_RUN_IFELSE([AC_LANG_SOURCE([[
3131
#include <strings.h>
3232
#include <curl/curl.h>
@@ -39,13 +39,23 @@ int main(int argc, char *argv[])
3939
const char *ptr = data->ssl_version;
4040
4141
while(*ptr == ' ') ++ptr;
42-
return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
42+
if (strncasecmp(ptr, "OpenSSL/1.1", sizeof("OpenSSL/1.1")-1) == 0) {
43+
/* New OpenSSL version */
44+
return 3;
45+
}
46+
if (strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1) == 0) {
47+
/* Old OpenSSL version */
48+
return 0;
49+
}
50+
/* Different SSL library */
51+
return 2;
4352
}
53+
/* No SSL support */
4454
return 1;
4555
}
4656
]])],[
4757
AC_MSG_RESULT([yes])
48-
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
58+
AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL])
4959
PKG_CHECK_MODULES([OPENSSL], [openssl], [
5060
PHP_EVAL_LIBLINE($OPENSSL_LIBS, CURL_SHARED_LIBADD)
5161
PHP_EVAL_INCLINE($OPENSSL_CFLAGS)

ext/curl/interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#endif
4444

4545
/* {{{ cruft for thread safe SSL crypto locks */
46-
#if defined(ZTS) && defined(HAVE_CURL_OPENSSL)
46+
#if defined(ZTS) && defined(HAVE_CURL_OLD_OPENSSL)
4747
# if defined(HAVE_OPENSSL_CRYPTO_H)
4848
# define PHP_CURL_NEED_OPENSSL_TSL
4949
# include <openssl/crypto.h>
@@ -53,7 +53,7 @@
5353
"openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
5454
"cause random crashes on SSL requests"
5555
# endif
56-
#endif /* ZTS && HAVE_CURL_OPENSSL */
56+
#endif /* ZTS && HAVE_CURL_OLD_OPENSSL */
5757
/* }}} */
5858

5959
#define SMART_STR_PREALLOC 4096

0 commit comments

Comments
 (0)