Skip to content

Commit

Permalink
Add patches obtained from LibreSSL to fix build when RAND_EGD() or SS…
Browse files Browse the repository at this point in the history
…Lv3 support

is not present in SSL library.
Add workaround for decimal floating point support in older versions of GCC which
resolves build problem on OpenBSD.

Reviewed by wiz@
  • Loading branch information
sevan committed Nov 16, 2015
1 parent 08ed95f commit c909848
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lang/php54/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.32 2015/10/27 09:08:20 jperkin Exp $
# $NetBSD: Makefile,v 1.33 2015/11/16 13:12:27 sevan Exp $

#
# We can't omit PKGNAME here to handle PKG_OPTIONS.
Expand Down Expand Up @@ -47,6 +47,12 @@ INSTALLATION_DIRS+= ${CGIDIR} ${PHP_EXTENSION_DIR} ${EGDIR} share/php
CONFIGURE_ARGS+= --disable-libgcc
.endif

.if ${OPSYS} == "OpenBSD"
# From PHP bug #68114
# Workaround issue with decimal floating point support in older versions of GCC
CONFIGURE_ENV+= ac_cv_decimal_fp_supported=no
.endif

post-extract:
cd ${WRKSRC} && \
${FIND} . -xdev -type f -name '*.orig' -exec ${RM} -f {} \;
Expand Down
4 changes: 3 additions & 1 deletion lang/php54/distinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.64 2015/11/03 22:50:41 agc Exp $
$NetBSD: distinfo,v 1.65 2015/11/16 13:12:27 sevan Exp $

SHA1 (php-5.4.45.tar.bz2) = 3032efebf7001e7720c5e42d9898d7077612e9b4
RMD160 (php-5.4.45.tar.bz2) = 352a0ea8fb75a447301c1434609ac0e4b96acc0c
Expand All @@ -11,6 +11,8 @@ SHA1 (patch-configure) = df6209127b1e23d17bc7128da3a44f3e44bbfd48
SHA1 (patch-ext_gd_config.m4) = 2353efe6f25e1081b41d61033c3185cc643c7891
SHA1 (patch-ext_imap_config.m4) = 01681e8b54ee586ec4db72a5da2d0aec3fa89fcc
SHA1 (patch-ext_mssql_php__mssql.c) = 732e48b05086180585a3087c2e9737db557dbc3b
SHA1 (patch-ext_openssl_openssl.c) = 25d2561acba8843fd8a5c067056f986b3acd8ca1
SHA1 (patch-ext_openssl_xp__ssl.c) = 976cb9bee3928a4bb87164022e32754af7e40d8c
SHA1 (patch-ext_pdo__mysql_config.m4) = 3526e737da25129710218e7141d5a05ae0a51390
SHA1 (patch-ext_pdo_config.m4) = 26a4ad02e5c6b7a54c3c54a6d026a3ccfed62c59
SHA1 (patch-ext_phar_Makefile.frag) = 1af23d9135557bc7ba2f3627b317d4cbef37aaba
Expand Down
21 changes: 21 additions & 0 deletions lang/php54/patches/patch-ext_openssl_openssl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$NetBSD: patch-ext_openssl_openssl.c,v 1.4 2015/11/16 13:12:27 sevan Exp $

Unbreak when SSL library is without RAND_EGD() support.
Obtained from http://www.libressl.org/patches.html

--- ext/openssl/openssl.c.orig Mon Nov 16 00:05:47 2015
+++ ext/openssl/openssl.c
@@ -915,11 +915,13 @@ static int php_openssl_load_rand_file(const char * fil

if (file == NULL) {
file = RAND_file_name(buffer, sizeof(buffer));
+#ifdef HAVE_SSL_RAND_EGD
} else if (RAND_egd(file) > 0) {
/* if the given filename is an EGD socket, don't
* write anything back to it */
*egdsocket = 1;
return SUCCESS;
+#endif
}
if (file == NULL || !RAND_load_file(file, -1)) {
if (RAND_status() == 0) {
37 changes: 37 additions & 0 deletions lang/php54/patches/patch-ext_openssl_xp__ssl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
$NetBSD: patch-ext_openssl_xp__ssl.c,v 1.1 2015/11/16 13:12:27 sevan Exp $

Unbreak when SSL library does not have SSLv3 support
Obtained from http://www.libressl.org/patches.html

--- ext/openssl/xp_ssl.c.orig Mon Nov 16 00:05:21 2015
+++ ext/openssl/xp_ssl.c
@@ -339,9 +339,14 @@ static inline int php_openssl_setup_crypto(php_stream
break;
#endif
case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
+#ifdef OPENSSL_NO_SSL3
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return -1;
+#else
sslsock->is_client = 1;
method = SSLv3_client_method();
break;
+#endif
case STREAM_CRYPTO_METHOD_TLS_CLIENT:
sslsock->is_client = 1;
method = TLSv1_client_method();
@@ -351,9 +356,14 @@ static inline int php_openssl_setup_crypto(php_stream
method = SSLv23_server_method();
break;
case STREAM_CRYPTO_METHOD_SSLv3_SERVER:
+#ifdef OPENSSL_NO_SSL3
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library PHP is linked against");
+ return -1;
+#else
sslsock->is_client = 0;
method = SSLv3_server_method();
break;
+#endif
case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
#ifdef OPENSSL_NO_SSL2
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the OpenSSL library PHP is linked against");

0 comments on commit c909848

Please sign in to comment.