Bug #74378 [Opn->Csd]: Compilation with OPENSSL_API_COMPAT >= 0x10100000L fails

From: Date: Fri, 18 Dec 2020 16:31:26 +0000
Subject: Bug #74378 [Opn->Csd]: Compilation with OPENSSL_API_COMPAT >= 0x10100000L fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231163@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74378&edit=1 ID: 74378 Updated by: cmb@php.net Reported by: pgnet dot dev at gmail dot com Summary: Compilation with OPENSSL_API_COMPAT >= 0x10100000L fails -Status: Open +Status: Closed Type: Bug Package: OpenSSL related Operating System: any PHP Version: master-Git-2017-04-05 (Git) -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This should be fixed as of PHP 7.2.0. Previous Comments: ------------------------------------------------------------------------ [2017-04-06 15:55:11] pgnet dot dev at gmail dot com similar result with 71-branch php -v PHP 7.1.5-dev (cli) (built: Apr 6 2017 08:49:46) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.5-dev, Copyright (c) 1999-2017, by Zend Technologies ------------------------------------------------------------------------ [2017-04-06 15:40:45] pgnet dot dev at gmail dot com applying to php head git log | head commit 67136fe77b24e59b185775ec308d81235666aaf9 Author: Remi Collet <remi@php.net> Date: Wed Apr 5 07:39:39 2017 +0200 zip ext is 1.14.0 commit 3c750d91ee9eeba00563a7a2d94a7470406b1b7e Author: Anatol Belski <ab@php.net> Date: Tue Apr 4 16:32:29 2017 +0200 this patch --- /work/php-head/ext/openssl/openssl.c.ORIG 2017-04-06 08:25:56.483452012 -0700 +++ /work/php-head/ext/openssl/openssl.c 2017-04-06 08:26:01.507431152 -0700 @@ -1399,10 +1399,10 @@ le_x509 = zend_register_list_destructors_ex(php_x509_free, NULL, "OpenSSL X.509", module_number); le_csr = zend_register_list_destructors_ex(php_csr_free, NULL, "OpenSSL X.509 CSR", module_number); - SSL_library_init(); - OpenSSL_add_all_ciphers(); - OpenSSL_add_all_digests(); - OpenSSL_add_all_algorithms(); + OPENSSL_init_ssl(0, NULL); + /* OpenSSL_add_all_ciphers(); */ + /* OpenSSL_add_all_digests(); */ + /* OpenSSL_add_all_algorithms(); */ #if !defined(OPENSSL_NO_AES) && defined(EVP_CIPH_CCM_MODE) && OPENSSL_VERSION_NUMBER < 0x100020000 EVP_add_cipher(EVP_aes_128_ccm()); @@ -1410,7 +1410,7 @@ EVP_add_cipher(EVP_aes_256_ccm()); #endif - SSL_load_error_strings(); + /* SSL_load_error_strings(); */ /* register a resource id number with OpenSSL so that we can map SSL -> stream structures in * OpenSSL callbacks */ @@ -1562,7 +1562,7 @@ { php_info_print_table_start(); php_info_print_table_row(2, "OpenSSL support", "enabled"); - php_info_print_table_row(2, "OpenSSL Library Version", SSLeay_version(SSLEAY_VERSION)); + php_info_print_table_row(2, "OpenSSL Library Version", OpenSSL_version(OPENSSL_VERSION)); php_info_print_table_row(2, "OpenSSL Header Version", OPENSSL_VERSION_TEXT); php_info_print_table_row(2, "Openssl default config", default_ssl_conf_filename); php_info_print_table_end(); @@ -1574,12 +1574,12 @@ */ PHP_MSHUTDOWN_FUNCTION(openssl) { - EVP_cleanup(); + /* EVP_cleanup(); */ /* prevent accessing locking callback from unloaded extension */ - CRYPTO_set_locking_callback(NULL); + /* CRYPTO_set_locking_callback(NULL); */ /* free allocated error strings */ - ERR_free_strings(); + /* ERR_free_strings(); */ php_unregister_url_stream_wrapper("https"); php_unregister_url_stream_wrapper("ftps"); changes to openssl 1.1 init, gets rid of deprecated calls, and allows a 'successful' (no errors) build of php + openssl ext ldd openssl.so linux-vdso.so.1 (0x00007fff749a3000) libssl.so.1.1 => /usr/local/openssl11/lib64/libssl.so.1.1 (0x00007f30afb26000) libcrypto.so.1.1 => /usr/local/openssl11/lib64/libcrypto.so.1.1 (0x00007f30af67c000) libc.so.6 => /lib64/libc.so.6 (0x00007f30af278000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f30af074000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f30aee56000) /lib64/ld-linux-x86-64.so.2 (0x000055636f465000) php -v PHP 7.2.0-dev (cli) (built: Apr 6 2017 08:31:10) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0-dev, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.2.0-dev, Copyright (c) 1999-2017, by Zend Technologies php -i | egrep -i ^openssl | grep Version OpenSSL Library Version => OpenSSL 1.1.0e 16 Feb 2017 OpenSSL Header Version => OpenSSL 1.1.0e 16 Feb 2017 note, of course, this completely ignores the necessary conditionals for keeping openssl 10x compat and, it remains as yet untested beyond this initial exec ------------------------------------------------------------------------ [2017-04-05 20:44:39] pgnet dot dev at gmail dot com Description: ------------ With php HEAD, build on linux64 + openssl 1.1 (./config --api=1.1.0 ...) currently FAILS. [referred from: Bug #72360 ext/openssl build failure with OpenSSL 1.1.0 https://bugs.php.net/bug.php?id=72360&edit=2 ] Actual result: -------------- [referred from: Bug #72360 ext/openssl build failure with OpenSSL 1.1.0 https://bugs.php.net/bug.php?id=72360&edit=2 ] With php HEAD cd /work/php-src git clean -xfd git reset --hard HEAD git checkout master git log | head nominally *requires* this fix perl -pi -e '\ s|SSLeay_version\(SSLEAY_VERSION\)|OpenSSL_version\(OPENSSL_VERSION\)|g' \ /work/php-src/ext/openssl/openssl.c then, with simple config export PHP_RPATHS="/usr/local/openssl11/lib64" ./buildconf --force ./configure \ --disable-all \ --with-openssl=/usr/local/openssl11 builds, with lots of warnings, but no apparent errors make V=1 /bin/sh /work/php-src/libtool --silent --preserve-dup-deps --mode=compile /usr/bin/gcc-6 -Iext/openssl/ -I/work/php-src/ext/openssl/ -DPHP_ATOM_INC -I/work/php-src/include -I/work/php-src/main -I/work/php-src -I/work/php-src/ext/date/lib -I/usr/local/openssl11/include -I/work/php-src/TSRM -I/work/php-src/Zend -O3 -Wall -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -fPIC -DPIC -D_GNU_SOURCE -fno-strict-aliasing -fvisibility=hidden -DZEND_SIGNALS -c /work/php-src/ext/openssl/openssl.c -o ext/openssl/openssl.lo /work/php-src/ext/openssl/openssl.c: In function ‘add_assoc_name_entry’: /work/php-src/ext/openssl/openssl.c:859:13: warning: implicit declaration of function ‘ASN1_STRING_data’ [-Wimplicit-function-declaration] to_add = ASN1_STRING_data(str); ^~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:859:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion] to_add = ASN1_STRING_data(str); ^ /work/php-src/ext/openssl/openssl.c: In function ‘asn1_time_to_time_t’: /work/php-src/ext/openssl/openssl.c:921:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] if (timestr_len != strlen((const char*)ASN1_STRING_data(timestr))) { ^ In file included from /work/php-src/Zend/zend.h:31:0, from /work/php-src/main/php.h:35, from /work/php-src/ext/openssl/openssl.c:30: /work/php-src/ext/openssl/openssl.c:936:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] strbuf = estrdup((char *)ASN1_STRING_data(timestr)); ^ /work/php-src/Zend/zend_alloc.h:172:36: note: in definition of macro ‘estrdup’ #define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) ^ /work/php-src/ext/openssl/openssl.c: In function ‘zm_startup_openssl’: /work/php-src/ext/openssl/openssl.c:1402:2: warning: implicit declaration of function ‘SSL_library_init’ [-Wimplicit-function-declaration] SSL_library_init(); ^~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1403:2: warning: implicit declaration of function ‘OpenSSL_add_all_ciphers’ [-Wimplicit-function-declaration] OpenSSL_add_all_ciphers(); ^~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1404:2: warning: implicit declaration of function ‘OpenSSL_add_all_digests’ [-Wimplicit-function-declaration] OpenSSL_add_all_digests(); ^~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1405:2: warning: implicit declaration of function ‘OpenSSL_add_all_algorithms’ [-Wimplicit-function-declaration] OpenSSL_add_all_algorithms(); ^~~~~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1413:2: warning: implicit declaration of function ‘SSL_load_error_strings’ [-Wimplicit-function-declaration] SSL_load_error_strings(); ^~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c: In function ‘zm_shutdown_openssl’: /work/php-src/ext/openssl/openssl.c:1577:2: warning: implicit declaration of function ‘EVP_cleanup’ [-Wimplicit-function-declaration] EVP_cleanup(); ^~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1580:2: warning: implicit declaration of function ‘CRYPTO_set_locking_callback’ [-Wimplicit-function-declaration] CRYPTO_set_locking_callback(NULL); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:1582:2: warning: implicit declaration of function ‘ERR_free_strings’ [-Wimplicit-function-declaration] ERR_free_strings(); ^~~~~~~~~~~~~~~~ In file included from /work/php-src/main/php.h:39:0, from /work/php-src/ext/openssl/openssl.c:30: /work/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_spki_export_challenge’: /work/php-src/ext/openssl/openssl.c:2045:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] RETVAL_STRING((char *) ASN1_STRING_data(spki->spkac->challenge)); ^ /work/php-src/Zend/zend_API.h:592:21: note: in definition of macro ‘ZVAL_STRING’ const char *_s = (s); \ ^ /work/php-src/ext/openssl/openssl.c:2045:2: note: in expansion of macro ‘RETVAL_STRING’ RETVAL_STRING((char *) ASN1_STRING_data(spki->spkac->challenge)); ^~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c: In function ‘openssl_x509v3_subjectAltName’: /work/php-src/ext/openssl/openssl.c:2236:20: warning: passing argument 2 of ‘BIO_write’ makes pointer from integer without a cast [-Wint-conversion] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~~~~~~~~ In file included from /usr/local/openssl11/include/openssl/err.h:21:0, from /work/php-src/ext/openssl/php_openssl.h:49, from /work/php-src/ext/openssl/openssl.c:32: /usr/local/openssl11/include/openssl/bio.h:549:5: note: expected ‘const void *’ but argument is of type ‘int’ int BIO_write(BIO *b, const void *data, int len); ^~~~~~~~~ /work/php-src/ext/openssl/openssl.c:2242:20: warning: passing argument 2 of ‘BIO_write’ makes pointer from integer without a cast [-Wint-conversion] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~~~~~~~~ In file included from /usr/local/openssl11/include/openssl/err.h:21:0, from /work/php-src/ext/openssl/php_openssl.h:49, from /work/php-src/ext/openssl/openssl.c:32: /usr/local/openssl11/include/openssl/bio.h:549:5: note: expected ‘const void *’ but argument is of type ‘int’ int BIO_write(BIO *b, const void *data, int len); ^~~~~~~~~ /work/php-src/ext/openssl/openssl.c:2248:20: warning: passing argument 2 of ‘BIO_write’ makes pointer from integer without a cast [-Wint-conversion] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~~~~~~~~ In file included from /usr/local/openssl11/include/openssl/err.h:21:0, from /work/php-src/ext/openssl/php_openssl.h:49, from /work/php-src/ext/openssl/openssl.c:32: /usr/local/openssl11/include/openssl/bio.h:549:5: note: expected ‘const void *’ but argument is of type ‘int’ int BIO_write(BIO *b, const void *data, int len); ^~~~~~~~~ /work/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_x509_parse’: /work/php-src/ext/openssl/openssl.c:2340:52: warning: implicit declaration of function ‘X509_get_notBefore’ [-Wimplicit-function-declaration] add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert)); ^~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:2340:52: warning: passing argument 3 of ‘add_assoc_asn1_string’ makes pointer from integer without a cast [-Wint-conversion] /work/php-src/ext/openssl/openssl.c:892:13: note: expected ‘ASN1_STRING * {aka struct asn1_string_st *}’ but argument is of type ‘int’ static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) /* {{{ */ ^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:2341:51: warning: implicit declaration of function ‘X509_get_notAfter’ [-Wimplicit-function-declaration] add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert)); ^~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:2341:51: warning: passing argument 3 of ‘add_assoc_asn1_string’ makes pointer from integer without a cast [-Wint-conversion] /work/php-src/ext/openssl/openssl.c:892:13: note: expected ‘ASN1_STRING * {aka struct asn1_string_st *}’ but argument is of type ‘int’ static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str) /* {{{ */ ^~~~~~~~~~~~~~~~~~~~~ In file included from /work/php-src/main/php.h:39:0, from /work/php-src/ext/openssl/openssl.c:30: /work/php-src/ext/openssl/openssl.c:2343:72: warning: passing argument 1 of ‘asn1_time_to_time_t’ makes pointer from integer without a cast [-Wint-conversion] add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert))); ^ /work/php-src/Zend/zend_API.h:413:90: note: in definition of macro ‘add_assoc_long’ define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n) ^~~ /work/php-src/ext/openssl/openssl.c:898:15: note: expected ‘ASN1_UTCTIME * {aka struct asn1_string_st *}’ but argument is of type ‘int’ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */ ^~~~~~~~~~~~~~~~~~~ In file included from /work/php-src/main/php.h:39:0, from /work/php-src/ext/openssl/openssl.c:30: /work/php-src/ext/openssl/openssl.c:2344:71: warning: passing argument 1 of ‘asn1_time_to_time_t’ makes pointer from integer without a cast [-Wint-conversion] add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert))); ^ /work/php-src/Zend/zend_API.h:413:90: note: in definition of macro ‘add_assoc_long’ define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n) ^~~ /work/php-src/ext/openssl/openssl.c:898:15: note: expected ‘ASN1_UTCTIME * {aka struct asn1_string_st *}’ but argument is of type ‘int’ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */ ^~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_csr_sign’: /work/php-src/ext/openssl/openssl.c:3421:18: warning: passing argument 1 of ‘X509_gmtime_adj’ makes pointer from integer without a cast [-Wint-conversion] X509_gmtime_adj(X509_get_notBefore(new_cert), 0); ^~~~~~~~~~~~~~~~~~ In file included from /work/php-src/ext/openssl/openssl.c:50:0: /usr/local/openssl11/include/openssl/x509.h:479:12: note: expected ‘ASN1_TIME * {aka struct asn1_string_st *}’ but argument is of type ‘int’ ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); ^~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c:3422:18: warning: passing argument 1 of ‘X509_gmtime_adj’ makes pointer from integer without a cast [-Wint-conversion] X509_gmtime_adj(X509_get_notAfter(new_cert), 60*60*24*(long)num_days); ^~~~~~~~~~~~~~~~~ In file included from /work/php-src/ext/openssl/openssl.c:50:0: /usr/local/openssl11/include/openssl/x509.h:479:12: note: expected ‘ASN1_TIME * {aka struct asn1_string_st *}’ but argument is of type ‘int’ ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); ^~~~~~~~~~~~~~~ /work/php-src/ext/openssl/openssl.c: In function ‘zif_openssl_seal’: /work/php-src/ext/openssl/openssl.c:5886:2: warning: implicit declaration of function ‘EVP_CIPHER_CTX_cleanup’ [-Wimplicit-function-declaration] EVP_CIPHER_CTX_cleanup(ctx); ^~~~~~~~~~~~~~~~~~~~~~ /bin/sh /work/php-src/libtool --silent --preserve-dup-deps --mode=compile /usr/bin/gcc-6 -Iext/openssl/ -I/work/php-src/ext/openssl/ -DPHP_ATOM_INC -I/work/php-src/include -I/work/php-src/main -I/work/php-src -I/work/php-src/ext/date/lib -I/usr/local/openssl11/include -I/work/php-src/TSRM -I/work/php-src/Zend -O3 -Wall -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fmessage-length=0 -grecord-gcc-switches -march=native -mtune=native -fPIC -DPIC -D_GNU_SOURCE -fno-strict-aliasing -fvisibility=hidden -DZEND_SIGNALS -c /work/php-src/ext/openssl/xp_ssl.c -o ext/openssl/xp_ssl.lo /work/php-src/ext/openssl/xp_ssl.c: In function ‘php_select_crypto_method’: /work/php-src/ext/openssl/xp_ssl.c:946:22: warning: implicit declaration of function ‘TLSv1_client_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_client_method() : TLSv1_server_method(); ^~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:946:46: warning: implicit declaration of function ‘TLSv1_server_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_client_method() : TLSv1_server_method(); ^~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:946:44: warning: return makes pointer from integer without a cast [-Wint-conversion] return is_client ? TLSv1_client_method() : TLSv1_server_method(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:949:22: warning: implicit declaration of function ‘TLSv1_1_client_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_1_client_method() : TLSv1_1_server_method(); ^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:949:48: warning: implicit declaration of function ‘TLSv1_1_server_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_1_client_method() : TLSv1_1_server_method(); ^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:949:46: warning: return makes pointer from integer without a cast [-Wint-conversion] return is_client ? TLSv1_1_client_method() : TLSv1_1_server_method(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:957:22: warning: implicit declaration of function ‘TLSv1_2_client_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_2_client_method() : TLSv1_2_server_method(); ^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:957:48: warning: implicit declaration of function ‘TLSv1_2_server_method’ [-Wimplicit-function-declaration] return is_client ? TLSv1_2_client_method() : TLSv1_2_server_method(); ^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:957:46: warning: return makes pointer from integer without a cast [-Wint-conversion] return is_client ? TLSv1_2_client_method() : TLSv1_2_server_method(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c: In function ‘php_openssl_sockop_set_option’: /work/php-src/ext/openssl/xp_ssl.c:1867:22: warning: ‘cert_captured’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (n && peer_cert && cert_captured == 0) { ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /work/php-src/ext/openssl/xp_ssl.c:1737:6: note: ‘cert_captured’ was declared here int cert_captured; ^~~~~~~~~~~~~ /bin/sh /work/php-src/libtool --silent --preserve-dup-deps --mode=link /usr/bin/gcc ... make install ldd /usr/local/php-dev/bin/php | egrep "ssl|crypto" libssl.so.1.1 => /usr/local/openssl11/lib64/libssl.so.1.1 (0x00007f8f58586000) libcrypto.so.1.1 => /usr/local/openssl11/lib64/libcrypto.so.1.1 (0x00007f8f580dc000) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74378&edit=1

« previous php.bugs (#231163) next »