net-vpn/openvpn: fix compilation with libressl
authorJason A. Donenfeld <zx2c4@gentoo.org>
Mon, 16 Apr 2018 17:29:55 +0000 (19:29 +0200)
committerJason A. Donenfeld <zx2c4@gentoo.org>
Mon, 16 Apr 2018 17:30:20 +0000 (19:30 +0200)
Package-Manager: Portage-2.3.28, Repoman-2.3.9

net-vpn/openvpn/files/openvpn-2.4.5-libressl-macro-fix.patch [new file with mode: 0644]
net-vpn/openvpn/openvpn-2.4.5.ebuild

diff --git a/net-vpn/openvpn/files/openvpn-2.4.5-libressl-macro-fix.patch b/net-vpn/openvpn/files/openvpn-2.4.5-libressl-macro-fix.patch
new file mode 100644 (file)
index 0000000..13b9760
--- /dev/null
@@ -0,0 +1,63 @@
+diff --git a/configure.ac b/configure.ac
+index 626b4dd..2a8e87f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -948,6 +948,18 @@ if test "${with_crypto_library}" = "openssl"; then
+                       EC_GROUP_order_bits
+               ]
+       )
++      AC_CHECK_DECLS(
++              [
++                      SSL_CTX_get_min_proto_version,
++                      SSL_CTX_get_max_proto_version,
++                      SSL_CTX_set_min_proto_version,
++                      SSL_CTX_set_max_proto_version,
++              ],
++              ,
++              ,
++              [[#include <openssl/ssl.h>]]
++
++      )
+       CFLAGS="${saved_CFLAGS}"
+       LIBS="${saved_LIBS}"
+diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h
+index d375fab..340d452 100644
+--- a/src/openvpn/openssl_compat.h
++++ b/src/openvpn/openssl_compat.h
+@@ -661,7 +661,7 @@ EC_GROUP_order_bits(const EC_GROUP *group)
+ #define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT       RSA_F_RSA_EAY_PRIVATE_ENCRYPT
+ #endif
+-#ifndef SSL_CTX_get_min_proto_version
++#if !HAVE_DECL_SSL_CTX_GET_MIN_PROTO_VERSION
+ /** Return the min SSL protocol version currently enabled in the context.
+  *  If no valid version >= TLS1.0 is found, return 0. */
+ static inline int
+@@ -684,7 +684,7 @@ SSL_CTX_get_min_proto_version(SSL_CTX *ctx)
+ }
+ #endif /* SSL_CTX_get_min_proto_version */
+-#ifndef SSL_CTX_get_max_proto_version
++#if !HAVE_DECL_SSL_CTX_GET_MAX_PROTO_VERSION
+ /** Return the max SSL protocol version currently enabled in the context.
+  *  If no valid version >= TLS1.0 is found, return 0. */
+ static inline int
+@@ -707,7 +707,7 @@ SSL_CTX_get_max_proto_version(SSL_CTX *ctx)
+ }
+ #endif /* SSL_CTX_get_max_proto_version */
+-#ifndef SSL_CTX_set_min_proto_version
++#if !HAVE_DECL_SSL_CTX_SET_MIN_PROTO_VERSION
+ /** Mimics SSL_CTX_set_min_proto_version for OpenSSL < 1.1 */
+ static inline int
+ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min)
+@@ -736,7 +736,7 @@ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min)
+ }
+ #endif /* SSL_CTX_set_min_proto_version */
+-#ifndef SSL_CTX_set_max_proto_version
++#if !HAVE_DECL_SSL_CTX_SET_MAX_PROTO_VERSION
+ /** Mimics SSL_CTX_set_max_proto_version for OpenSSL < 1.1 */
+ static inline int
+ SSL_CTX_set_max_proto_version(SSL_CTX *ctx, long tls_ver_max)
index 7143fb14c09831e0ad6c387e95f7cabcc8539f46..d93cd5da7e514eb194ef63058c9db3e765027e2a 100644 (file)
@@ -49,6 +49,7 @@ CONFIG_CHECK="~TUN"
 
 PATCHES=(
        "${FILESDIR}/${PN}-external-cmocka.patch"
+       "${FILESDIR}/${P}-libressl-macro-fix.patch"
 )
 
 pkg_setup()  {