php/8.2: adjust #ifdef around #include to match the #ifdef around a call

to ENGINE_cleanup, to avoid implicit declaration with libressl:

php-8.2.0/ext/openssl/openssl.c:1329:2: warning: implicit declaration of function 'ENGINE_cleanup' is invalid in C99 [-Wimplicit-function-declaration]
This commit is contained in:
sthen 2022-12-12 13:30:58 +00:00
parent 3eb7a2c0b7
commit dea5055fd9
2 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,7 @@ BROKEN-sparc64= fibers requires either ucontext or asm code (not present for spa
PHP_VERSION= 8.2.0
PHP_PKGSPEC= >=8.2,<8.3
REVISION-main= 0
DEBUG_PACKAGES= ${BUILD_PACKAGES}

View File

@ -1,3 +1,9 @@
#1:
ENGINE_cleanup() is used in a block gated by OPENSSL_VERSION_NUMBER <
0x10100000L || defined(LIBRESSL_VERSION_NUMBER), so make sure that the
header defining this is gated by the same ifdef.
#2:
This check doesn't make sense for EC keys. (Also it ignores the default
key size compiled into libcrypto, only looks at default_bits in openssl.cnf
and any settings in the php file, which results in bogus failures).
@ -5,6 +11,15 @@ and any settings in the php file, which results in bogus failures).
Index: ext/openssl/openssl.c
--- ext/openssl/openssl.c.orig
+++ ext/openssl/openssl.c
@@ -61,7 +61,7 @@
#include <openssl/param_build.h>
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_NO_ENGINE)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && !defined(OPENSSL_NO_ENGINE)
#include <openssl/engine.h>
#endif
@@ -3662,7 +3662,7 @@ static int php_openssl_get_evp_pkey_type(int key_type)
/* {{{ php_openssl_generate_private_key */
static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req)