Skip to content

Use libctx for X509 store lookups and verification in ext/openssl - #25684

Open
bukka wants to merge 1 commit into
php:PHP-8.5from
bukka:openssl_libctx_setup_verify
Open

bukka wants to merge 1 commit into
php:PHP-8.5from
bukka:openssl_libctx_setup_verify

Conversation

@bukka

@bukka bukka commented Nov 23, 2026

Copy link
Copy Markdown
Member

php_openssl_setup_verify() loaded CA files using X509_LOOKUP_load_file() which always creates the certificates in the default library context. Use X509_LOOKUP_load_file_ex() with the configured libctx and propq instead.

There is no libctx variant of X509_LOOKUP_add_dir() because the hash dir lookup loads certificates lazily using the libctx of the X509_STORE_CTX doing the verification. So php_openssl_check_cert() now creates the store context using X509_STORE_CTX_new_ex().

This is part of GH-14734.

@bukka
bukka changed the base branch from master to PHP-8.5 November 23, 2026 21:47
php_openssl_setup_verify() loaded CA files using X509_LOOKUP_load_file()
which always creates the certificates in the default library context.
Use X509_LOOKUP_load_file_ex() with the configured libctx and propq
instead.

There is no libctx variant of X509_LOOKUP_add_dir() because the hash dir
lookup loads certificates lazily using the libctx of the X509_STORE_CTX
doing the verification. So php_openssl_check_cert() now creates the
store context using X509_STORE_CTX_new_ex().

This is part of phpGH-14734.
@bukka
bukka force-pushed the openssl_libctx_setup_verify branch from 6df32a8 to cda1669 Compare November 23, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant