|
39 | 39 | #define HttpPost curl_httppost
|
40 | 40 | #endif
|
41 | 41 |
|
42 |
| -/* {{{ cruft for thread safe SSL crypto locks */ |
43 |
| -#if defined(ZTS) && defined(HAVE_CURL_OLD_OPENSSL) |
44 |
| -# if defined(HAVE_OPENSSL_CRYPTO_H) |
45 |
| -# define PHP_CURL_NEED_OPENSSL_TSL |
46 |
| -# include <openssl/crypto.h> |
47 |
| -# else |
48 |
| -# warning \ |
49 |
| - "libcurl was compiled with OpenSSL support, but configure could not find " \ |
50 |
| - "openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \ |
51 |
| - "cause random crashes on SSL requests" |
52 |
| -# endif |
53 |
| -#endif /* ZTS && HAVE_CURL_OLD_OPENSSL */ |
54 |
| -/* }}} */ |
55 |
| - |
56 | 42 | #include "zend_smart_str.h"
|
57 | 43 | #include "ext/standard/info.h"
|
58 | 44 | #include "ext/standard/file.h"
|
|
70 | 56 |
|
71 | 57 | ZEND_DECLARE_MODULE_GLOBALS(curl)
|
72 | 58 |
|
73 |
| -#ifdef PHP_CURL_NEED_OPENSSL_TSL /* {{{ */ |
74 |
| -static MUTEX_T *php_curl_openssl_tsl = NULL; |
75 |
| - |
76 |
| -/* Locking callbacks are no longer used since OpenSSL 1.1. Mark the functions as unused to |
77 |
| - * avoid warnings due to this. */ |
78 |
| -static ZEND_ATTRIBUTE_UNUSED void php_curl_ssl_lock(int mode, int n, const char * file, int line) |
79 |
| -{ |
80 |
| - if (mode & CRYPTO_LOCK) { |
81 |
| - tsrm_mutex_lock(php_curl_openssl_tsl[n]); |
82 |
| - } else { |
83 |
| - tsrm_mutex_unlock(php_curl_openssl_tsl[n]); |
84 |
| - } |
85 |
| -} |
86 |
| - |
87 |
| -static ZEND_ATTRIBUTE_UNUSED unsigned long php_curl_ssl_id(void) |
88 |
| -{ |
89 |
| - return (unsigned long) tsrm_thread_id(); |
90 |
| -} |
91 |
| -#endif |
92 |
| -/* }}} */ |
93 |
| - |
94 | 59 | #define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v);
|
95 | 60 | #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v);
|
96 | 61 | #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : ""));
|
@@ -389,24 +354,6 @@ PHP_MINIT_FUNCTION(curl)
|
389 | 354 |
|
390 | 355 | register_curl_symbols(module_number);
|
391 | 356 |
|
392 |
| -#ifdef PHP_CURL_NEED_OPENSSL_TSL |
393 |
| - if (!CRYPTO_get_id_callback()) { |
394 |
| - int i, c = CRYPTO_num_locks(); |
395 |
| - |
396 |
| - php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T)); |
397 |
| - if (!php_curl_openssl_tsl) { |
398 |
| - return FAILURE; |
399 |
| - } |
400 |
| - |
401 |
| - for (i = 0; i < c; ++i) { |
402 |
| - php_curl_openssl_tsl[i] = tsrm_mutex_alloc(); |
403 |
| - } |
404 |
| - |
405 |
| - CRYPTO_set_id_callback(php_curl_ssl_id); |
406 |
| - CRYPTO_set_locking_callback(php_curl_ssl_lock); |
407 |
| - } |
408 |
| -#endif |
409 |
| - |
410 | 357 | if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK) {
|
411 | 358 | return FAILURE;
|
412 | 359 | }
|
@@ -568,21 +515,6 @@ zend_result curl_cast_object(zend_object *obj, zval *result, int type)
|
568 | 515 | PHP_MSHUTDOWN_FUNCTION(curl)
|
569 | 516 | {
|
570 | 517 | curl_global_cleanup();
|
571 |
| -#ifdef PHP_CURL_NEED_OPENSSL_TSL |
572 |
| - if (php_curl_openssl_tsl) { |
573 |
| - int i, c = CRYPTO_num_locks(); |
574 |
| - |
575 |
| - CRYPTO_set_id_callback(NULL); |
576 |
| - CRYPTO_set_locking_callback(NULL); |
577 |
| - |
578 |
| - for (i = 0; i < c; ++i) { |
579 |
| - tsrm_mutex_free(php_curl_openssl_tsl[i]); |
580 |
| - } |
581 |
| - |
582 |
| - free(php_curl_openssl_tsl); |
583 |
| - php_curl_openssl_tsl = NULL; |
584 |
| - } |
585 |
| -#endif |
586 | 518 | UNREGISTER_INI_ENTRIES();
|
587 | 519 | return SUCCESS;
|
588 | 520 | }
|
|
0 commit comments