Skip to content

Use custom OpenSSL libctx for NCONF #19130

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/openssl/openssl_backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ int php_openssl_parse_config(struct php_x509_request * req, zval * optional_args

SET_OPTIONAL_STRING_ARG("config", req->config_filename, default_ssl_conf_filename);
SET_OPTIONAL_STRING_ARG("config_section_name", req->section_name, "req");
req->global_config = NCONF_new(NULL);
req->global_config = php_openssl_nconf_new();
if (!NCONF_load(req->global_config, default_ssl_conf_filename, NULL)) {
php_openssl_store_errors();
}

req->req_config = NCONF_new(NULL);
req->req_config = php_openssl_nconf_new();
if (!NCONF_load(req->req_config, req->config_filename, NULL)) {
return FAILURE;
}
Expand Down
5 changes: 5 additions & 0 deletions ext/openssl/openssl_backend_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,4 +687,9 @@ void php_openssl_get_cipher_methods(zval *return_value, bool aliases)
return_value);
}

CONF *php_openssl_nconf_new(void)
{
return NCONF_new(NULL);
}

#endif
5 changes: 5 additions & 0 deletions ext/openssl/openssl_backend_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,4 +826,9 @@ void php_openssl_get_cipher_methods(zval *return_value, bool aliases)
zend_hash_sort(Z_ARRVAL_P(return_value), php_openssl_compare_func, 1);
}

CONF *php_openssl_nconf_new(void)
{
return NCONF_new_ex(PHP_OPENSSL_LIBCTX, NULL);
}

#endif
2 changes: 2 additions & 0 deletions ext/openssl/php_openssl_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,4 +366,6 @@ zend_result php_openssl_cipher_update(const EVP_CIPHER *cipher_type,

const EVP_CIPHER *php_openssl_get_evp_cipher_by_name(const char *method);

CONF *php_openssl_nconf_new(void);

#endif