Commit cdbba57ec95 for php
commit cdbba57ec951251bd1cddfbed6467b7cee7c22dc
Author: Eugene Gvozdetsky <gvozdet@gmail.com>
Date: Mon Sep 14 18:52:22 2026 +0200
Fix GH-20920: guard ENGINE_cleanup() with OPENSSL_NO_ENGINE again
The call was guarded by #ifndef OPENSSL_NO_ENGINE until the v1/v3 backend
split in d662ab5f08a moved it from ext/openssl/openssl.c into
ext/openssl/openssl_backend_v1.c, where only the surrounding
#ifdef LIBRESSL_VERSION_NUMBER was kept.
LibreSSL defines OPENSSL_NO_ENGINE, so <openssl/engine.h> is not included
and ENGINE_cleanup() ends up being called without a prototype. That is a
warning with older compilers and an error with GCC 14 and later, which
default to C23. Restore the guard so that the call matches the condition
of its include.
Closes GH-23689
diff --git a/ext/openssl/openssl_backend_v1.c b/ext/openssl/openssl_backend_v1.c
index 13aab24c3ff..235344b22a5 100644
--- a/ext/openssl/openssl_backend_v1.c
+++ b/ext/openssl/openssl_backend_v1.c
@@ -51,8 +51,10 @@ void php_openssl_backend_shutdown(void)
/* prevent accessing locking callback from unloaded extension */
CRYPTO_set_locking_callback(NULL);
+#ifndef OPENSSL_NO_ENGINE
/* Free engine list initialized by OPENSSL_config */
ENGINE_cleanup();
+#endif
/* free allocated error strings */
ERR_free_strings();