Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dcc4b0f

Browse files
committed
Fix build when --with-openssl-legacy-provider set
It was missing proper backend init split. Closes GH-19930
1 parent 320fe29 commit dcc4b0f

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

‎NEWS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ PHP NEWS
5151
(Arnaud)
5252
. Fixed bug GH-19831 (function JIT may not deref property value). (Arnaud)
5353

54+
- OpenSSL:
55+
. Fixed build when --with-openssl-legacy-provider set. (Jakub Zelenka)
56+
5457
- MBstring:
5558
. Updated Unicode data tables to Unicode 17.0. (Yuya Hamada)
5659

‎ext/openssl/openssl.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@
5353
#include <openssl/ssl.h>
5454
#include <openssl/pkcs12.h>
5555
#include <openssl/cms.h>
56-
#if PHP_OPENSSL_API_VERSION >= 0x30000
57-
#include <openssl/core_names.h>
58-
#include <openssl/param_build.h>
59-
#include <openssl/provider.h>
60-
#endif
6156

6257
ZEND_DECLARE_MODULE_GLOBALS(openssl)
6358

‎ext/openssl/openssl_backend_common.c‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -473,23 +473,8 @@ zend_result php_openssl_write_rand_file(const char * file, int egdsocket, int se
473473
return SUCCESS;
474474
}
475475

476-
void php_openssl_backend_init(void)
476+
void php_openssl_backend_init_common(void)
477477
{
478-
#ifdef LIBRESSL_VERSION_NUMBER
479-
OPENSSL_config(NULL);
480-
SSL_library_init();
481-
OpenSSL_add_all_ciphers();
482-
OpenSSL_add_all_digests();
483-
OpenSSL_add_all_algorithms();
484-
SSL_load_error_strings();
485-
#else
486-
#if PHP_OPENSSL_API_VERSION >= 0x30000 && defined(LOAD_OPENSSL_LEGACY_PROVIDER)
487-
OSSL_PROVIDER_load(NULL, "legacy");
488-
OSSL_PROVIDER_load(NULL, "default");
489-
#endif
490-
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
491-
#endif
492-
493478
/* Determine default SSL configuration file */
494479
char *config_filename = getenv("OPENSSL_CONF");
495480
if (config_filename == NULL) {

‎ext/openssl/openssl_backend_v1.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@
2727
#include <openssl/engine.h>
2828
#endif
2929

30+
void php_openssl_backend_init(void)
31+
{
32+
#ifdef LIBRESSL_VERSION_NUMBER
33+
OPENSSL_config(NULL);
34+
SSL_library_init();
35+
OpenSSL_add_all_ciphers();
36+
OpenSSL_add_all_digests();
37+
OpenSSL_add_all_algorithms();
38+
SSL_load_error_strings();
39+
#else
40+
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
41+
#endif
42+
43+
php_openssl_backend_init_common();
44+
}
45+
3046
void php_openssl_backend_shutdown(void)
3147
{
3248
#ifdef LIBRESSL_VERSION_NUMBER

‎ext/openssl/openssl_backend_v3.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424

2525
ZEND_EXTERN_MODULE_GLOBALS(openssl)
2626

27+
void php_openssl_backend_init(void)
28+
{
29+
#if PHP_OPENSSL_API_VERSION >= 0x30000 && defined(LOAD_OPENSSL_LEGACY_PROVIDER)
30+
OSSL_PROVIDER_load(NULL, "legacy");
31+
OSSL_PROVIDER_load(NULL, "default");
32+
#endif
33+
34+
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
35+
36+
php_openssl_backend_init_common();
37+
}
38+
2739
void php_openssl_backend_shutdown(void)
2840
{
2941
(void) 0;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /