View | Details | Raw Unified | Return to bug 214999
Collapse All | Expand All

(-)audio/pulseaudio/files/patch-src_modules_raop_raop_client.c (-1 / +44 lines)
Added Link Here
0
- 
1
diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
2
index 3b6c36e..864c558 100644
3
--- src/modules/raop/raop_client.c.orig
4
+++ src/modules/raop/raop_client.c
5
@@ -68,6 +68,21 @@
6
 
7
 #define RAOP_PORT 5000
8
 
9
+/* Openssl 1.1.0 broke compatibility. Before 1.1.0 we had to set RSA->n and
10
+ * RSA->e manually, but after 1.1.0 the RSA struct is opaque and we have to use
11
+ * RSA_set0_key(). RSA_set0_key() is a new function added in 1.1.0. We could
12
+ * depend on openssl 1.1.0, but it may take some time before distributions will
13
+ * be able to upgrade to the new openssl version. To insulate ourselves from
14
+ * such transition problems, let's implement RSA_set0_key() ourselves if it's
15
+ * not available. */
16
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
17
+static int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) {
18
+    r->n = n;
19
+    r->e = e;
20
+    return 1;
21
+}
22
+#endif
23
+
24
 struct pa_raop_client {
25
     pa_core *core;
26
     char *host;
27
@@ -161,12 +176,15 @@ static int rsa_encrypt(uint8_t *text, int len, uint8_t *res) {
28
     uint8_t exponent[8];
29
     int size;
30
     RSA *rsa;
31
+    BIGNUM *n_bn;
32
+    BIGNUM *e_bn;
33
 
34
     rsa = RSA_new();
35
     size = pa_base64_decode(n, modules);
36
-    rsa->n = BN_bin2bn(modules, size, NULL);
37
+    n_bn = BN_bin2bn(modules, size, NULL);
38
     size = pa_base64_decode(e, exponent);
39
-    rsa->e = BN_bin2bn(exponent, size, NULL);
40
+    e_bn = BN_bin2bn(exponent, size, NULL);
41
+    RSA_set0_key(rsa, n_bn, e_bn, NULL);
42
 
43
     size = RSA_public_encrypt(len, text, res, rsa, RSA_PKCS1_OAEP_PADDING);
44
     RSA_free(rsa);

Return to bug 214999