Skip to content

Commit f6502e5

Browse files
committed
Check if ENGINE_cleanup and PKCS7_NO_DUAL_CONTENT exist in OpenSSL build
1 parent 858d34f commit f6502e5

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

ext/openssl/openssl.stub.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,13 @@
181181
* @cvalue PKCS7_NOCRL
182182
*/
183183
const PKCS7_NOCRL = UNKNOWN;
184+
#ifndef OPENSSL_NO_RMD160
184185
/**
185186
* @var int
186187
* @cvalue PKCS7_NO_DUAL_CONTENT
187188
*/
188189
const PKCS7_NO_DUAL_CONTENT = UNKNOWN;
189-
190+
#endif
190191
/**
191192
* @var int
192193
* @cvalue CMS_DETACHED

ext/openssl/openssl_arginfo.h

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/openssl/openssl_backend_v1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ void php_openssl_backend_shutdown(void)
5151
/* prevent accessing locking callback from unloaded extension */
5252
CRYPTO_set_locking_callback(NULL);
5353

54+
#ifdef HAVE_ENGINE_CLEANUP
5455
/* Free engine list initialized by OPENSSL_config */
5556
ENGINE_cleanup();
57+
#endif
5658

5759
/* free allocated error strings */
5860
ERR_free_strings();

ext/standard/config.m4

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,21 @@ AS_VAR_IF([php_cv_func_getifaddrs], [yes],
383383
[AC_DEFINE([HAVE_GETIFADDRS], [1],
384384
[Define to 1 if you have the 'getifaddrs' function.])])
385385

386+
dnl Check whether ENGINE_cleanup() exists in the OpenSSL/LibreSSL we build against
387+
AC_CHECK_HEADERS([openssl/engine.h])
388+
389+
AC_CHECK_FUNCS([ENGINE_cleanup], [], [
390+
AC_MSG_CHECKING([for ENGINE_cleanup in libcrypto])
391+
AC_LINK_IFELSE(
392+
[AC_LANG_PROGRAM(
393+
[[#include <openssl/engine.h>]],
394+
[[ENGINE_cleanup();]]
395+
)],
396+
[AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_ENGINE_CLEANUP], [1], [Define if ENGINE_cleanup is available])],
397+
[AC_MSG_RESULT([no])]
398+
)
399+
])
400+
386401
dnl
387402
dnl Setup extension sources
388403
dnl

ext/standard/config.w32

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", ""
1919
AC_DEFINE("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR);
2020
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.");
2121

22+
/* Check whether ENGINE_cleanup() exists in the OpenSSL */
23+
if (CHECK_HEADER_ADD_INCLUDE("openssl/engine.h", "CFLAGS")) {
24+
if (CHECK_FUNC_IN_HEADER("openssl/engine.h", "ENGINE_cleanup", null, "CFLAGS")) {
25+
AC_DEFINE("HAVE_ENGINE_CLEANUP", 1, "Define to 1 if ENGINE_cleanup is available.");
26+
}
27+
}
28+
2229
CHECK_HEADER_ADD_INCLUDE("timelib_config.h", "CFLAGS_STANDARD", "ext/date/lib");
2330

2431
ADD_FLAG("LIBS_STANDARD", "iphlpapi.lib");

0 commit comments

Comments
 (0)