Skip to content

Commit 25c0874

Browse files
authored
Use custom OpenSSL libctx for NCONF (#19130)
1 parent 142e378 commit 25c0874

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

ext/openssl/openssl_backend_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,12 @@ int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args
297297

298298
SET_OPTIONAL_STRING_ARG("config", req->config_filename, default_ssl_conf_filename);
299299
SET_OPTIONAL_STRING_ARG("config_section_name", req->section_name, "req");
300-
req->global_config = NCONF_new(NULL);
300+
req->global_config = php_openssl_nconf_new();
301301
if (!NCONF_load(req->global_config, default_ssl_conf_filename, NULL)) {
302302
php_openssl_store_errors();
303303
}
304304

305-
req->req_config = NCONF_new(NULL);
305+
req->req_config = php_openssl_nconf_new();
306306
if (!NCONF_load(req->req_config, req->config_filename, NULL)) {
307307
return FAILURE;
308308
}

ext/openssl/openssl_backend_v1.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,4 +687,9 @@ void php_openssl_get_cipher_methods(zval *return_value, bool aliases)
687687
return_value);
688688
}
689689

690+
CONF *php_openssl_nconf_new(void)
691+
{
692+
return NCONF_new(NULL);
693+
}
694+
690695
#endif

ext/openssl/openssl_backend_v3.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,4 +826,9 @@ void php_openssl_get_cipher_methods(zval *return_value, bool aliases)
826826
zend_hash_sort(Z_ARRVAL_P(return_value), php_openssl_compare_func, 1);
827827
}
828828

829+
CONF *php_openssl_nconf_new(void)
830+
{
831+
return NCONF_new_ex(PHP_OPENSSL_LIBCTX, NULL);
832+
}
833+
829834
#endif

ext/openssl/php_openssl_backend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,4 +366,6 @@ zend_result php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
366366

367367
const EVP_CIPHER *php_openssl_get_evp_cipher_by_name(const char *method);
368368

369+
CONF *php_openssl_nconf_new(void);
370+
369371
#endif

0 commit comments

Comments
 (0)