iksemel: fixes and cleanups
[feed/telephony.git] / libs / iksemel / patches / 002-secure_gnutls_options.patch
1 Last-Update: 2015-10-28
2 Bug-Upstream: https://github.com/meduketto/iksemel/issues/48
3 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803204
4 From: Marc Dequènes (duck) <duck@duckcorp.org>
5 Description: fix security problem (and compatibility problem with servers rejecting low grade ciphers).
6
7 --- a/src/stream.c
8 +++ b/src/stream.c
9 @@ -62,13 +62,9 @@
10
11 static int
12 handshake (struct stream_data *data)
13 {
14 - const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
15 - const int kx_priority[] = { GNUTLS_KX_RSA, 0 };
16 - const int cipher_priority[] = { GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR, 0};
17 - const int comp_priority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
18 - const int mac_priority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
19 + const char *priority_string = "SECURE256:+SECURE192:-VERS-TLS-ALL:+VERS-TLS1.2";
20 int ret;
21
22 if (gnutls_global_init () != 0)
23 return IKS_NOMEM;
24 @@ -79,13 +75,9 @@
25 if (gnutls_init (&data->sess, GNUTLS_CLIENT) != 0) {
26 gnutls_certificate_free_credentials (data->cred);
27 return IKS_NOMEM;
28 }
29 - gnutls_protocol_set_priority (data->sess, protocol_priority);
30 - gnutls_cipher_set_priority(data->sess, cipher_priority);
31 - gnutls_compression_set_priority(data->sess, comp_priority);
32 - gnutls_kx_set_priority(data->sess, kx_priority);
33 - gnutls_mac_set_priority(data->sess, mac_priority);
34 + gnutls_priority_set_direct(data->sess, priority_string, NULL);
35 gnutls_credentials_set (data->sess, GNUTLS_CRD_CERTIFICATE, data->cred);
36
37 gnutls_transport_set_push_function (data->sess, (gnutls_push_func) tls_push);
38 gnutls_transport_set_pull_function (data->sess, (gnutls_pull_func) tls_pull);