summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-11 16:45:45 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-04-11 16:45:45 +0200
commit3e0f9c2c94d1511eaf30f8f1de8260f5821c985f (patch)
tree5c209aadf64043db1666deb2cf1e073db2661b64
parent9d663cba1abed1697dce5f73a7177ad2d7beaeb7 (diff)
downloadphp-git-3e0f9c2c94d1511eaf30f8f1de8260f5821c985f.tar.gz
Remove curl gnutls locking
This is only relevant for the gcrypt backend, which is no longer in use. I couldn't find any hard info on when exactly gcrypt support was dropped, but nette is the default since 2.11.1. Most code that still has the gcrypt handling is checking against < 2.12. In either case, those versions were released in 2010/2011.
-rw-r--r--ext/curl/config.m44
-rw-r--r--ext/curl/interface.c51
2 files changed, 3 insertions, 52 deletions
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
index 6ebfac78c8..88447bd78a 100644
--- a/ext/curl/config.m4
+++ b/ext/curl/config.m4
@@ -80,9 +80,7 @@ int main(int argc, char *argv[])
}
]])], [
AC_MSG_RESULT([yes])
- AC_CHECK_HEADER([gcrypt.h], [
- AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
- ])
+ AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
], [
AC_MSG_RESULT([no])
], [
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 8959bc1004..f074cbac0d 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -59,15 +59,8 @@
"cause random crashes on SSL requests"
# endif
# elif defined(HAVE_CURL_GNUTLS)
-# if defined(HAVE_GCRYPT_H)
-# define PHP_CURL_NEED_GNUTLS_TSL
-# include <gcrypt.h>
-# else
-# warning \
- "libcurl was compiled with GnuTLS support, but configure could not find " \
- "gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
- "cause random crashes on SSL requests"
-# endif
+ /* Modern versions of GnuTLS use the nette backend rather than gcrypt, so there
+ * is nothing to do here anymore. */
# else
# warning \
"libcurl was compiled with SSL support, but configure could not determine which" \
@@ -111,43 +104,6 @@ static ZEND_ATTRIBUTE_UNUSED unsigned long php_curl_ssl_id(void)
#endif
/* }}} */
-#ifdef PHP_CURL_NEED_GNUTLS_TSL /* {{{ */
-static int php_curl_ssl_mutex_create(void **m)
-{
- if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-static int php_curl_ssl_mutex_destroy(void **m)
-{
- tsrm_mutex_free(*((MUTEX_T *) m));
- return SUCCESS;
-}
-
-static int php_curl_ssl_mutex_lock(void **m)
-{
- return tsrm_mutex_lock(*((MUTEX_T *) m));
-}
-
-static int php_curl_ssl_mutex_unlock(void **m)
-{
- return tsrm_mutex_unlock(*((MUTEX_T *) m));
-}
-
-static struct gcry_thread_cbs php_curl_gnutls_tsl = {
- GCRY_THREAD_OPTION_USER,
- NULL,
- php_curl_ssl_mutex_create,
- php_curl_ssl_mutex_destroy,
- php_curl_ssl_mutex_lock,
- php_curl_ssl_mutex_unlock
-};
-#endif
-/* }}} */
-
static void _php_curl_close_ex(php_curl *ch);
static void _php_curl_close(zend_resource *rsrc);
@@ -1473,9 +1429,6 @@ PHP_MINIT_FUNCTION(curl)
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
#endif
-#ifdef PHP_CURL_NEED_GNUTLS_TSL
- gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
-#endif
if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK) {
return FAILURE;