comparison patches/0003-Add-possibility-to-fore-polarssl-ciphersuites.patch @ 998:0570b1e562c2

(issue90) Add curl patches for the problems we had with curl.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 01 Sep 2014 19:48:53 +0200
parents
children
comparison
equal deleted inserted replaced
997:405c97ca4ab0 998:0570b1e562c2
1 From 3dc7ab77759878778ae440a31304c736c1ef8cba Mon Sep 17 00:00:00 2001
2 From: Andre Heinecke <aheinecke@intevation.de>
3 Date: Mon, 1 Sep 2014 19:43:55 +0200
4 Subject: [PATCH 3/3] Add possibility to fore polarssl ciphersuites.
5
6 ---
7 lib/vtls/polarssl.c | 40 ++++++++++++++++++++++++++++++++++++++--
8 1 file changed, 38 insertions(+), 2 deletions(-)
9
10 diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
11 index 2c40e36..7e806bf 100644
12 --- a/lib/vtls/polarssl.c
13 +++ b/lib/vtls/polarssl.c
14 @@ -67,6 +67,8 @@
15 #define THREADING_SUPPORT
16 #endif
17
18 +#define MAX_CIPHERSUITES 255
19 +
20 #if defined(THREADING_SUPPORT)
21 static entropy_context entropy;
22
23 @@ -129,7 +131,7 @@ static void polarssl_debug(void *context, int level, const char *line)
24
25 static Curl_recv polarssl_recv;
26 static Curl_send polarssl_send;
27 -
28 +static int ciphersuites[MAX_CIPHERSUITES + 1];
29
30 static CURLcode
31 polarssl_connect_step1(struct connectdata *conn,
32 @@ -300,7 +302,41 @@ polarssl_connect_step1(struct connectdata *conn,
33 net_recv, &conn->sock[sockindex],
34 net_send, &conn->sock[sockindex]);
35
36 - ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
37 + if(!data->set.str[STRING_SSL_CIPHER_LIST])
38 + ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
39 + else {
40 + /* Convert string input to polarssl cipher id's */
41 + char *tmp,
42 + *token,
43 + *tok_buf;
44 +
45 + memset(ciphersuites, 0, MAX_CIPHERSUITES + 1);
46 +
47 + tmp = strdup (data->set.str[STRING_SSL_CIPHER_LIST]);
48 + if(!tmp)
49 + return CURLE_OUT_OF_MEMORY;
50 +
51 + i = 0;
52 + for (token = strtok_r(tmp, ":", &tok_buf);
53 + token != NULL;
54 + token = strtok_r(NULL, ":", &tok_buf)) {
55 +
56 + ciphersuites[i] = ssl_get_ciphersuite_id(token);
57 + if (!ciphersuites[i]) {
58 + infof(data, "WARNING: failed to set cipher: %s\n", token);
59 + /* Do not increase i as the first 0 is the end
60 + of the list so we overwrite it with the next
61 + valid cipher. Maybe we should fail? */
62 + continue;
63 + }
64 + i++;
65 + }
66 + free(tmp);
67 + /* Beware, polarssl does not make a copy of the ciphersuites
68 + so the data needs to be valid during the call. */
69 + ssl_set_ciphersuites(&connssl->ssl, ciphersuites);
70 + }
71 +
72 if(!Curl_ssl_getsessionid(conn, &old_session, &old_session_size)) {
73 memcpy(&connssl->ssn, old_session, old_session_size);
74 infof(data, "PolarSSL re-using session\n");
75 --
76 1.9.1
77

http://wald.intevation.org/projects/trustbridge/