From 7136a908a056d0e36c89b6e1c39adff8ce2bb1d4 Mon Sep 17 00:00:00 2001
From: Andre McCurdy <armccurdy@gmail.com>
Date: Wed, 1 Nov 2017 13:17:34 -0700
Subject: [PATCH] avoid obsolete gnutls apis

The gnutls_*_set_priority() family of functions was marked deprecated
in gnutls 2.12.x and removed completely in 3.5.x. These functions
have been superceded by gnutls_priority_set_direct(), which was added
in gnutls 2.2.0 (released 2007-12-14).

Rather than simply update the custom gnutls_*_set_priority() calls to
use gnutls_priority_set_direct(), drop the custom priority selection
completely and use the recommended approach of letting gnutls pick a
reasonable set of defaults.

Upstream-Status: Pending

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
---
 src/tls-gnutls.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/tls-gnutls.c b/src/tls-gnutls.c
index d7b7c91..749e9ef 100644
--- a/src/tls-gnutls.c
+++ b/src/tls-gnutls.c
@@ -48,11 +48,6 @@ tls_pull (struct ikstls_data *data, char *buffer, size_t len)
 static int
 tls_handshake (struct ikstls_data **datap, ikstransport *trans, void *sock)
 {
-	const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
-	const int kx_priority[] = { GNUTLS_KX_RSA, 0 };
-	const int cipher_priority[] = { GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0};
-	const int comp_priority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
-	const int mac_priority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
 	struct ikstls_data *data;
 	int ret;
 
@@ -81,11 +76,8 @@ tls_handshake (struct ikstls_data **datap, ikstransport *trans, void *sock)
 		return IKS_NOMEM;
 	}
 
-	gnutls_protocol_set_priority (data->sess, protocol_priority);
-	gnutls_cipher_set_priority(data->sess, cipher_priority);
-	gnutls_compression_set_priority(data->sess, comp_priority);
-	gnutls_kx_set_priority(data->sess, kx_priority);
-	gnutls_mac_set_priority(data->sess, mac_priority);
+	gnutls_set_default_priority (data->sess);
+
 	gnutls_credentials_set (data->sess, GNUTLS_CRD_CERTIFICATE, data->cred);
 
 	gnutls_transport_set_push_function (data->sess, (gnutls_push_func) tls_push);
-- 
1.9.1

