From 3ac2734f08547043e723b6f020fd0033d70db413 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 29 Oct 2018 15:19:57 +0000
Subject: [PATCH] main/libshout: rebuild against openssl-1.1

---
 ...shout-tls-compile-with-OpenSSL-1.1.0.patch | 58 +++++++++++++++++++
 main/libshout/APKBUILD                        | 11 ++--
 2 files changed, 65 insertions(+), 4 deletions(-)
 create mode 100644 main/libshout/01-libshout-tls-compile-with-OpenSSL-1.1.0.patch

diff --git a/main/libshout/01-libshout-tls-compile-with-OpenSSL-1.1.0.patch b/main/libshout/01-libshout-tls-compile-with-OpenSSL-1.1.0.patch
new file mode 100644
index 000000000000..befd16e38464
--- /dev/null
+++ b/main/libshout/01-libshout-tls-compile-with-OpenSSL-1.1.0.patch
@@ -0,0 +1,58 @@
+From 01fafc449f0de56743d08e7976933c49e2915bfa Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+Date: Wed, 15 Nov 2017 12:46:25 +0000
+Subject: [PATCH] tls: compile with OpenSSL 1.1.0
+
+The init functions are not longer required in OpenSSL 1.1 so I dropped
+them.
+
+TLSv1_client_method() should not be used because it enables only the
+TLSv1.0 protocol. Better is to use SSLv23_client_method() which enable
+all the protocols including TLSv1.2. With this functions SSLv2 and SSLv3
+is theoretically possible but as of today those protocols are usually
+build-time disabled.
+To avoid all this OpenSSL 1.1 provides TLS_client_method() which is aim
+to provide to highest TLS protocol version (same as
+SSLv23_client_method() but it is deprecated in 1.1).
+
+Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+---
+ src/tls.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/tls.c b/src/tls.c
+index 4562c7327077..e0e5c1a5f079 100644
+--- a/src/tls.c
++++ b/src/tls.c
+@@ -24,6 +24,7 @@
+ #endif
+ 
+ #include <shout/shout.h>
++#include <string.h>
+ #include "shout_private.h"
+ 
+ #ifndef XXX_HAVE_X509_check_host
+@@ -61,14 +62,17 @@ shout_tls_t *shout_tls_new(shout_t *self, sock_t socket)
+ 
+ static inline int tls_setup(shout_tls_t *tls)
+ {
+-	SSL_METHOD *meth;
+-
++	const SSL_METHOD *meth;
++#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
+ 	SSL_library_init();
+ 	SSL_load_error_strings();
+ 	SSLeay_add_all_algorithms();
+- 	SSLeay_add_ssl_algorithms();
++	SSLeay_add_ssl_algorithms();
+ 
+-	meth = TLSv1_client_method();
++	meth = SSLv23_client_method();
++#else
++	meth = TLS_client_method();
++#endif
+ 	if (!meth)
+ 		goto error;
+ 
+-- 
+2.15.0
diff --git a/main/libshout/APKBUILD b/main/libshout/APKBUILD
index b9c309308c2e..65c689e3236f 100644
--- a/main/libshout/APKBUILD
+++ b/main/libshout/APKBUILD
@@ -2,17 +2,19 @@
 # Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 pkgname=libshout
 pkgver=2.4.1
-pkgrel=4
+pkgrel=5
 pkgdesc="Library for accessing a shoutcast/icecast server"
 url="http://www.icecast.org/"
 arch="all"
 options="!check"  # No test suite.
 license="LGPL-2.1"
 depends=
-makedepends="speex-dev libtheora-dev libvorbis-dev libressl-dev"
+makedepends="speex-dev libtheora-dev libvorbis-dev openssl-dev"
 install=""
 subpackages="$pkgname-doc $pkgname-dev"
-source="http://downloads.xiph.org/releases/$pkgname/$pkgname-$pkgver.tar.gz"
+source="http://downloads.xiph.org/releases/$pkgname/$pkgname-$pkgver.tar.gz
+	01-libshout-tls-compile-with-OpenSSL-1.1.0.patch
+	"
 
 build() {
 	cd "$builddir"
@@ -31,4 +33,5 @@ package() {
 	make DESTDIR="$pkgdir" install
 }
 
-sha512sums="4d4b958947e020de3330d49d39d59220fc89315f25f653a7456b9aa24ca9566fca30bb3d65e6348e79958656096b6b864ea8885157d24e55c8d84d6604670219  libshout-2.4.1.tar.gz"
+sha512sums="4d4b958947e020de3330d49d39d59220fc89315f25f653a7456b9aa24ca9566fca30bb3d65e6348e79958656096b6b864ea8885157d24e55c8d84d6604670219  libshout-2.4.1.tar.gz
+af27d562fbf4f7be08317a97d69ae27d57618f4e6a5bc0131ce633b46a1a8f3cc24aa21ee12e427994d319e455afd8dbc3d061a6df6814958b9b787cfcb19ed8  01-libshout-tls-compile-with-OpenSSL-1.1.0.patch"
-- 
GitLab