Repository navigation
Stdlib: openssl_x509_verify() — certificate signature verification missing (ext/openssl/x509.c) #6595
Copy link
Copy link
Closed
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Description
Category
stdlib
Problem
openssl_x509_verify() validates an X.509 certificate against a public key / CA material. Zend registers it in ext/openssl; this compiler has partial OpenSSL coverage (#3324, #6524, #6559) but openssl_x509_verify() is not registered — function_exists('openssl_x509_verify') is false on bin/vm.php.
php-src reference
- php/php-src
ext/openssl/x509.c—PHP_FUNCTION(openssl_x509_verify) - php/php-src
ext/openssl/openssl.stub.php
Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(function_exists(\"openssl_x509_verify\"));"
php -r "var_export(function_exists(\"openssl_x509_verify\"));"
'| Runtime | Result |
|---|---|
| Zend PHP 8.2 (openssl ext) | true |
bin/vm.php |
false |
Once registered, verify against a self-signed PEM fixture:
$cert = openssl_x509_read(file_get_contents('test/fixtures/openssl/selfsigned.pem'));
$key = openssl_pkey_get_public($cert);
var_export(openssl_x509_verify($cert, $key)); // Zend: 1(Use an existing repo fixture or add minimal PEM under test/fixtures/openssl/.)
Scope (this repo)
| Component | Path | Notes |
|---|---|---|
| VM builtin | new ext/openssl/openssl_x509_verify.php + module registration |
Delegate to OpenSSL via thin ABI or documented host path for bootstrap v1 |
| Type errors | VmString::coerceStringBuiltinArg() guards |
Enum-case cert/key operands must TypeError (php-src-strict) |
| JIT/AOT | VM-only v1 acceptable | Document in capability matrix |
Prefer PHP implementation in ext/openssl/; avoid permanent C-only builtins unless migrating out of C.
Done when
function_exists('openssl_x509_verify')is true on VM- Self-signed fixture returns
1; tampered cert or wrong key returns0orfalsematching Zend - Enum-case operand raises catchable TypeError, not LogicException
- Compliance:
test/compliance/cases/stdlib/openssl_x509_verify.phptgreen on VM
Strictness: php-src-strict
Related
- Stdlib: ext/openssl — openssl_encrypt/decrypt/sign/verify (ext/openssl parity) #3324 encrypt/decrypt/sign/verify umbrella
- Stdlib: openssl_x509_fingerprint() — certificate fingerprint API missing (ext/openssl/x509.c) #6524
openssl_x509_fingerprint() - Stdlib: openssl_get_publickey()/openssl_pkey_get_*()/openssl_error_string()/openssl_pkey_get_details() — key resource API missing (ext/openssl/xp.c) #6559 key resource API
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web apps
Activity
PurHur commentedon Jul 13, 2026
claim: PHP Compiler Ext — I/O & Crypto — starting this run
Openssl: implement openssl_x509_verify() via libcrypto FFI (#6595) (#…
PurHur commentedon Jul 13, 2026
Merged via #18528
Verification (VM, libcrypto FFI):
function_exists('openssl_x509_verify')→ yesopenssl_x509_verify($cert, $cert)→10TypeError./vendor/bin/phpunit --filter openssl_x509_verify→ OKphp script/bootstrap-inventory.php --check→ OK 4747/4747./script/ci-fast.sh→ exit 0php-src ref:
ext/openssl/x509.c. PHP impl:ext/openssl/openssl_x509_verify.php,VmOpensslX509Native::verifyCertificatePem().