Blob Blame History Raw
diff -up xmms2-0.8DrO_o/src/plugins/airplay/raop_client.c.openssl11 xmms2-0.8DrO_o/src/plugins/airplay/raop_client.c
--- xmms2-0.8DrO_o/src/plugins/airplay/raop_client.c.openssl11	2016-10-18 12:11:20.170416850 -0400
+++ xmms2-0.8DrO_o/src/plugins/airplay/raop_client.c	2016-10-18 12:18:19.315015550 -0400
@@ -31,6 +31,15 @@
 #define RAOP_RTSP_CONNECTED     0x40
 #define RAOP_RTSP_DONE          0x80
 
+/* Openssl 1.1.0 broke compatibility. We could depend on openssl 1.1.0, but
+ * it may take some time before distributions are able to upgrade to the new
+ * openssl version. To insulate ourselves from such transition problems, let's
+ * add a compatibility macro. 
+ */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define RSA_set0_key(r, n_, e_, d) (r->n = n_, r->e = e_, 1)
+#endif
+
 typedef enum audio_jack_status {
 	AUDIO_JACK_CONNECTED,
 	AUDIO_JACK_DISCONNECTED
@@ -110,6 +119,8 @@ static gint
 raop_rsa_encrypt (guchar *text, gint len, guchar *res)
 {
 	RSA *rsa;
+	BIGNUM *n_bn;
+	BIGNUM *e_bn;
 	size_t size;
 	static const guchar mod[] = {
 		0xe7,0xd7,0x44,0xf2,0xa2,0xe2,0x78,0x8b,0x6c,0x1f,0x55,0xa0,
@@ -137,8 +148,10 @@ raop_rsa_encrypt (guchar *text, gint len
 	static const guchar exp[] = {0x01, 0x00, 0x01};
 
 	rsa = RSA_new ();
-	rsa->n = BN_bin2bn (mod, 256, NULL);
-	rsa->e = BN_bin2bn (exp, 3, NULL);
+	n_bn = BN_bin2bn (mod, 256, NULL);
+	e_bn = BN_bin2bn (exp, 3, NULL);
+	/* TODO: Catch error here? */
+	RSA_set0_key(rsa, n_bn, e_bn, NULL);
 
 	size = RSA_public_encrypt (len, text, res, rsa, RSA_PKCS1_OAEP_PADDING);