control: tags -1 patch

On 2016-06-26 12:24:53 [+0200], Kurt Roeckx wrote:
> OpenSSL 1.1.0 is about to released.  During a rebuild of all packages using
> OpenSSL this package fail to build.  A log of that build can be found at:
> https://breakpoint.cc/openssl-1.1-rebuild-2016-05-29/Attempted/xmms2_0.8+dfsg-16_amd64-20160529-1557

builds.

> Kurt

Sebastian
>From e5d09947146fda8ad2829c5e77462824161e832e Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
Date: Tue, 30 Aug 2016 19:01:11 +0000
Subject: [PATCH] plugins/ariplay: build against openssl 1.1.0

Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc>
---
 src/plugins/airplay/raop_client.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/plugins/airplay/raop_client.c b/src/plugins/airplay/raop_client.c
index 17097e0..5310f6f 100644
--- a/src/plugins/airplay/raop_client.c
+++ b/src/plugins/airplay/raop_client.c
@@ -135,15 +135,34 @@ raop_rsa_encrypt (guchar *text, gint len, guchar *res)
 		0x5e,0xf,0xc8,0x75,0x34,0x3e,0xc7,0x82,0x11,0x76,0x25,0xcd
 		,0xbf,0x98,0x44,0x7b};
 	static const guchar exp[] = {0x01, 0x00, 0x01};
+	BIGNUM *n, *e;
 
 	rsa = RSA_new ();
-	rsa->n = BN_bin2bn (mod, 256, NULL);
-	rsa->e = BN_bin2bn (exp, 3, NULL);
+	n = BN_bin2bn (mod, 256, NULL);
+	e = BN_bin2bn (exp, 3, NULL);
+	if (!rsa || !n || !e)
+		goto err;
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+	rsa->n = n;
+	rsa->e = e;
+#else
+	if (!RSA_set0_key(rsa, n, e, NULL))
+		goto err;
+#endif
 
 	size = RSA_public_encrypt (len, text, res, rsa, RSA_PKCS1_OAEP_PADDING);
 
 	RSA_free (rsa);
 	return size;
+err:
+	if (rsa)
+		RSA_free(rsa);
+	if (n)
+		BN_free(n);
+	if (e)
+		BN_free(e);
+	return 0;
 }
 
 static void
@@ -250,6 +269,8 @@ raop_rtsp_announce (raop_client_t *rc)
 	gint ret = RAOP_EOK;
 
 	size = raop_rsa_encrypt (rc->aes_key_str, 16, enc_aes_key);
+	if (size == 0)
+		return RAOP_EFAIL;
 
 	size = b64_encode_alloc (enc_aes_key, size, &key);
 	g_strdelimit (key, "=", '\0');
-- 
2.9.3

Reply via email to