---
 crm/cib/remote.c                 |    7 +++++++
 lib/mgmt/mgmt_tls_lib.c          |   12 ++++++++++++
 lib/plugins/quorum/quorumd.c     |    6 ++++++
 membership/quorumd/quorumdtest.c |    6 ++++++
 4 files changed, 31 insertions(+)

--- a/lib/plugins/quorum/quorumd.c
+++ b/lib/plugins/quorum/quorumd.c
@@ -327,11 +327,17 @@ initialize_tls_session (int sd)
 {
 	int ret;
 	gnutls_session session;
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	const int cert_type_priority[2] = { GNUTLS_CRT_X509,0};
+#endif
 	
 	gnutls_init (&session, GNUTLS_CLIENT);
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	gnutls_set_default_priority (session);
 	gnutls_certificate_type_set_priority (session, cert_type_priority);
+#else
+	gnutls_priority_set_direct (session, "NORMAL:+CTYPE-X509", NULL);
+#endif
 	gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
 	gnutls_transport_set_ptr (session, (gnutls_transport_ptr) GINT_TO_POINTER(sd));
 	ret = gnutls_handshake (session);
--- a/membership/quorumd/quorumdtest.c
+++ b/membership/quorumd/quorumdtest.c
@@ -136,11 +136,17 @@ initialize_tls_session (int sd)
 {
 	int ret;
 	gnutls_session session;
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	const int cert_type_priority[2] = { GNUTLS_CRT_X509,0};
+#endif
 	
 	gnutls_init (&session, GNUTLS_CLIENT);
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	gnutls_set_default_priority (session);
 	gnutls_certificate_type_set_priority (session, cert_type_priority);
+#else
+	gnutls_priority_set_direct (session, "NORMAL:+CTYPE-X509", NULL);
+#endif
 	gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
 	gnutls_transport_set_ptr (session, (gnutls_transport_ptr) GINT_TO_POINTER(sd));
 	ret = gnutls_handshake (session);
--- a/crm/cib/remote.c
+++ b/crm/cib/remote.c
@@ -45,6 +45,8 @@ void cib_send_remote_msg(void *session,
 
 #ifdef HAVE_GNUTLS_GNUTLS_H
 #  define DH_BITS 1024
+
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 const int tls_kx_order[] = {
 	  GNUTLS_KX_ANON_DH,
 	  GNUTLS_KX_DHE_RSA,
@@ -52,6 +54,7 @@ const int tls_kx_order[] = {
 	  GNUTLS_KX_RSA,
 	0
 };
+#endif
 gnutls_dh_params dh_params;
 gnutls_anon_server_credentials anon_cred;
 char *cib_send_tls(gnutls_session *session, HA_Message *msg);
@@ -83,8 +86,12 @@ create_tls_session(int csock)
 	session = (gnutls_session*)gnutls_malloc(sizeof(gnutls_session));
 
 	gnutls_init(session, GNUTLS_SERVER);
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	gnutls_set_default_priority(*session);
  	gnutls_kx_set_priority (*session, tls_kx_order);
+#else
+	gnutls_priority_set_direct(*session, "NORMAL:+ANON-DH", NULL);
+#endif
 	gnutls_credentials_set(*session, GNUTLS_CRD_ANON, anon_cred);
 	gnutls_transport_set_ptr(*session,
 				 (gnutls_transport_ptr) GINT_TO_POINTER(csock));
--- a/lib/mgmt/mgmt_tls_lib.c
+++ b/lib/mgmt/mgmt_tls_lib.c
@@ -38,11 +38,15 @@ static gnutls_dh_params dh_params;
 gnutls_anon_server_credentials anoncred_server;
 gnutls_anon_client_credentials anoncred_client;
 
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 const int kx_prio[] =
 {
 	GNUTLS_KX_ANON_DH,
 	0
 };
+#else
+const char anon_tls_prio[] = "NORMAL:+ANON-DH";
+#endif
 
 int
 tls_init_client(void)
@@ -58,8 +62,12 @@ tls_attach_client(int sock)
 	int ret;
 	gnutls_session* session = (gnutls_session*)gnutls_malloc(sizeof(gnutls_session));
 	gnutls_init(session, GNUTLS_CLIENT);
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	gnutls_set_default_priority(*session);
 	gnutls_kx_set_priority (*session, kx_prio);
+#else
+	gnutls_priority_set_direct(*session, anon_tls_prio, NULL);
+#endif
 	gnutls_credentials_set(*session, GNUTLS_CRD_ANON, anoncred_client);
 	gnutls_transport_set_ptr(*session, (gnutls_transport_ptr) GINT_TO_POINTER(sock));
 	ret = gnutls_handshake(*session);
@@ -131,8 +139,12 @@ tls_attach_server(int sock)
 	int ret;
 	gnutls_session* session = (gnutls_session*)gnutls_malloc(sizeof(gnutls_session));
 	gnutls_init(session, GNUTLS_SERVER);
+#if defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020200
 	gnutls_set_default_priority(*session);
 	gnutls_kx_set_priority (*session, kx_prio);
+#else
+	gnutls_priority_set_direct(*session, anon_tls_prio, NULL);
+#endif
 	gnutls_credentials_set(*session, GNUTLS_CRD_ANON, anoncred_server);
 	gnutls_dh_set_prime_bits(*session, DH_BITS);
 	gnutls_transport_set_ptr(*session, (gnutls_transport_ptr) GINT_TO_POINTER(sock));
