-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/openssl: Bump minimum required OpenSSL version to 1.1.1 #13498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ runs: | |
brew install \ | ||
openssl@1.1 \ | ||
curl \ | ||
krb5 \ | ||
bzip2 \ | ||
enchant \ | ||
libffi \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ | |
#include <openssl/param_build.h> | ||
#endif | ||
|
||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && !defined(OPENSSL_NO_ENGINE) | ||
#if defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_NO_ENGINE) | ||
#include <openssl/engine.h> | ||
#endif | ||
|
||
|
@@ -99,7 +99,7 @@ | |
#define HAVE_EVP_PKEY_EC 1 | ||
|
||
/* the OPENSSL_EC_EXPLICIT_CURVE value was added | ||
* in OpenSSL 1.1.0; previous versions should | ||
* in OpenSSL 1.1.0; previous versions should | ||
* use 0 instead. | ||
*/ | ||
#ifndef OPENSSL_EC_EXPLICIT_CURVE | ||
|
@@ -1269,7 +1269,7 @@ PHP_MINIT_FUNCTION(openssl) | |
php_openssl_pkey_object_handlers.clone_obj = NULL; | ||
php_openssl_pkey_object_handlers.compare = zend_objects_not_comparable; | ||
|
||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) | ||
#ifdef LIBRESSL_VERSION_NUMBER | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we check LibreSSL if we still need this. It might be worth to bump LibreSSL min version as well so we can get rid of all of the 1.0.2 specific code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really know how to check if this works well with LibreSSL I'm afraid. I couldn't get PHP's FWIW, LibreSSL seems to declare a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was for LibreSSL version that did not have any compat. Think it's enough to just change pkgconfig path to point to LibreSSL but don't worry, it might be actually better to leave it for another PR. I haven't used LibreSSL for some time so might need to look into it anyway to do some other testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect, thank you. I'll experiment with libressl later and see if I could be any help too. |
||
OPENSSL_config(NULL); | ||
SSL_library_init(); | ||
OpenSSL_add_all_ciphers(); | ||
|
@@ -1309,9 +1309,7 @@ PHP_MINIT_FUNCTION(openssl) | |
php_stream_xport_register("tlsv1.0", php_openssl_ssl_socket_factory); | ||
php_stream_xport_register("tlsv1.1", php_openssl_ssl_socket_factory); | ||
php_stream_xport_register("tlsv1.2", php_openssl_ssl_socket_factory); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10101000 | ||
php_stream_xport_register("tlsv1.3", php_openssl_ssl_socket_factory); | ||
#endif | ||
|
||
/* override the default tcp socket provider */ | ||
php_stream_xport_register("tcp", php_openssl_ssl_socket_factory); | ||
|
@@ -1364,7 +1362,7 @@ PHP_MINFO_FUNCTION(openssl) | |
/* {{{ PHP_MSHUTDOWN_FUNCTION */ | ||
PHP_MSHUTDOWN_FUNCTION(openssl) | ||
{ | ||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) | ||
#ifdef LIBRESSL_VERSION_NUMBER | ||
EVP_cleanup(); | ||
|
||
/* prevent accessing locking callback from unloaded extension */ | ||
|
@@ -1391,9 +1389,7 @@ PHP_MSHUTDOWN_FUNCTION(openssl) | |
php_stream_xport_unregister("tlsv1.0"); | ||
php_stream_xport_unregister("tlsv1.1"); | ||
php_stream_xport_unregister("tlsv1.2"); | ||
#if OPENSSL_VERSION_NUMBER >= 0x10101000 | ||
php_stream_xport_unregister("tlsv1.3"); | ||
#endif | ||
|
||
/* reinstate the default tcp handler */ | ||
php_stream_xport_register("tcp", php_stream_generic_socket_factory); | ||
|
@@ -4609,7 +4605,7 @@ static EVP_PKEY *php_openssl_pkey_init_ec(zval *data, bool *is_private) { | |
EVP_PKEY_CTX_free(ctx); | ||
ctx = EVP_PKEY_CTX_new(param_key, NULL); | ||
} | ||
|
||
if (EVP_PKEY_check(ctx) || EVP_PKEY_public_check_quick(ctx)) { | ||
*is_private = d != NULL; | ||
EVP_PKEY_up_ref(param_key); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions inside this #if block are either deprecated or do nothing anymore on OpenSSL versions >= 1.1.0.
So I think this should've been removed, i.e.
OPENSSL_VERSION_NUMBER < 0x10101000
is always false now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR: #13793
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does not contain LibreSSL bump: See #13498 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry this part could actually be removed - it's not defined - missed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just went through it again and looks really like the only incorrect thing. Next step will be to bump LibreSSL and drop the code that is not needed.