summaryrefslogtreecommitdiff
path: root/ext/openssl/php_openssl.h
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2018-05-21 17:55:11 +0100
committerJakub Zelenka <bukka@php.net>2018-05-22 13:30:58 +0100
commit68c3d09c2c1b88eafcf8b82af24f77756fd1d77f (patch)
tree0875e7133b84f27594afdf75ca9bfd3dce46571a /ext/openssl/php_openssl.h
parentbc6ddb7f458d0933ee318e732acca464cd924713 (diff)
downloadphp-git-68c3d09c2c1b88eafcf8b82af24f77756fd1d77f.tar.gz
Fix bug #76174 (openssl extension fails to build with LibreSSL 2.7)
Diffstat (limited to 'ext/openssl/php_openssl.h')
-rw-r--r--ext/openssl/php_openssl.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index f13225d049..a03581c983 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -29,6 +29,25 @@ extern zend_module_entry openssl_module_entry;
#include "php_version.h"
#define PHP_OPENSSL_VERSION PHP_VERSION
+#include <openssl/opensslv.h>
+#if defined(LIBRESSL_VERSION_NUMBER)
+/* LibreSSL version check */
+#if LIBRESSL_VERSION_NUMBER < 0x20700000L
+#define PHP_OPENSSL_API_VERSION 0x10001
+#else
+#define PHP_OPENSSL_API_VERSION 0x10100
+#endif
+#else
+/* OpenSSL version check */
+#if OPENSSL_VERSION_NUMBER < 0x10002000L
+#define PHP_OPENSSL_API_VERSION 0x10001
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L
+#define PHP_OPENSSL_API_VERSION 0x10002
+#else
+#define PHP_OPENSSL_API_VERSION 0x10100
+#endif
+#endif
+
#define OPENSSL_RAW_DATA 1
#define OPENSSL_ZERO_PADDING 2
#define OPENSSL_DONT_ZERO_PAD_KEY 4