diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php index 94902a4acf0da..c8c6cb2efc728 100644 --- a/ext/openssl/openssl.stub.php +++ b/ext/openssl/openssl.stub.php @@ -181,12 +181,13 @@ * @cvalue PKCS7_NOCRL */ const PKCS7_NOCRL = UNKNOWN; +#ifndef OPENSSL_NO_RMD160 /** * @var int * @cvalue PKCS7_NO_DUAL_CONTENT */ const PKCS7_NO_DUAL_CONTENT = UNKNOWN; - +#endif /** * @var int * @cvalue CMS_DETACHED diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h index 796582c185bb6..44410a42b8dc2 100644 --- a/ext/openssl/openssl_arginfo.h +++ b/ext/openssl/openssl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8233a8abc8ab7145d905d0fa51478edfe1e55a06 */ + * Stub hash: ce5290d366b1e0710386453c27539333df270c96 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL) @@ -589,7 +589,9 @@ static void register_openssl_symbols(int module_number) REGISTER_LONG_CONSTANT("PKCS7_NOSMIMECAP", PKCS7_NOSMIMECAP, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PKCS7_CRLFEOL", PKCS7_CRLFEOL, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PKCS7_NOCRL", PKCS7_NOCRL, CONST_PERSISTENT); +#if !defined(OPENSSL_NO_RMD160) REGISTER_LONG_CONSTANT("PKCS7_NO_DUAL_CONTENT", PKCS7_NO_DUAL_CONTENT, CONST_PERSISTENT); +#endif REGISTER_LONG_CONSTANT("OPENSSL_CMS_DETACHED", CMS_DETACHED, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_CMS_TEXT", CMS_TEXT, CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OPENSSL_CMS_NOINTERN", CMS_NOINTERN, CONST_PERSISTENT); diff --git a/ext/openssl/openssl_backend_v1.c b/ext/openssl/openssl_backend_v1.c index 81c327dbfe34b..ee5ac85239902 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); +#ifdef HAVE_ENGINE_CLEANUP /* Free engine list initialized by OPENSSL_config */ ENGINE_cleanup(); +#endif /* free allocated error strings */ ERR_free_strings(); diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index ef6b3c5a01018..896b743bbc5a7 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -383,6 +383,21 @@ AS_VAR_IF([php_cv_func_getifaddrs], [yes], [AC_DEFINE([HAVE_GETIFADDRS], [1], [Define to 1 if you have the 'getifaddrs' function.])]) +dnl Check whether ENGINE_cleanup() exists in the OpenSSL/LibreSSL we build against +AC_CHECK_HEADERS([openssl/engine.h]) + +AC_CHECK_FUNCS([ENGINE_cleanup], [], [ + AC_MSG_CHECKING([for ENGINE_cleanup in libcrypto]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ENGINE_cleanup();]] + )], + [AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_ENGINE_CLEANUP], [1], [Define if ENGINE_cleanup is available])], + [AC_MSG_RESULT([no])] + ) +]) + dnl dnl Setup extension sources dnl diff --git a/ext/standard/config.w32 b/ext/standard/config.w32 index c7c14b8705ca2..af2636a338193 100644 --- a/ext/standard/config.w32 +++ b/ext/standard/config.w32 @@ -19,6 +19,13 @@ ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", "" AC_DEFINE("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR); AC_DEFINE("PHP_USE_PHP_CRYPT_R", 1, "Define to 1 if PHP uses its own crypt_r, and to 0 if using the external crypt library."); +/* Check whether ENGINE_cleanup() exists in the OpenSSL */ +if (CHECK_HEADER_ADD_INCLUDE("openssl/engine.h", "CFLAGS")) { + if (CHECK_FUNC_IN_HEADER("openssl/engine.h", "ENGINE_cleanup", null, "CFLAGS")) { + AC_DEFINE("HAVE_ENGINE_CLEANUP", 1, "Define to 1 if ENGINE_cleanup is available."); + } +} + CHECK_HEADER_ADD_INCLUDE("timelib_config.h", "CFLAGS_STANDARD", "ext/date/lib"); ADD_FLAG("LIBS_STANDARD", "iphlpapi.lib");