Skip to content
Open
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
6 changes: 3 additions & 3 deletions ext/openssl/openssl_backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ int php_openssl_check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedch
int ret=0;
X509_STORE_CTX *csc;

csc = X509_STORE_CTX_new();
csc = php_openssl_x509_store_ctx_new();
if (csc == NULL) {
php_openssl_store_errors();
php_error_docref(NULL, E_ERROR, "Memory allocation failure");
Expand Down Expand Up @@ -811,7 +811,7 @@ X509_STORE *php_openssl_setup_verify(zval *calist, uint32_t arg_num)

if ((sb.st_mode & S_IFREG) == S_IFREG) {
file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, file_path, X509_FILETYPE_PEM)) {
if (file_lookup == NULL || !php_openssl_x509_lookup_load_file(file_lookup, file_path, X509_FILETYPE_PEM)) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Error loading file %s", file_path);
} else {
Expand All @@ -832,7 +832,7 @@ X509_STORE *php_openssl_setup_verify(zval *calist, uint32_t arg_num)
}
if (nfiles == 0) {
file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT)) {
if (file_lookup == NULL || !php_openssl_x509_lookup_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT)) {
php_openssl_store_errors();
}
}
Expand Down
10 changes: 10 additions & 0 deletions ext/openssl/openssl_backend_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,16 @@ STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in)
return PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
}

X509_STORE_CTX *php_openssl_x509_store_ctx_new(void)
{
return X509_STORE_CTX_new();
}

int php_openssl_x509_lookup_load_file(X509_LOOKUP *lookup, const char *file, int type)
{
return X509_LOOKUP_load_file(lookup, file, type);
}

EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in)
{
return PEM_read_bio_PUBKEY(in, NULL, NULL, NULL);
Expand Down
10 changes: 10 additions & 0 deletions ext/openssl/openssl_backend_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,16 @@ STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in)
return PEM_X509_INFO_read_bio_ex(in, NULL, NULL, NULL, PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
}

X509_STORE_CTX *php_openssl_x509_store_ctx_new(void)
{
return X509_STORE_CTX_new_ex(PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
}

int php_openssl_x509_lookup_load_file(X509_LOOKUP *lookup, const char *file, int type)
{
return X509_LOOKUP_load_file_ex(lookup, file, type, PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
}

EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in)
{
return PEM_read_bio_PUBKEY_ex(in, NULL, NULL, NULL, PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
Expand Down
2 changes: 2 additions & 0 deletions ext/openssl/php_openssl_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ X509 *php_openssl_pem_read_asn1_bio_x509(BIO *in);
X509 *php_openssl_pem_read_bio_x509(BIO *in);
X509_REQ *php_openssl_pem_read_bio_x509_req(BIO *in);
STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in);
X509_STORE_CTX *php_openssl_x509_store_ctx_new(void);
int php_openssl_x509_lookup_load_file(X509_LOOKUP *lookup, const char *file, int type);
EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in);
EVP_PKEY *php_openssl_pem_read_bio_private_key(BIO *in, pem_password_cb *cb, void *u);
PKCS7 *php_openssl_pem_read_bio_pkcs7(BIO *in);
Expand Down
Loading