1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix build when --with-openssl-legacy-provider set

It was missing proper backend init split.

Closes GH-19930
This commit is contained in:
Jakub Zelenka
2025-09-23 11:32:12 +02:00
parent 320fe2975b
commit dcc4b0ff07
5 changed files with 32 additions and 21 deletions

3
NEWS
View File

@@ -51,6 +51,9 @@ PHP NEWS
(Arnaud)
. Fixed bug GH-19831 (function JIT may not deref property value). (Arnaud)
- OpenSSL:
. Fixed build when --with-openssl-legacy-provider set. (Jakub Zelenka)
- MBstring:
. Updated Unicode data tables to Unicode 17.0. (Yuya Hamada)

View File

@@ -53,11 +53,6 @@
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
#include <openssl/cms.h>
#if PHP_OPENSSL_API_VERSION >= 0x30000
#include <openssl/core_names.h>
#include <openssl/param_build.h>
#include <openssl/provider.h>
#endif
ZEND_DECLARE_MODULE_GLOBALS(openssl)

View File

@@ -473,23 +473,8 @@ zend_result php_openssl_write_rand_file(const char * file, int egdsocket, int se
return SUCCESS;
}
void php_openssl_backend_init(void)
void php_openssl_backend_init_common(void)
{
#ifdef LIBRESSL_VERSION_NUMBER
OPENSSL_config(NULL);
SSL_library_init();
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
#else
#if PHP_OPENSSL_API_VERSION >= 0x30000 && defined(LOAD_OPENSSL_LEGACY_PROVIDER)
OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(NULL, "default");
#endif
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
#endif
/* Determine default SSL configuration file */
char *config_filename = getenv("OPENSSL_CONF");
if (config_filename == NULL) {

View File

@@ -27,6 +27,22 @@
#include <openssl/engine.h>
#endif
void php_openssl_backend_init(void)
{
#ifdef LIBRESSL_VERSION_NUMBER
OPENSSL_config(NULL);
SSL_library_init();
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
#else
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
#endif
php_openssl_backend_init_common();
}
void php_openssl_backend_shutdown(void)
{
#ifdef LIBRESSL_VERSION_NUMBER

View File

@@ -24,6 +24,18 @@
ZEND_EXTERN_MODULE_GLOBALS(openssl)
void php_openssl_backend_init(void)
{
#if PHP_OPENSSL_API_VERSION >= 0x30000 && defined(LOAD_OPENSSL_LEGACY_PROVIDER)
OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(NULL, "default");
#endif
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
php_openssl_backend_init_common();
}
void php_openssl_backend_shutdown(void)
{
(void) 0;