blob: d60f62be5c57806986dcbacf3b30f45e3ecc3ff6 [file] [log] [blame]
DRCff1e1ff2011-02-08 23:43:55 +00001/*
Adam Tkacb10489b2010-04-23 14:16:04 +00002 * Copyright (C) 2004 Red Hat Inc.
3 * Copyright (C) 2005 Martin Koegler
4 * Copyright (C) 2010 TigerVNC Team
Adam Tkac27b2f772010-11-18 13:33:57 +00005 * Copyright (C) 2010 m-privacy GmbH
Adam Tkacb10489b2010-04-23 14:16:04 +00006 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this software; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
21 */
22
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
26
Adam Tkac43958232010-07-21 09:06:59 +000027#ifndef HAVE_GNUTLS
28#error "This header should not be compiled without HAVE_GNUTLS defined"
29#endif
Adam Tkacb10489b2010-04-23 14:16:04 +000030
Adam Tkac27b2f772010-11-18 13:33:57 +000031#include <stdlib.h>
Adam Tkacc4674db2011-01-19 14:11:16 +000032#ifndef WIN32
Adam Tkac27b2f772010-11-18 13:33:57 +000033#include <unistd.h>
Adam Tkacc4674db2011-01-19 14:11:16 +000034#endif
Adam Tkac27b2f772010-11-18 13:33:57 +000035
Adam Tkac3c5be392010-07-21 09:27:34 +000036#include <rfb/CSecurityTLS.h>
Adam Tkac0e61c342010-07-21 09:23:25 +000037#include <rfb/SSecurityVeNCrypt.h>
Adam Tkacb10489b2010-04-23 14:16:04 +000038#include <rfb/CConnection.h>
39#include <rfb/LogWriter.h>
40#include <rfb/Exception.h>
Adam Tkac27b2f772010-11-18 13:33:57 +000041#include <rfb/UserMsgBox.h>
Adam Tkacb10489b2010-04-23 14:16:04 +000042#include <rdr/TLSInStream.h>
43#include <rdr/TLSOutStream.h>
Adam Tkac27b2f772010-11-18 13:33:57 +000044#include <os/os.h>
Adam Tkacb10489b2010-04-23 14:16:04 +000045
Adam Tkac0e61c342010-07-21 09:23:25 +000046#include <gnutls/x509.h>
47
Adam Tkac68481c12011-02-09 14:15:09 +000048/*
49 * GNUTLS 2.6.5 and older didn't have some variables defined so don't use them.
50 * GNUTLS 1.X.X defined LIBGNUTLS_VERSION_NUMBER so treat it as "old" gnutls as
51 * well
52 */
53#if (defined(GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER < 0x020606) || \
54 defined(LIBGNUTLS_VERSION_NUMBER)
55#define WITHOUT_X509_TIMES
DRCb7ab54f2011-02-09 03:27:26 +000056#endif
57
Adam Tkacb4864232011-02-09 15:38:37 +000058/* Ancient GNUTLS... */
59#if !defined(GNUTLS_VERSION_NUMBER) && !defined(LIBGNUTLS_VERSION_NUMBER)
60#define WITHOUT_X509_TIMES
61#endif
62
Adam Tkacb10489b2010-04-23 14:16:04 +000063using namespace rfb;
64
Pierre Ossman3d2a84b2014-09-17 16:45:35 +020065StringParameter CSecurityTLS::X509CA("X509CA", "X509 CA certificate", "", ConfViewer);
66StringParameter CSecurityTLS::X509CRL("X509CRL", "X509 CRL file", "", ConfViewer);
Adam Tkac0e61c342010-07-21 09:23:25 +000067
Adam Tkacb10489b2010-04-23 14:16:04 +000068static LogWriter vlog("TLS");
Adam Tkacb10489b2010-04-23 14:16:04 +000069
Adam Tkac3c5be392010-07-21 09:27:34 +000070CSecurityTLS::CSecurityTLS(bool _anon) : session(0), anon_cred(0),
Adam Tkac0e61c342010-07-21 09:23:25 +000071 anon(_anon), fis(0), fos(0)
Adam Tkacb10489b2010-04-23 14:16:04 +000072{
Pierre Ossman3d2a84b2014-09-17 16:45:35 +020073 cafile = X509CA.getData();
74 crlfile = X509CRL.getData();
Pierre Ossman8aa4bc52016-08-23 17:02:58 +020075
76 if (gnutls_global_init() != GNUTLS_E_SUCCESS)
77 throw AuthFailureException("gnutls_global_init failed");
Adam Tkacb10489b2010-04-23 14:16:04 +000078}
79
Adam Tkac27b2f772010-11-18 13:33:57 +000080void CSecurityTLS::setDefaults()
81{
82 char* homeDir = NULL;
83
Adam Tkacaf081722011-02-07 10:45:15 +000084 if (getvnchomedir(&homeDir) == -1) {
85 vlog.error("Could not obtain VNC home directory path");
Adam Tkac27b2f772010-11-18 13:33:57 +000086 return;
87 }
88
Adam Tkacaf081722011-02-07 10:45:15 +000089 int len = strlen(homeDir) + 1;
Adam Tkac437b0c22011-02-07 10:46:16 +000090 CharArray caDefault(len + 11);
91 CharArray crlDefault(len + 12);
92 sprintf(caDefault.buf, "%sx509_ca.pem", homeDir);
93 sprintf(crlDefault.buf, "%s509_crl.pem", homeDir);
Adam Tkac27b2f772010-11-18 13:33:57 +000094 delete [] homeDir;
95
Adam Tkacf16a4212011-02-07 10:47:07 +000096 if (!fileexists(caDefault.buf))
Pierre Ossman3d2a84b2014-09-17 16:45:35 +020097 X509CA.setDefaultStr(strdup(caDefault.buf));
Adam Tkacf16a4212011-02-07 10:47:07 +000098 if (!fileexists(crlDefault.buf))
Pierre Ossman3d2a84b2014-09-17 16:45:35 +020099 X509CRL.setDefaultStr(strdup(crlDefault.buf));
Adam Tkac27b2f772010-11-18 13:33:57 +0000100}
101
Adam Tkac44cdb132011-02-09 14:09:10 +0000102void CSecurityTLS::shutdown(bool needbye)
Adam Tkacb10489b2010-04-23 14:16:04 +0000103{
Adam Tkac44cdb132011-02-09 14:09:10 +0000104 if (session && needbye)
Adam Tkac6948ead2010-08-11 15:58:59 +0000105 if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS)
Adam Tkac44cdb132011-02-09 14:09:10 +0000106 vlog.error("gnutls_bye failed");
Adam Tkac0e61c342010-07-21 09:23:25 +0000107
108 if (anon_cred) {
109 gnutls_anon_free_client_credentials(anon_cred);
110 anon_cred = 0;
111 }
112
113 if (cert_cred) {
114 gnutls_certificate_free_credentials(cert_cred);
115 cert_cred = 0;
116 }
117
118 if (session) {
119 gnutls_deinit(session);
120 session = 0;
Adam Tkac0e61c342010-07-21 09:23:25 +0000121 }
Adam Tkacb10489b2010-04-23 14:16:04 +0000122}
123
124
Adam Tkac3c5be392010-07-21 09:27:34 +0000125CSecurityTLS::~CSecurityTLS()
Adam Tkacb10489b2010-04-23 14:16:04 +0000126{
Adam Tkac44cdb132011-02-09 14:09:10 +0000127 shutdown(true);
Adam Tkac0e61c342010-07-21 09:23:25 +0000128
Adam Tkacb10489b2010-04-23 14:16:04 +0000129 if (fis)
130 delete fis;
131 if (fos)
132 delete fos;
Adam Tkac0e61c342010-07-21 09:23:25 +0000133
134 delete[] cafile;
135 delete[] crlfile;
Pierre Ossman8aa4bc52016-08-23 17:02:58 +0200136
137 gnutls_global_deinit();
Adam Tkacb10489b2010-04-23 14:16:04 +0000138}
139
Adam Tkac3c5be392010-07-21 09:27:34 +0000140bool CSecurityTLS::processMsg(CConnection* cc)
Adam Tkacb10489b2010-04-23 14:16:04 +0000141{
142 rdr::InStream* is = cc->getInStream();
143 rdr::OutStream* os = cc->getOutStream();
144 client = cc;
145
Adam Tkacb10489b2010-04-23 14:16:04 +0000146 if (!session) {
147 if (!is->checkNoWait(1))
148 return false;
149
Adam Tkacce6c8b02011-05-10 08:54:57 +0000150 if (is->readU8() == 0) {
151 rdr::U32 result = is->readU32();
152 CharArray reason;
153 if (result == secResultFailed || result == secResultTooMany)
154 reason.buf = is->readString();
155 else
156 reason.buf = strDup("Authentication failure (protocol error)");
157 throw AuthFailureException(reason.buf);
158 }
Adam Tkacb10489b2010-04-23 14:16:04 +0000159
Adam Tkac6948ead2010-08-11 15:58:59 +0000160 if (gnutls_init(&session, GNUTLS_CLIENT) != GNUTLS_E_SUCCESS)
161 throw AuthFailureException("gnutls_init failed");
162
163 if (gnutls_set_default_priority(session) != GNUTLS_E_SUCCESS)
164 throw AuthFailureException("gnutls_set_default_priority failed");
Adam Tkacb10489b2010-04-23 14:16:04 +0000165
Adam Tkac0e61c342010-07-21 09:23:25 +0000166 setParam();
Adam Tkacb10489b2010-04-23 14:16:04 +0000167 }
168
Pierre Ossmanfe48cd42012-07-03 14:43:38 +0000169 rdr::TLSInStream *tlsis = new rdr::TLSInStream(is, session);
170 rdr::TLSOutStream *tlsos = new rdr::TLSOutStream(os, session);
171
Adam Tkacb10489b2010-04-23 14:16:04 +0000172 int err;
173 err = gnutls_handshake(session);
Adam Tkacb10489b2010-04-23 14:16:04 +0000174 if (err != GNUTLS_E_SUCCESS) {
Pierre Ossmanfe48cd42012-07-03 14:43:38 +0000175 delete tlsis;
176 delete tlsos;
177
178 if (!gnutls_error_is_fatal(err))
179 return false;
180
Adam Tkacb10489b2010-04-23 14:16:04 +0000181 vlog.error("TLS Handshake failed: %s\n", gnutls_strerror (err));
Adam Tkac44cdb132011-02-09 14:09:10 +0000182 shutdown(false);
Adam Tkacb10489b2010-04-23 14:16:04 +0000183 throw AuthFailureException("TLS Handshake failed");
184 }
Adam Tkac0e61c342010-07-21 09:23:25 +0000185
186 checkSession();
Adam Tkacb10489b2010-04-23 14:16:04 +0000187
Pierre Ossmanfe48cd42012-07-03 14:43:38 +0000188 cc->setStreams(fis = tlsis, fos = tlsos);
Adam Tkacb10489b2010-04-23 14:16:04 +0000189
190 return true;
191}
192
Adam Tkac3c5be392010-07-21 09:27:34 +0000193void CSecurityTLS::setParam()
Adam Tkac0e61c342010-07-21 09:23:25 +0000194{
Pierre Ossman27eb55e2015-01-29 13:31:06 +0100195 static const char kx_anon_priority[] = ":+ANON-ECDH:+ANON-DH";
Pierre Ossman88c24ed2015-01-29 13:12:22 +0100196
197 int ret;
Pierre Ossman27eb55e2015-01-29 13:31:06 +0100198 char *prio;
Pierre Ossman88c24ed2015-01-29 13:12:22 +0100199 const char *err;
Adam Tkac0e61c342010-07-21 09:23:25 +0000200
Pierre Ossman27eb55e2015-01-29 13:31:06 +0100201 prio = (char*)malloc(strlen(Security::GnuTLSPriority) +
202 strlen(kx_anon_priority) + 1);
203 if (prio == NULL)
204 throw AuthFailureException("Not enough memory for GnuTLS priority string");
Adam Tkac6948ead2010-08-11 15:58:59 +0000205
Pierre Ossman27eb55e2015-01-29 13:31:06 +0100206 strcpy(prio, Security::GnuTLSPriority);
207 if (anon)
208 strcat(prio, kx_anon_priority);
209
210 ret = gnutls_priority_set_direct(session, prio, &err);
211
212 free(prio);
213
214 if (ret != GNUTLS_E_SUCCESS) {
215 if (ret == GNUTLS_E_INVALID_REQUEST)
216 vlog.error("GnuTLS priority syntax error at: %s", err);
217 throw AuthFailureException("gnutls_set_priority_direct failed");
218 }
219
220 if (anon) {
Adam Tkac6948ead2010-08-11 15:58:59 +0000221 if (gnutls_anon_allocate_client_credentials(&anon_cred) != GNUTLS_E_SUCCESS)
222 throw AuthFailureException("gnutls_anon_allocate_client_credentials failed");
223
224 if (gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred) != GNUTLS_E_SUCCESS)
225 throw AuthFailureException("gnutls_credentials_set failed");
Adam Tkac0e61c342010-07-21 09:23:25 +0000226
227 vlog.debug("Anonymous session has been set");
228 } else {
Adam Tkac6948ead2010-08-11 15:58:59 +0000229 if (gnutls_certificate_allocate_credentials(&cert_cred) != GNUTLS_E_SUCCESS)
230 throw AuthFailureException("gnutls_certificate_allocate_credentials failed");
Adam Tkac0e61c342010-07-21 09:23:25 +0000231
232 if (*cafile && gnutls_certificate_set_x509_trust_file(cert_cred,cafile,GNUTLS_X509_FMT_PEM) < 0)
233 throw AuthFailureException("load of CA cert failed");
234
Adam Tkace32573a2011-02-09 14:13:41 +0000235 /* Load previously saved certs */
236 char *homeDir = NULL;
237 int err;
238 if (getvnchomedir(&homeDir) == -1)
239 vlog.error("Could not obtain VNC home directory path");
240 else {
241 CharArray caSave(strlen(homeDir) + 19 + 1);
242 sprintf(caSave.buf, "%sx509_savedcerts.pem", homeDir);
243 delete [] homeDir;
244
245 err = gnutls_certificate_set_x509_trust_file(cert_cred, caSave.buf,
246 GNUTLS_X509_FMT_PEM);
247 if (err < 0)
248 vlog.debug("Failed to load saved server certificates from %s", caSave.buf);
249 }
250
Adam Tkac0e61c342010-07-21 09:23:25 +0000251 if (*crlfile && gnutls_certificate_set_x509_crl_file(cert_cred,crlfile,GNUTLS_X509_FMT_PEM) < 0)
252 throw AuthFailureException("load of CRL failed");
253
Adam Tkac6948ead2010-08-11 15:58:59 +0000254 if (gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred) != GNUTLS_E_SUCCESS)
255 throw AuthFailureException("gnutls_credentials_set failed");
Adam Tkac0e61c342010-07-21 09:23:25 +0000256
Pierre Ossman894f2c52017-09-08 15:28:39 +0200257 if (gnutls_server_name_set(session, GNUTLS_NAME_DNS,
258 client->getServerName(),
259 strlen(client->getServerName())) != GNUTLS_E_SUCCESS)
260 vlog.error("Failed to configure the server name for TLS handshake");
261
Adam Tkac0e61c342010-07-21 09:23:25 +0000262 vlog.debug("X509 session has been set");
263 }
264}
265
Adam Tkac3c5be392010-07-21 09:27:34 +0000266void CSecurityTLS::checkSession()
Adam Tkac0e61c342010-07-21 09:23:25 +0000267{
Adam Tkace32573a2011-02-09 14:13:41 +0000268 const unsigned allowed_errors = GNUTLS_CERT_INVALID |
269 GNUTLS_CERT_SIGNER_NOT_FOUND |
270 GNUTLS_CERT_SIGNER_NOT_CA;
271 unsigned int status;
Pierre Ossman88c24ed2015-01-29 13:12:22 +0100272 const gnutls_datum_t *cert_list;
Adam Tkac0e61c342010-07-21 09:23:25 +0000273 unsigned int cert_list_size = 0;
Adam Tkace32573a2011-02-09 14:13:41 +0000274 int err;
Pierre Ossman88c24ed2015-01-29 13:12:22 +0100275 gnutls_datum_t info;
Adam Tkac0e61c342010-07-21 09:23:25 +0000276
277 if (anon)
278 return;
279
280 if (gnutls_certificate_type_get(session) != GNUTLS_CRT_X509)
281 throw AuthFailureException("unsupported certificate type");
282
Adam Tkace32573a2011-02-09 14:13:41 +0000283 err = gnutls_certificate_verify_peers2(session, &status);
284 if (err != 0) {
285 vlog.error("server certificate verification failed: %s", gnutls_strerror(err));
286 throw AuthFailureException("server certificate verification failed");
287 }
288
289 if (status & GNUTLS_CERT_REVOKED)
290 throw AuthFailureException("server certificate has been revoked");
291
Adam Tkac68481c12011-02-09 14:15:09 +0000292#ifndef WITHOUT_X509_TIMES
Adam Tkace32573a2011-02-09 14:13:41 +0000293 if (status & GNUTLS_CERT_NOT_ACTIVATED)
294 throw AuthFailureException("server certificate has not been activated");
295
296 if (status & GNUTLS_CERT_EXPIRED) {
297 vlog.debug("server certificate has expired");
298 if (!msg->showMsgBox(UserMsgBox::M_YESNO, "certificate has expired",
299 "The certificate of the server has expired, "
300 "do you want to continue?"))
301 throw AuthFailureException("server certificate has expired");
302 }
Adam Tkac68481c12011-02-09 14:15:09 +0000303#endif
Adam Tkace32573a2011-02-09 14:13:41 +0000304 /* Process other errors later */
305
Adam Tkac0e61c342010-07-21 09:23:25 +0000306 cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
307 if (!cert_list_size)
Adam Tkace32573a2011-02-09 14:13:41 +0000308 throw AuthFailureException("empty certificate chain");
Adam Tkac0e61c342010-07-21 09:23:25 +0000309
Adam Tkace32573a2011-02-09 14:13:41 +0000310 /* Process only server's certificate, not issuer's certificate */
Pierre Ossman88c24ed2015-01-29 13:12:22 +0100311 gnutls_x509_crt_t crt;
Adam Tkace32573a2011-02-09 14:13:41 +0000312 gnutls_x509_crt_init(&crt);
Adam Tkac0e61c342010-07-21 09:23:25 +0000313
Adam Tkace32573a2011-02-09 14:13:41 +0000314 if (gnutls_x509_crt_import(crt, &cert_list[0], GNUTLS_X509_FMT_DER) < 0)
315 throw AuthFailureException("decoding of certificate failed");
316
317 if (gnutls_x509_crt_check_hostname(crt, client->getServerName()) == 0) {
318 char buf[255];
319 vlog.debug("hostname mismatch");
320 snprintf(buf, sizeof(buf), "Hostname (%s) does not match any certificate, "
321 "do you want to continue?", client->getServerName());
322 buf[sizeof(buf) - 1] = '\0';
323 if (!msg->showMsgBox(UserMsgBox::M_YESNO, "hostname mismatch", buf))
324 throw AuthFailureException("hostname mismatch");
Adam Tkac0e61c342010-07-21 09:23:25 +0000325 }
326
Adam Tkace32573a2011-02-09 14:13:41 +0000327 if (status == 0) {
328 /* Everything is fine (hostname + verification) */
Adam Tkac0e61c342010-07-21 09:23:25 +0000329 gnutls_x509_crt_deinit(crt);
Adam Tkace32573a2011-02-09 14:13:41 +0000330 return;
331 }
332
333 if (status & GNUTLS_CERT_INVALID)
334 vlog.debug("server certificate invalid");
335 if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
336 vlog.debug("server cert signer not found");
337 if (status & GNUTLS_CERT_SIGNER_NOT_CA)
338 vlog.debug("server cert signer not CA");
339
340 if ((status & (~allowed_errors)) != 0) {
341 /* No other errors are allowed */
342 vlog.debug("GNUTLS status of certificate verification: %u", status);
343 throw AuthFailureException("Invalid status of server certificate verification");
344 }
345
346 vlog.debug("Saved server certificates don't match");
347
Adam Tkace32573a2011-02-09 14:13:41 +0000348 if (gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_ONELINE, &info)) {
Adam Tkac5d4c6ac2011-01-19 14:06:48 +0000349 /*
350 * GNUTLS doesn't correctly export gnutls_free symbol which is
351 * a function pointer. Linking with Visual Studio 2008 Express will
352 * fail when you call gnutls_free().
353 */
354#if WIN32
355 free(info.data);
356#else
Adam Tkac27b2f772010-11-18 13:33:57 +0000357 gnutls_free(info.data);
Adam Tkac5d4c6ac2011-01-19 14:06:48 +0000358#endif
Adam Tkace32573a2011-02-09 14:13:41 +0000359 throw AuthFailureException("Could not find certificate to display");
Adam Tkac0e61c342010-07-21 09:23:25 +0000360 }
Adam Tkace32573a2011-02-09 14:13:41 +0000361
Adam Tkac68481c12011-02-09 14:15:09 +0000362 size_t out_size = 0;
Adam Tkace32573a2011-02-09 14:13:41 +0000363 char *out_buf = NULL;
364 char *certinfo = NULL;
365 int len = 0;
366
367 vlog.debug("certificate issuer unknown");
368
369 len = snprintf(NULL, 0, "This certificate has been signed by an unknown "
370 "authority:\n\n%s\n\nDo you want to save it and "
371 "continue?\n ", info.data);
372 if (len < 0)
373 AuthFailureException("certificate decoding error");
374
375 vlog.debug("%s", info.data);
376
377 certinfo = new char[len];
378 if (certinfo == NULL)
379 throw AuthFailureException("Out of memory");
380
381 snprintf(certinfo, len, "This certificate has been signed by an unknown "
382 "authority:\n\n%s\n\nDo you want to save it and "
383 "continue? ", info.data);
384
385 for (int i = 0; i < len - 1; i++)
386 if (certinfo[i] == ',' && certinfo[i + 1] == ' ')
387 certinfo[i] = '\n';
388
389 if (!msg->showMsgBox(UserMsgBox::M_YESNO, "certificate issuer unknown",
390 certinfo)) {
391 delete [] certinfo;
392 throw AuthFailureException("certificate issuer unknown");
393 }
394
395 delete [] certinfo;
396
397 if (gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM, NULL, &out_size)
398 == GNUTLS_E_SHORT_MEMORY_BUFFER)
399 AuthFailureException("Out of memory");
400
401 // Save cert
402 out_buf = new char[out_size];
403 if (out_buf == NULL)
404 AuthFailureException("Out of memory");
405
406 if (gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM, out_buf, &out_size) < 0)
407 AuthFailureException("certificate issuer unknown, and certificate "
408 "export failed");
409
410 char *homeDir = NULL;
411 if (getvnchomedir(&homeDir) == -1)
412 vlog.error("Could not obtain VNC home directory path");
413 else {
414 FILE *f;
415 CharArray caSave(strlen(homeDir) + 1 + 19);
416 sprintf(caSave.buf, "%sx509_savedcerts.pem", homeDir);
417 delete [] homeDir;
418 f = fopen(caSave.buf, "a+");
419 if (!f)
420 msg->showMsgBox(UserMsgBox::M_OK, "certificate save failed",
421 "Could not save the certificate");
422 else {
423 fprintf(f, "%s\n", out_buf);
424 fclose(f);
425 }
426 }
427
428 delete [] out_buf;
429
430 gnutls_x509_crt_deinit(crt);
431 /*
432 * GNUTLS doesn't correctly export gnutls_free symbol which is
433 * a function pointer. Linking with Visual Studio 2008 Express will
434 * fail when you call gnutls_free().
435 */
436#if WIN32
437 free(info.data);
438#else
439 gnutls_free(info.data);
440#endif
Adam Tkac0e61c342010-07-21 09:23:25 +0000441}
442