[php-src] PR #18987: Fix error return check of EVP_CIPHER_CTX_ctrl()
| From: | nielsdos | Date: | Mon, 30 Jun 2025 22:22:24 +0000 |
| Subject: | [php-src] PR #18987: Fix error return check of EVP_CIPHER_CTX_ctrl() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32261@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18987
Author: nielsdos
OpenSSL can return -1 on error [1, 2], and OpenBSD's docs confirm this [3]. Existing checks
check for 1 for the success value, so do the same.
[1] https://github.com/openssl/openssl/blob/b3161bd9a9329be3d6bf6b29a06835e2721898bb/crypto/evp/evp_enc.c#L1530-L1531
[2] https://github.com/openssl/openssl/blob/b3161bd9a9329be3d6bf6b29a06835e2721898bb/crypto/evp/evp_enc.c#L1611
[3] https://man.openbsd.org/EVP_CIPHER_CTX_ctrl.3
---
This is the first batch of potentially a few of these fixes. https://github.com/php/php-src/issues/18986
prompted me to dig up my old analyzer and re-run it with the combined codebases of PHP and OpenSSL
to check for inconsistencies.