www-client/elinks-0.12_pre6-r2: fix compilation with libressl.
authorFelix Janda <felix.janda@posteo.de>
Sat, 14 Oct 2017 13:43:32 +0000 (09:43 -0400)
committerPatrice Clement <monsieurp@gentoo.org>
Sun, 22 Oct 2017 16:55:09 +0000 (18:55 +0200)
Closes: https://bugs.gentoo.org/584766
Closes: https://bugs.gentoo.org/609006

www-client/elinks/elinks-0.12_pre6-r2.ebuild
www-client/elinks/files/elinks-0.12_pre5-libressl.patch [new file with mode: 0644]
www-client/elinks/files/elinks-0.12_pre5-rand-egd.patch [new file with mode: 0644]

index ed3f69831bd01b6ee926e79da88301d5bbd1625d..e9e8625888a0bac896b3533f3444bcac55303dff 100644 (file)
@@ -56,6 +56,8 @@ src_prepare() {
 
        epatch "${FILESDIR}"/${PN}-9999-parallel-make.patch
        epatch "${FILESDIR}"/${PN}-0.12_pre5-compilation-fix.patch
+       epatch "${FILESDIR}"/${PN}-0.12_pre5-libressl.patch
+       epatch "${FILESDIR}"/${PN}-0.12_pre5-rand-egd.patch
 
        if use javascript ; then
                if has_version ">=dev-lang/spidermonkey-1.8"; then
diff --git a/www-client/elinks/files/elinks-0.12_pre5-libressl.patch b/www-client/elinks/files/elinks-0.12_pre5-libressl.patch
new file mode 100644 (file)
index 0000000..d41ab68
--- /dev/null
@@ -0,0 +1,29 @@
+Adapted from upstream
+commit 54ebe365b752f8969a67279d0d29552ab638e025
+Author: Witold Filipczyk <witekfl@poczta.onet.pl>
+Date:   Mon Mar 6 17:39:36 2017 +0100
+
+    Compilation fix for OpenSSL-1.1
+
+--- a/src/network/ssl/socket.c
++++ b/src/network/ssl/socket.c
+@@ -67,7 +67,9 @@
+ ssl_set_no_tls(struct socket *socket)
+ {
+ #ifdef CONFIG_OPENSSL
+-      ((ssl_t *) socket->ssl)->options |= SSL_OP_NO_TLSv1;
++#ifdef SSL_OP_NO_TLSv1
++      SSL_set_options((ssl_t *)socket->ssl, SSL_OP_NO_TLSv1);
++#endif
+ #elif defined(CONFIG_GNUTLS)
+       {
+               /* GnuTLS does not support SSLv2 because it is "insecure".
+@@ -145,7 +147,7 @@
+               }
+               if (client_cert) {
+-                      SSL_CTX *ctx = ((SSL *) socket->ssl)->ctx;
++                      SSL_CTX *ctx = SSL_get_SSL_CTX((SSL *) socket->ssl);
+                       SSL_CTX_use_certificate_chain_file(ctx, client_cert);
+                       SSL_CTX_use_PrivateKey_file(ctx, client_cert,
diff --git a/www-client/elinks/files/elinks-0.12_pre5-rand-egd.patch b/www-client/elinks/files/elinks-0.12_pre5-rand-egd.patch
new file mode 100644 (file)
index 0000000..6c5679a
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/network/ssl/ssl.c
++++ b/src/network/ssl/ssl.c
+@@ -84,11 +84,16 @@ init_openssl(struct module *module)
+        * cannot initialize the PRNG and so every attempt to use SSL fails.
+        * It's actually an OpenSSL FAQ, and according to them, it's up to the
+        * application coders to seed the RNG. -- William Yodlowsky */
+-      if (RAND_egd(RAND_file_name(f_randfile, sizeof(f_randfile))) < 0) {
++      RAND_file_name(f_randfile, sizeof(f_randfile));
++#ifdef HAVE_RAND_EGD
++      if (RAND_egd(f_randfile) < 0) {
+               /* Not an EGD, so read and write to it */
++#endif
+               if (RAND_load_file(f_randfile, -1))
+                       RAND_write_file(f_randfile);
++#ifdef HAVE_RAND_EGD
+       }
++#endif
+       SSLeay_add_ssl_algorithms();
+       context = SSL_CTX_new(SSLv23_client_method());