diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-11-16 07:34:53 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-11-16 07:34:53 +0000 |
commit | acb3ed7e80ff0c6a8dd3b5dde7c09334302fb664 (patch) | |
tree | 483dec2a357a54978dc86d5849fc960a9ce41a31 | |
parent | 9ff6d494fa12d1d68ffe8670c31d1e27009bc71a (diff) | |
download | libmicrohttpd-acb3ed7e80ff0c6a8dd3b5dde7c09334302fb664.tar.gz libmicrohttpd-acb3ed7e80ff0c6a8dd3b5dde7c09334302fb664.zip |
making tests compile
-rw-r--r-- | src/testcurl/https/tls_alert_test.c | 66 | ||||
-rw-r--r-- | src/testcurl/https/tls_cipher_change_test.c | 72 | ||||
-rw-r--r-- | src/testcurl/https/tls_session_time_out_test.c | 54 |
3 files changed, 97 insertions, 95 deletions
diff --git a/src/testcurl/https/tls_alert_test.c b/src/testcurl/https/tls_alert_test.c index 34ab883f..238150e6 100644 --- a/src/testcurl/https/tls_alert_test.c +++ b/src/testcurl/https/tls_alert_test.c | |||
@@ -57,45 +57,45 @@ http_ahc (void *cls, struct MHD_Connection *connection, | |||
57 | } | 57 | } |
58 | 58 | ||
59 | static int | 59 | static int |
60 | setup (mhd_gtls_session_t * session, | 60 | setup (MHD_gtls_session_t * session, |
61 | gnutls_datum_t * key, | 61 | MHD_gnutls_datum_t * key, |
62 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t * xcred) | 62 | MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t * xcred) |
63 | { | 63 | { |
64 | int ret; | 64 | int ret; |
65 | const char **err_pos; | 65 | const char **err_pos; |
66 | 66 | ||
67 | MHD_gnutls_certificate_allocate_credentials (xcred); | 67 | MHD__gnutls_certificate_allocate_credentials (xcred); |
68 | 68 | ||
69 | mhd_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); | 69 | MHD_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); |
70 | mhd_gtls_set_datum_m (cert, srv_self_signed_cert_pem, | 70 | MHD_gtls_set_datum_m (cert, srv_self_signed_cert_pem, |
71 | strlen (srv_self_signed_cert_pem), &malloc); | 71 | strlen (srv_self_signed_cert_pem), &malloc); |
72 | 72 | ||
73 | MHD_gnutls_certificate_set_x509_key_mem (*xcred, cert, key, | 73 | MHD__gnutls_certificate_set_x509_key_mem (*xcred, cert, key, |
74 | GNUTLS_X509_FMT_PEM); | 74 | GNUTLS_X509_FMT_PEM); |
75 | 75 | ||
76 | MHD_gnutls_init (session, GNUTLS_CLIENT); | 76 | MHD__gnutls_init (session, GNUTLS_CLIENT); |
77 | ret = MHD_gnutls_priority_set_direct (*session, "NORMAL", err_pos); | 77 | ret = MHD__gnutls_priority_set_direct (*session, "NORMAL", err_pos); |
78 | if (ret < 0) | 78 | if (ret < 0) |
79 | { | 79 | { |
80 | return -1; | 80 | return -1; |
81 | } | 81 | } |
82 | 82 | ||
83 | MHD_gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 83 | MHD__gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | 86 | ||
87 | static int | 87 | static int |
88 | teardown (mhd_gtls_session_t session, | 88 | teardown (MHD_gtls_session_t session, |
89 | gnutls_datum_t * key, | 89 | MHD_gnutls_datum_t * key, |
90 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t xcred) | 90 | MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t xcred) |
91 | { | 91 | { |
92 | 92 | ||
93 | mhd_gtls_free_datum_m (key, free); | 93 | MHD_gtls_free_datum_m (key, free); |
94 | mhd_gtls_free_datum_m (cert, free); | 94 | MHD_gtls_free_datum_m (cert, free); |
95 | 95 | ||
96 | MHD_gnutls_deinit (session); | 96 | MHD__gnutls_deinit (session); |
97 | 97 | ||
98 | MHD_gnutls_certificate_free_credentials (xcred); | 98 | MHD__gnutls_certificate_free_credentials (xcred); |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
@@ -106,7 +106,7 @@ teardown (mhd_gtls_session_t session, | |||
106 | * @param session: an initialized TLS session | 106 | * @param session: an initialized TLS session |
107 | */ | 107 | */ |
108 | static int | 108 | static int |
109 | test_alert_close_notify (mhd_gtls_session_t session) | 109 | test_alert_close_notify (MHD_gtls_session_t session) |
110 | { | 110 | { |
111 | int sd, ret; | 111 | int sd, ret; |
112 | struct sockaddr_in sa; | 112 | struct sockaddr_in sa; |
@@ -117,7 +117,7 @@ test_alert_close_notify (mhd_gtls_session_t session) | |||
117 | sa.sin_port = htons (42433); | 117 | sa.sin_port = htons (42433); |
118 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); | 118 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); |
119 | 119 | ||
120 | MHD_gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); | 120 | MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) sd); |
121 | 121 | ||
122 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); | 122 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); |
123 | 123 | ||
@@ -127,16 +127,16 @@ test_alert_close_notify (mhd_gtls_session_t session) | |||
127 | return -1; | 127 | return -1; |
128 | } | 128 | } |
129 | 129 | ||
130 | ret = MHD_gnutls_handshake (session); | 130 | ret = MHD__gnutls_handshake (session); |
131 | if (ret < 0) | 131 | if (ret < 0) |
132 | { | 132 | { |
133 | return -1; | 133 | return -1; |
134 | } | 134 | } |
135 | 135 | ||
136 | MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, GNUTLS_A_CLOSE_NOTIFY); | 136 | MHD__gnutls_alert_send (session, GNUTLS_AL_FATAL, GNUTLS_A_CLOSE_NOTIFY); |
137 | 137 | ||
138 | /* check server responds with a 'close-notify' */ | 138 | /* check server responds with a 'close-notify' */ |
139 | mhd_gtls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0); | 139 | MHD_gtls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0); |
140 | 140 | ||
141 | close (sd); | 141 | close (sd); |
142 | /* CLOSE_NOTIFY */ | 142 | /* CLOSE_NOTIFY */ |
@@ -155,7 +155,7 @@ test_alert_close_notify (mhd_gtls_session_t session) | |||
155 | * @param session: an initialized TLS session | 155 | * @param session: an initialized TLS session |
156 | */ | 156 | */ |
157 | static int | 157 | static int |
158 | test_alert_unexpected_message (mhd_gtls_session_t session) | 158 | test_alert_unexpected_message (MHD_gtls_session_t session) |
159 | { | 159 | { |
160 | int sd, ret; | 160 | int sd, ret; |
161 | struct sockaddr_in sa; | 161 | struct sockaddr_in sa; |
@@ -166,8 +166,8 @@ test_alert_unexpected_message (mhd_gtls_session_t session) | |||
166 | sa.sin_port = htons (42433); | 166 | sa.sin_port = htons (42433); |
167 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); | 167 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); |
168 | 168 | ||
169 | MHD_gnutls_transport_set_ptr (session, | 169 | MHD__gnutls_transport_set_ptr (session, |
170 | (gnutls_transport_ptr_t) ((void *) sd)); | 170 | (MHD_gnutls_transport_ptr_t) ((void *) sd)); |
171 | 171 | ||
172 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); | 172 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); |
173 | 173 | ||
@@ -177,13 +177,13 @@ test_alert_unexpected_message (mhd_gtls_session_t session) | |||
177 | return -1; | 177 | return -1; |
178 | } | 178 | } |
179 | 179 | ||
180 | ret = MHD_gnutls_handshake (session); | 180 | ret = MHD__gnutls_handshake (session); |
181 | if (ret < 0) | 181 | if (ret < 0) |
182 | { | 182 | { |
183 | return -1; | 183 | return -1; |
184 | } | 184 | } |
185 | 185 | ||
186 | MHD_gnutls_alert_send (session, GNUTLS_AL_FATAL, | 186 | MHD__gnutls_alert_send (session, GNUTLS_AL_FATAL, |
187 | GNUTLS_A_UNEXPECTED_MESSAGE); | 187 | GNUTLS_A_UNEXPECTED_MESSAGE); |
188 | usleep (100); | 188 | usleep (100); |
189 | 189 | ||
@@ -202,12 +202,12 @@ main (int argc, char *const *argv) | |||
202 | { | 202 | { |
203 | int errorCount = 0;; | 203 | int errorCount = 0;; |
204 | struct MHD_Daemon *d; | 204 | struct MHD_Daemon *d; |
205 | mhd_gtls_session_t session; | 205 | MHD_gtls_session_t session; |
206 | gnutls_datum_t key; | 206 | MHD_gnutls_datum_t key; |
207 | gnutls_datum_t cert; | 207 | MHD_gnutls_datum_t cert; |
208 | mhd_gtls_cert_credentials_t xcred; | 208 | MHD_gtls_cert_credentials_t xcred; |
209 | 209 | ||
210 | MHD_gnutls_global_init (); | 210 | MHD__gnutls_global_init (); |
211 | MHD_gtls_global_set_log_level (11); | 211 | MHD_gtls_global_set_log_level (11); |
212 | 212 | ||
213 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | | 213 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | |
@@ -235,7 +235,7 @@ main (int argc, char *const *argv) | |||
235 | fprintf (stderr, "Failed test: %s.\n", argv[0]); | 235 | fprintf (stderr, "Failed test: %s.\n", argv[0]); |
236 | 236 | ||
237 | MHD_stop_daemon (d); | 237 | MHD_stop_daemon (d); |
238 | MHD_gnutls_global_deinit (); | 238 | MHD__gnutls_global_deinit (); |
239 | 239 | ||
240 | return errorCount != 0; | 240 | return errorCount != 0; |
241 | } | 241 | } |
diff --git a/src/testcurl/https/tls_cipher_change_test.c b/src/testcurl/https/tls_cipher_change_test.c index cbd832e4..78881a62 100644 --- a/src/testcurl/https/tls_cipher_change_test.c +++ b/src/testcurl/https/tls_cipher_change_test.c | |||
@@ -47,7 +47,7 @@ rehandshake_ahc (void *cls, struct MHD_Connection *connection, | |||
47 | { | 47 | { |
48 | int ret; | 48 | int ret; |
49 | /* server side re-handshake request */ | 49 | /* server side re-handshake request */ |
50 | ret = MHD_gnutls_rehandshake (connection->tls_session); | 50 | ret = MHD__gnutls_rehandshake (connection->tls_session); |
51 | 51 | ||
52 | if (ret < 0) | 52 | if (ret < 0) |
53 | { | 53 | { |
@@ -59,45 +59,46 @@ rehandshake_ahc (void *cls, struct MHD_Connection *connection, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | static int | 61 | static int |
62 | setup (mhd_gtls_session_t * session, | 62 | setup (MHD_gtls_session_t * session, |
63 | gnutls_datum_t * key, | 63 | MHD_gnutls_datum_t * key, |
64 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t * xcred) | 64 | MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t * xcred) |
65 | { | 65 | { |
66 | int ret; | 66 | int ret; |
67 | const char **err_pos; | 67 | const char **err_pos; |
68 | 68 | ||
69 | MHD_gnutls_certificate_allocate_credentials (xcred); | 69 | MHD__gnutls_certificate_allocate_credentials (xcred); |
70 | 70 | ||
71 | mhd_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); | 71 | MHD_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); |
72 | mhd_gtls_set_datum_m (cert, srv_self_signed_cert_pem, | 72 | MHD_gtls_set_datum_m (cert, srv_self_signed_cert_pem, |
73 | strlen (srv_self_signed_cert_pem), &malloc); | 73 | strlen (srv_self_signed_cert_pem), &malloc); |
74 | 74 | ||
75 | MHD_gnutls_certificate_set_x509_key_mem (*xcred, cert, key, | 75 | MHD__gnutls_certificate_set_x509_key_mem (*xcred, cert, key, |
76 | GNUTLS_X509_FMT_PEM); | 76 | GNUTLS_X509_FMT_PEM); |
77 | 77 | ||
78 | MHD_gnutls_init (session, GNUTLS_CLIENT); | 78 | MHD__gnutls_init (session, GNUTLS_CLIENT); |
79 | ret = MHD_gnutls_priority_set_direct (*session, "NORMAL", err_pos); | 79 | ret = MHD__gnutls_priority_set_direct (*session, "NORMAL", err_pos); |
80 | if (ret < 0) | 80 | if (ret < 0) |
81 | { | 81 | { |
82 | return -1; | 82 | return -1; |
83 | } | 83 | } |
84 | 84 | ||
85 | MHD_gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 85 | MHD__gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static int | 89 | static int |
90 | teardown (mhd_gtls_session_t session, | 90 | teardown (MHD_gtls_session_t session, |
91 | gnutls_datum_t * key, | 91 | MHD_gnutls_datum_t * key, |
92 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t xcred) | 92 | MHD_gnutls_datum_t * cert, |
93 | MHD_gtls_cert_credentials_t xcred) | ||
93 | { | 94 | { |
94 | 95 | ||
95 | mhd_gtls_free_datum_m (key, free); | 96 | MHD_gtls_free_datum_m (key, free); |
96 | mhd_gtls_free_datum_m (cert, free); | 97 | MHD_gtls_free_datum_m (cert, free); |
97 | 98 | ||
98 | MHD_gnutls_deinit (session); | 99 | MHD__gnutls_deinit (session); |
99 | 100 | ||
100 | MHD_gnutls_certificate_free_credentials (xcred); | 101 | MHD__gnutls_certificate_free_credentials (xcred); |
101 | return 0; | 102 | return 0; |
102 | } | 103 | } |
103 | 104 | ||
@@ -110,7 +111,7 @@ teardown (mhd_gtls_session_t session, | |||
110 | * @param session: initiallized TLS session | 111 | * @param session: initiallized TLS session |
111 | */ | 112 | */ |
112 | static int | 113 | static int |
113 | test_out_of_context_cipher_change (mhd_gtls_session_t session) | 114 | test_out_of_context_cipher_change (MHD_gtls_session_t session) |
114 | { | 115 | { |
115 | int sd, ret; | 116 | int sd, ret; |
116 | struct sockaddr_in sa; | 117 | struct sockaddr_in sa; |
@@ -121,7 +122,7 @@ test_out_of_context_cipher_change (mhd_gtls_session_t session) | |||
121 | sa.sin_port = htons (42433); | 122 | sa.sin_port = htons (42433); |
122 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); | 123 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); |
123 | 124 | ||
124 | MHD_gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); | 125 | MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) sd); |
125 | 126 | ||
126 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); | 127 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); |
127 | 128 | ||
@@ -131,14 +132,14 @@ test_out_of_context_cipher_change (mhd_gtls_session_t session) | |||
131 | return -1; | 132 | return -1; |
132 | } | 133 | } |
133 | 134 | ||
134 | ret = MHD_gnutls_handshake (session); | 135 | ret = MHD__gnutls_handshake (session); |
135 | if (ret < 0) | 136 | if (ret < 0) |
136 | { | 137 | { |
137 | return -1; | 138 | return -1; |
138 | } | 139 | } |
139 | 140 | ||
140 | /* send an out of context cipher change spec */ | 141 | /* send an out of context cipher change spec */ |
141 | mhd_gtls_send_change_cipher_spec (session, 0); | 142 | MHD_gtls_send_change_cipher_spec (session, 0); |
142 | 143 | ||
143 | 144 | ||
144 | /* assert server has closed connection */ | 145 | /* assert server has closed connection */ |
@@ -155,7 +156,7 @@ test_out_of_context_cipher_change (mhd_gtls_session_t session) | |||
155 | 156 | ||
156 | /* */ | 157 | /* */ |
157 | static int | 158 | static int |
158 | test_rehandshake (mhd_gtls_session_t session) | 159 | test_rehandshake (MHD_gtls_session_t session) |
159 | { | 160 | { |
160 | int sd, ret; | 161 | int sd, ret; |
161 | struct sockaddr_in sa; | 162 | struct sockaddr_in sa; |
@@ -166,7 +167,7 @@ test_rehandshake (mhd_gtls_session_t session) | |||
166 | sa.sin_port = htons (42433); | 167 | sa.sin_port = htons (42433); |
167 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); | 168 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); |
168 | 169 | ||
169 | MHD_gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); | 170 | MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) sd); |
170 | 171 | ||
171 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); | 172 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); |
172 | 173 | ||
@@ -176,22 +177,22 @@ test_rehandshake (mhd_gtls_session_t session) | |||
176 | return -1; | 177 | return -1; |
177 | } | 178 | } |
178 | 179 | ||
179 | ret = MHD_gnutls_handshake (session); | 180 | ret = MHD__gnutls_handshake (session); |
180 | if (ret < 0) | 181 | if (ret < 0) |
181 | { | 182 | { |
182 | return -1; | 183 | return 1; |
183 | } | 184 | } |
184 | 185 | ||
185 | ret = MHD_gnutls_record_send (session, http_get_req, strlen (http_get_req)); | 186 | ret = MHD__gnutls_record_send (session, http_get_req, strlen (http_get_req)); |
186 | 187 | ||
187 | /* check server responds with a 'close-notify' */ | 188 | /* check server responds with a 'close-notify' */ |
188 | mhd_gtls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0); | 189 | MHD_gtls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0); |
189 | 190 | ||
190 | 191 | ||
191 | /* CLOSE_NOTIFY */ | 192 | /* CLOSE_NOTIFY */ |
192 | if (session->internals.last_alert != GNUTLS_A_CLOSE_NOTIFY) | 193 | if (session->internals.last_alert != GNUTLS_A_CLOSE_NOTIFY) |
193 | { | 194 | { |
194 | return -1; | 195 | return 1; |
195 | } | 196 | } |
196 | 197 | ||
197 | close (sd); | 198 | close (sd); |
@@ -203,12 +204,12 @@ main (int argc, char *const *argv) | |||
203 | { | 204 | { |
204 | int errorCount = 0;; | 205 | int errorCount = 0;; |
205 | struct MHD_Daemon *d; | 206 | struct MHD_Daemon *d; |
206 | mhd_gtls_session_t session; | 207 | MHD_gtls_session_t session; |
207 | gnutls_datum_t key; | 208 | MHD_gnutls_datum_t key; |
208 | gnutls_datum_t cert; | 209 | MHD_gnutls_datum_t cert; |
209 | mhd_gtls_cert_credentials_t xcred; | 210 | MHD_gtls_cert_credentials_t xcred; |
210 | 211 | ||
211 | MHD_gnutls_global_init (); | 212 | MHD__gnutls_global_init (); |
212 | MHD_gtls_global_set_log_level (11); | 213 | MHD_gtls_global_set_log_level (11); |
213 | 214 | ||
214 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | | 215 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | |
@@ -226,13 +227,14 @@ main (int argc, char *const *argv) | |||
226 | 227 | ||
227 | setup (&session, &key, &cert, &xcred); | 228 | setup (&session, &key, &cert, &xcred); |
228 | errorCount += test_out_of_context_cipher_change (session); | 229 | errorCount += test_out_of_context_cipher_change (session); |
230 | errorCount += test_rehandshake (session); | ||
229 | teardown (session, &key, &cert, xcred); | 231 | teardown (session, &key, &cert, xcred); |
230 | 232 | ||
231 | if (errorCount != 0) | 233 | if (errorCount != 0) |
232 | fprintf (stderr, "Failed test: %s.\n", argv[0]); | 234 | fprintf (stderr, "Failed test: %s.\n", argv[0]); |
233 | 235 | ||
234 | MHD_stop_daemon (d); | 236 | MHD_stop_daemon (d); |
235 | MHD_gnutls_global_deinit (); | 237 | MHD__gnutls_global_deinit (); |
236 | 238 | ||
237 | return errorCount != 0; | 239 | return errorCount != 0; |
238 | } | 240 | } |
diff --git a/src/testcurl/https/tls_session_time_out_test.c b/src/testcurl/https/tls_session_time_out_test.c index f0f43dbc..1fe6cc1c 100644 --- a/src/testcurl/https/tls_session_time_out_test.c +++ b/src/testcurl/https/tls_session_time_out_test.c | |||
@@ -55,50 +55,50 @@ http_ahc (void *cls, struct MHD_Connection *connection, | |||
55 | } | 55 | } |
56 | 56 | ||
57 | static int | 57 | static int |
58 | setup (mhd_gtls_session_t * session, | 58 | setup (MHD_gtls_session_t * session, |
59 | gnutls_datum_t * key, | 59 | MHD_gnutls_datum_t * key, |
60 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t * xcred) | 60 | MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t * xcred) |
61 | { | 61 | { |
62 | int ret; | 62 | int ret; |
63 | const char **err_pos; | 63 | const char **err_pos; |
64 | 64 | ||
65 | MHD_gnutls_certificate_allocate_credentials (xcred); | 65 | MHD__gnutls_certificate_allocate_credentials (xcred); |
66 | 66 | ||
67 | mhd_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); | 67 | MHD_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc); |
68 | mhd_gtls_set_datum_m (cert, srv_self_signed_cert_pem, | 68 | MHD_gtls_set_datum_m (cert, srv_self_signed_cert_pem, |
69 | strlen (srv_self_signed_cert_pem), &malloc); | 69 | strlen (srv_self_signed_cert_pem), &malloc); |
70 | 70 | ||
71 | MHD_gnutls_certificate_set_x509_key_mem (*xcred, cert, key, | 71 | MHD__gnutls_certificate_set_x509_key_mem (*xcred, cert, key, |
72 | GNUTLS_X509_FMT_PEM); | 72 | GNUTLS_X509_FMT_PEM); |
73 | 73 | ||
74 | MHD_gnutls_init (session, GNUTLS_CLIENT); | 74 | MHD__gnutls_init (session, GNUTLS_CLIENT); |
75 | ret = MHD_gnutls_priority_set_direct (*session, "NORMAL", err_pos); | 75 | ret = MHD__gnutls_priority_set_direct (*session, "NORMAL", err_pos); |
76 | if (ret < 0) | 76 | if (ret < 0) |
77 | { | 77 | { |
78 | return -1; | 78 | return -1; |
79 | } | 79 | } |
80 | 80 | ||
81 | MHD_gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); | 81 | MHD__gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred); |
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static int | 85 | static int |
86 | teardown (mhd_gtls_session_t session, | 86 | teardown (MHD_gtls_session_t session, |
87 | gnutls_datum_t * key, | 87 | MHD_gnutls_datum_t * key, |
88 | gnutls_datum_t * cert, mhd_gtls_cert_credentials_t xcred) | 88 | MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t xcred) |
89 | { | 89 | { |
90 | 90 | ||
91 | mhd_gtls_free_datum_m (key, free); | 91 | MHD_gtls_free_datum_m (key, free); |
92 | mhd_gtls_free_datum_m (cert, free); | 92 | MHD_gtls_free_datum_m (cert, free); |
93 | 93 | ||
94 | MHD_gnutls_deinit (session); | 94 | MHD__gnutls_deinit (session); |
95 | 95 | ||
96 | MHD_gnutls_certificate_free_credentials (xcred); | 96 | MHD__gnutls_certificate_free_credentials (xcred); |
97 | return 0; | 97 | return 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | static int | 100 | static int |
101 | test_tls_session_time_out (mhd_gtls_session_t session) | 101 | test_tls_session_time_out (MHD_gtls_session_t session) |
102 | { | 102 | { |
103 | int sd, ret; | 103 | int sd, ret; |
104 | struct sockaddr_in sa; | 104 | struct sockaddr_in sa; |
@@ -109,7 +109,7 @@ test_tls_session_time_out (mhd_gtls_session_t session) | |||
109 | sa.sin_port = htons (42433); | 109 | sa.sin_port = htons (42433); |
110 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); | 110 | inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr); |
111 | 111 | ||
112 | MHD_gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); | 112 | MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) sd); |
113 | 113 | ||
114 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); | 114 | ret = connect (sd, &sa, sizeof (struct sockaddr_in)); |
115 | 115 | ||
@@ -119,7 +119,7 @@ test_tls_session_time_out (mhd_gtls_session_t session) | |||
119 | return -1; | 119 | return -1; |
120 | } | 120 | } |
121 | 121 | ||
122 | ret = MHD_gnutls_handshake (session); | 122 | ret = MHD__gnutls_handshake (session); |
123 | if (ret < 0) | 123 | if (ret < 0) |
124 | { | 124 | { |
125 | return -1; | 125 | return -1; |
@@ -144,12 +144,12 @@ main (int argc, char *const *argv) | |||
144 | { | 144 | { |
145 | int errorCount = 0;; | 145 | int errorCount = 0;; |
146 | struct MHD_Daemon *d; | 146 | struct MHD_Daemon *d; |
147 | mhd_gtls_session_t session; | 147 | MHD_gtls_session_t session; |
148 | gnutls_datum_t key; | 148 | MHD_gnutls_datum_t key; |
149 | gnutls_datum_t cert; | 149 | MHD_gnutls_datum_t cert; |
150 | mhd_gtls_cert_credentials_t xcred; | 150 | MHD_gtls_cert_credentials_t xcred; |
151 | 151 | ||
152 | MHD_gnutls_global_init (); | 152 | MHD__gnutls_global_init (); |
153 | MHD_gtls_global_set_log_level (11); | 153 | MHD_gtls_global_set_log_level (11); |
154 | 154 | ||
155 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | | 155 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | |
@@ -174,7 +174,7 @@ main (int argc, char *const *argv) | |||
174 | fprintf (stderr, "Failed test: %s.\n", argv[0]); | 174 | fprintf (stderr, "Failed test: %s.\n", argv[0]); |
175 | 175 | ||
176 | MHD_stop_daemon (d); | 176 | MHD_stop_daemon (d); |
177 | MHD_gnutls_global_deinit (); | 177 | MHD__gnutls_global_deinit (); |
178 | 178 | ||
179 | return errorCount != 0; | 179 | return errorCount != 0; |
180 | } | 180 | } |