Line 0
Link Here
|
|
|
1 |
--- src/ssl.c.orig |
2 |
+++ src/ssl.c |
3 |
@@ -29,10 +29,7 @@ |
4 |
|
5 |
#include <gnutls/gnutls.h> |
6 |
#include <gnutls/x509.h> |
7 |
-#include <gcrypt.h> |
8 |
#ifdef ENABLE_SMP |
9 |
-GCRY_THREAD_OPTION_PTHREAD_IMPL; |
10 |
- |
11 |
pthread_mutex_t ssl_session_cache_lock = PTHREAD_MUTEX_INITIALIZER; |
12 |
#endif |
13 |
|
14 |
@@ -51,12 +48,12 @@ |
15 |
*/ |
16 |
|
17 |
static void wrap_db_init(void); |
18 |
-static int wrap_db_store(void *dbf, gnutls_datum key, gnutls_datum data); |
19 |
-static gnutls_datum wrap_db_fetch(void *dbf, gnutls_datum key); |
20 |
-static int wrap_db_delete(void *dbf, gnutls_datum key); |
21 |
+static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data); |
22 |
+static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key); |
23 |
+static int wrap_db_delete(void *dbf, gnutls_datum_t key); |
24 |
|
25 |
static int cur = 0; /* points to the credentials structure used */ |
26 |
-static gnutls_certificate_credentials credentials[2] = { NULL, NULL }; |
27 |
+static gnutls_certificate_credentials_t credentials[2] = { NULL, NULL }; |
28 |
|
29 |
static int need_dh_params = 0; /* whether we need to generate DHE |
30 |
* parameters. Depend on the chosen ciphersuites. |
31 |
@@ -69,10 +66,10 @@ |
32 |
*/ |
33 |
extern int ssl_dh_bits; |
34 |
|
35 |
-gnutls_dh_params _dh_params[2]; |
36 |
-gnutls_rsa_params _rsa_params[2]; |
37 |
+gnutls_dh_params_t _dh_params[2]; |
38 |
+gnutls_rsa_params_t _rsa_params[2]; |
39 |
|
40 |
-static int generate_dh_primes( gnutls_dh_params* dh_params) |
41 |
+static int generate_dh_primes( gnutls_dh_params_t* dh_params) |
42 |
{ |
43 |
if (gnutls_dh_params_init( dh_params) < 0) { |
44 |
log_error_time(); |
45 |
@@ -101,7 +98,7 @@ |
46 |
return 0; |
47 |
} |
48 |
|
49 |
-static int generate_rsa_params( gnutls_rsa_params* rsa_params) |
50 |
+static int generate_rsa_params( gnutls_rsa_params_t* rsa_params) |
51 |
{ |
52 |
if (gnutls_rsa_params_init( rsa_params) < 0) { |
53 |
log_error_time(); |
54 |
@@ -165,9 +162,9 @@ |
55 |
/* Initializes a single SSL/TLS session. That is set the algorithm, |
56 |
* the db backend, whether to request certificates etc. |
57 |
*/ |
58 |
-gnutls_session initialize_ssl_session(void) |
59 |
+gnutls_session_t initialize_ssl_session(void) |
60 |
{ |
61 |
- gnutls_session state; |
62 |
+ gnutls_session_t state; |
63 |
|
64 |
gnutls_init(&state, GNUTLS_SERVER); |
65 |
|
66 |
@@ -215,9 +212,6 @@ |
67 |
|
68 |
log_error_time(); |
69 |
fprintf(stderr, "tls: Initializing GnuTLS/%s.\n", gnutls_check_version(NULL)); |
70 |
-#ifdef ENABLE_SMP |
71 |
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); |
72 |
-#endif |
73 |
gnutls_global_init(); |
74 |
|
75 |
if (gnutls_certificate_allocate_credentials( &credentials[0]) < 0) { |
76 |
@@ -294,8 +288,6 @@ |
77 |
comp_priority[i++] = GNUTLS_COMP_NULL; |
78 |
if ( parse_cs_string( ssl_comp, "ZLIB") != 0) |
79 |
comp_priority[i++] = GNUTLS_COMP_ZLIB; |
80 |
- if ( parse_cs_string( ssl_comp, "LZO") != 0) |
81 |
- comp_priority[i++] = GNUTLS_COMP_LZO; |
82 |
comp_priority[i] = 0; |
83 |
|
84 |
/* Add protocols |
85 |
@@ -416,7 +408,7 @@ |
86 |
cache_db = calloc(1, ssl_session_cache * sizeof(CACHE)); |
87 |
} |
88 |
|
89 |
-static int wrap_db_store(void *dbf, gnutls_datum key, gnutls_datum data) |
90 |
+static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data) |
91 |
{ |
92 |
|
93 |
if (cache_db == NULL) |
94 |
@@ -447,9 +439,9 @@ |
95 |
return 0; |
96 |
} |
97 |
|
98 |
-static gnutls_datum wrap_db_fetch(void *dbf, gnutls_datum key) |
99 |
+static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key) |
100 |
{ |
101 |
- gnutls_datum res = { NULL, 0 }; |
102 |
+ gnutls_datum_t res = { NULL, 0 }; |
103 |
int i; |
104 |
|
105 |
if (cache_db == NULL) |
106 |
@@ -489,7 +481,7 @@ |
107 |
return res; |
108 |
} |
109 |
|
110 |
-static int wrap_db_delete(void *dbf, gnutls_datum key) |
111 |
+static int wrap_db_delete(void *dbf, gnutls_datum_t key) |
112 |
{ |
113 |
int i; |
114 |
|
115 |
@@ -567,11 +559,11 @@ |
116 |
|
117 |
if (ssl_verify >= 1) { |
118 |
size_t size; |
119 |
- int verify, ret, valid; |
120 |
+ int ret, valid; |
121 |
char name[128]; |
122 |
- const gnutls_datum *cert_list; |
123 |
- int cert_list_size; |
124 |
- gnutls_x509_crt crt = NULL; |
125 |
+ const gnutls_datum_t *cert_list; |
126 |
+ unsigned int cert_list_size, verify; |
127 |
+ gnutls_x509_crt_t crt = NULL; |
128 |
|
129 |
ret = gnutls_x509_crt_init( &crt); |
130 |
if (ret < 0) { |
131 |
@@ -601,7 +593,7 @@ |
132 |
} |
133 |
|
134 |
|
135 |
- verify = gnutls_certificate_verify_peers( current->ssl_state); |
136 |
+ gnutls_certificate_verify_peers2( current->ssl_state, &verify); |
137 |
current->certificate_verified = "NONE"; |
138 |
|
139 |
if (cert_list == NULL) { |
140 |
@@ -737,8 +729,6 @@ |
141 |
comp_priority[i++] = GNUTLS_COMP_NULL; |
142 |
if ( parse_cs_string( ssl_comp, "ZLIB") != 0) |
143 |
comp_priority[i++] = GNUTLS_COMP_ZLIB; |
144 |
- if ( parse_cs_string( ssl_comp, "LZO") != 0) |
145 |
- comp_priority[i++] = GNUTLS_COMP_LZO; |
146 |
comp_priority[i] = 0; |
147 |
|
148 |
/* Add protocols |