towards using libgnutls directly

This commit is contained in:
Christian Grothoff committed 2010-07-24 15:24:50 +00:00
1 parent 29529aefd1
commit 58d06b2255
142 files changed
+211 -34628

No files matched your search

+1 -15
View File
@@ -6,10 +6,6 @@ endif
AM_CPPFLAGS = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/daemon/https \
-I$(top_srcdir)/src/daemon/https/tls \
-I$(top_srcdir)/src/daemon/https/lgl \
-I$(top_srcdir)/src/daemon/https/x509 \
-I$(top_srcdir)/src/daemon \
$(LIBCURL_CPPFLAGS)
@@ -23,8 +19,7 @@ check_PROGRAMS = \
tls_multi_thread_mode_test \
tls_session_time_out_test \
tls_cipher_change_test \
tls_alert_test \
tls_extension_test
tls_alert_test
EXTRA_DIST = cert.pem key.pem tls_test_keys.h tls_test_common.h
@@ -39,18 +34,9 @@ TESTS = \
tls_session_time_out_test \
tls_cipher_change_test \
tls_alert_test \
tls_extension_test \
tls_authentication_test
# cURL dependent tests
tls_extension_test_SOURCES = \
tls_extension_test.c \
tls_test_common.c
tls_extension_test_LDADD = \
$(top_builddir)/src/testcurl/libcurl_version_check.a \
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
tls_session_time_out_test_SOURCES = \
tls_session_time_out_test.c \
tls_test_common.c
+1 -5
View File
@@ -26,13 +26,9 @@
#include "platform.h"
#include "microhttpd.h"
#include <limits.h>
#include <sys/stat.h>
#include "gnutls.h"
#include <curl/curl.h>
#include "tls_test_common.h"
int curl_check_version (const char *req_version, ...);
@@ -46,7 +42,7 @@ test_cipher_option (FILE * test_fd, char *cipher_suite, int proto_version)
{
int ret;
int ciper[] = { MHD_GNUTLS_CIPHER_3DES_CBC, 0 };
int ciper[] = { GNUTLS_CIPHER_3DES_CBC, 0 };
struct MHD_Daemon *d;
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, 42433,
+2 -2
View File
@@ -53,7 +53,7 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
if (MHD_get_connection_info
(connection,
MHD_CONNECTION_INFO_CIPHER_ALGO)->cipher_algorithm !=
MHD_GNUTLS_CIPHER_AES_256_CBC)
GNUTLS_CIPHER_AES_256_CBC)
{
fprintf (stderr, "Error: requested cipher mismatch. %s\n",
strerror (errno));
@@ -62,7 +62,7 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
if (MHD_get_connection_info
(connection,
MHD_CONNECTION_INFO_PROTOCOL)->protocol != MHD_GNUTLS_PROTOCOL_SSL3)
MHD_CONNECTION_INFO_PROTOCOL)->protocol != GNUTLS_SSL3)
{
fprintf (stderr, "Error: requested compression mismatch. %s\n",
strerror (errno));
+22 -24
View File
@@ -19,7 +19,7 @@
*/
/**
* @file mhds_get_test.c
* @file tls_alert_test.c
* @brief: daemon TLS alert response test-case
*
* @author Sagie Amir
@@ -27,11 +27,8 @@
#include "platform.h"
#include "microhttpd.h"
#include "gnutls_int.h"
#include "gnutls_datum.h"
#include "gnutls_record.h"
#include "tls_test_common.h"
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -42,7 +39,7 @@ extern const char srv_self_signed_cert_pem[];
* @param session: an initialized TLS session
*/
static int
test_alert_close_notify (MHD_gtls_session_t session)
test_alert_close_notify (gnutls_session_t session)
{
int sd, ret;
struct sockaddr_in sa;
@@ -59,7 +56,7 @@ test_alert_close_notify (MHD_gtls_session_t session)
sa.sin_port = htons (DEAMON_TEST_PORT);
inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr);
MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (long) sd);
ret = connect (sd, &sa, sizeof (struct sockaddr_in));
@@ -69,16 +66,17 @@ test_alert_close_notify (MHD_gtls_session_t session)
return -1;
}
ret = MHD__gnutls_handshake (session);
ret = gnutls_handshake (session);
if (ret < 0)
{
return -1;
}
MHD__gnutls_alert_send (session, GNUTLS_AL_FATAL, GNUTLS_A_CLOSE_NOTIFY);
gnutls_alert_send (session, GNUTLS_AL_FATAL, GNUTLS_A_CLOSE_NOTIFY);
#if FIXME_GHM
/* check server responds with a 'close-notify' */
MHD_gtls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0);
gnutls_recv_int (session, GNUTLS_ALERT, GNUTLS_HANDSHAKE_FINISHED, 0, 0);
close (sd);
/* CLOSE_NOTIFY */
@@ -86,7 +84,7 @@ test_alert_close_notify (MHD_gtls_session_t session)
{
return -1;
}
#endif
return 0;
}
@@ -97,7 +95,7 @@ test_alert_close_notify (MHD_gtls_session_t session)
* @param session: an initialized TLS session
*/
static int
test_alert_unexpected_message (MHD_gtls_session_t session)
test_alert_unexpected_message (gnutls_session_t session)
{
int sd, ret;
struct sockaddr_in sa;
@@ -113,8 +111,8 @@ test_alert_unexpected_message (MHD_gtls_session_t session)
sa.sin_port = htons (DEAMON_TEST_PORT);
inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr);
MHD__gnutls_transport_set_ptr (session,
(MHD_gnutls_transport_ptr_t) ((void *) (long) sd));
gnutls_transport_set_ptr (session,
(gnutls_transport_ptr_t) ((void *) (long) sd));
ret = connect (sd, &sa, sizeof (struct sockaddr_in));
@@ -124,14 +122,14 @@ test_alert_unexpected_message (MHD_gtls_session_t session)
return -1;
}
ret = MHD__gnutls_handshake (session);
ret = gnutls_handshake (session);
if (ret < 0)
{
return -1;
}
MHD__gnutls_alert_send (session, GNUTLS_AL_FATAL,
GNUTLS_A_UNEXPECTED_MESSAGE);
gnutls_alert_send (session, GNUTLS_AL_FATAL,
GNUTLS_A_UNEXPECTED_MESSAGE);
usleep (100);
/* TODO better RST trigger */
@@ -149,13 +147,13 @@ main (int argc, char *const *argv)
{
int errorCount = 0;;
struct MHD_Daemon *d;
MHD_gtls_session_t session;
MHD_gnutls_datum_t key;
MHD_gnutls_datum_t cert;
MHD_gtls_cert_credentials_t xcred;
gnutls_session_t session;
gnutls_datum_t key;
gnutls_datum_t cert;
gnutls_certificate_credentials_t xcred;
MHD__gnutls_global_init ();
MHD_gtls_global_set_log_level (11);
gnutls_global_init ();
gnutls_global_set_log_level (11);
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, DEAMON_TEST_PORT,
@@ -181,7 +179,7 @@ main (int argc, char *const *argv)
print_test_result (errorCount, argv[0]);
MHD_stop_daemon (d);
MHD__gnutls_global_deinit ();
gnutls_global_deinit ();
return errorCount != 0;
}
+15 -17
View File
@@ -28,11 +28,8 @@
#include "platform.h"
#include "microhttpd.h"
#include "internal.h"
#include "gnutls_int.h"
#include "gnutls_datum.h"
#include "gnutls_record.h"
#include "tls_test_common.h"
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -47,7 +44,7 @@ rehandshake_ahc (void *cls, struct MHD_Connection *connection,
{
int ret;
/* server side re-handshake request */
ret = MHD__gnutls_rehandshake (connection->tls_session);
ret = gnutls_rehandshake (connection->tls_session);
if (ret < 0)
{
@@ -67,7 +64,7 @@ rehandshake_ahc (void *cls, struct MHD_Connection *connection,
* @param session: initiallized TLS session
*/
static int
test_out_of_context_cipher_change (MHD_gtls_session_t session)
test_out_of_context_cipher_change (gnutls_session_t session)
{
int sd, ret;
struct sockaddr_in sa;
@@ -84,7 +81,7 @@ test_out_of_context_cipher_change (MHD_gtls_session_t session)
sa.sin_port = htons (DEAMON_TEST_PORT);
inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr);
MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (long) sd);
ret = connect (sd, &sa, sizeof (struct sockaddr_in));
@@ -94,15 +91,16 @@ test_out_of_context_cipher_change (MHD_gtls_session_t session)
return -1;
}
ret = MHD__gnutls_handshake (session);
ret = gnutls_handshake (session);
if (ret < 0)
{
return -1;
}
#if FIXME_GHM
/* send an out of context cipher change spec */
MHD_gtls_send_change_cipher_spec (session, 0);
gnutls_send_change_cipher_spec (session, 0);
#endif
/* assert server has closed connection */
/* TODO better RST trigger */
@@ -120,13 +118,13 @@ main (int argc, char *const *argv)
{
int errorCount = 0;;
struct MHD_Daemon *d;
MHD_gtls_session_t session;
MHD_gnutls_datum_t key;
MHD_gnutls_datum_t cert;
MHD_gtls_cert_credentials_t xcred;
gnutls_session_t session;
gnutls_datum_t key;
gnutls_datum_t cert;
gnutls_certificate_credentials_t xcred;
MHD__gnutls_global_init ();
MHD_gtls_global_set_log_level (11);
gnutls_global_init ();
gnutls_global_set_log_level (11);
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, DEAMON_TEST_PORT,
@@ -148,7 +146,7 @@ main (int argc, char *const *argv)
print_test_result (errorCount, argv[0]);
MHD_stop_daemon (d);
MHD__gnutls_global_deinit ();
gnutls_global_deinit ();
return errorCount != 0;
}
+8 -10
View File
@@ -28,8 +28,6 @@
#include "microhttpd.h"
#include <sys/stat.h>
#include <limits.h>
#include "gnutls.h"
#include "tls_test_common.h"
extern const char srv_key_pem[];
@@ -106,17 +104,17 @@ main (int argc, char *const *argv)
return -1;
}
int p_ssl3[] = { MHD_GNUTLS_PROTOCOL_SSL3, 0 };
int p_tls[] = { MHD_GNUTLS_PROTOCOL_TLS1_2,
MHD_GNUTLS_PROTOCOL_TLS1_1,
MHD_GNUTLS_PROTOCOL_TLS1_0, 0
int p_ssl3[] = { GNUTLS_SSL3, 0 };
int p_tls[] = { GNUTLS_TLS1_2,
GNUTLS_TLS1_1,
GNUTLS_TLS1_0, 0
};
struct CipherDef ciphers[] = {
{{MHD_GNUTLS_CIPHER_AES_128_CBC, 0}, "AES128-SHA"},
{{MHD_GNUTLS_CIPHER_ARCFOUR_128, 0}, "RC4-SHA"},
{{MHD_GNUTLS_CIPHER_3DES_CBC, 0}, "3DES-SHA"},
{{MHD_GNUTLS_CIPHER_AES_256_CBC, 0}, "AES256-SHA"},
{{GNUTLS_CIPHER_AES_128_CBC, 0}, "AES128-SHA"},
{{GNUTLS_CIPHER_ARCFOUR_128, 0}, "RC4-SHA"},
{{GNUTLS_CIPHER_3DES_CBC, 0}, "3DES-SHA"},
{{GNUTLS_CIPHER_AES_256_CBC, 0}, "AES256-SHA"},
{{0, 0}, NULL}
};
fprintf (stderr, "SHA/TLS tests:\n");
+16 -26
View File
@@ -27,19 +27,9 @@
#include "platform.h"
#include "microhttpd.h"
#include "gnutls_int.h"
#include "gnutls_handshake.h" // MHD_gtls_send_handshake
#include "gnutls_num.h" // MHD_gtls_write_x
#include "common.h" // MHD_gtls_version_x
#include "tls_test_common.h"
#define MAX_EXT_DATA_LENGTH 256
extern int
MHD__gnutls_copy_ciphersuites (MHD_gtls_session_t session,
opaque * ret_data, size_t ret_data_size);
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -53,7 +43,7 @@ extern const char srv_self_signed_cert_pem[];
* @return 0 on successful test completion, -1 otherwise
*/
static int
test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
test_hello_extension (gnutls_session_t session, extensions_t exten_t,
int ext_count, int ext_length)
{
int i, sd, ret = 0, pos = 0;
@@ -117,7 +107,7 @@ test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
/* generate session client random */
memset (session->security_parameters.client_random, 0, TLS_RANDOM_SIZE);
MHD_gtls_write_uint32 (time (NULL), rnd);
gnutls_write_uint32 (time (NULL), rnd);
if (GC_OK != MHD_gc_nonce ((char *) &rnd[4], TLS_RANDOM_SIZE - 4)) abort ();
memcpy (session->security_parameters.client_random, rnd, TLS_RANDOM_SIZE);
memcpy (&data[pos], rnd, TLS_RANDOM_SIZE);
@@ -144,14 +134,14 @@ test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
pos += 2;
/* set extensions length = 2 type bytes + 2 length bytes + extension length */
MHD_gtls_write_uint16 (exten_data_len, &data[pos]);
gnutls_write_uint16 (exten_data_len, &data[pos]);
pos += 2;
for (i = 0; i < ext_count; ++i)
{
/* write extension type */
MHD_gtls_write_uint16 (exten_t, &data[pos]);
gnutls_write_uint16 (exten_t, &data[pos]);
pos += 2;
MHD_gtls_write_uint16 (ext_length, &data[pos]);
gnutls_write_uint16 (ext_length, &data[pos]);
pos += 2;
/* we might want to generate random data here */
memset (&data[pos], 0, ext_length);
@@ -165,7 +155,7 @@ test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
goto cleanup;
}
MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd);
gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd);
if (gen_test_file_url (url, DEAMON_TEST_PORT))
{
@@ -174,15 +164,15 @@ test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
}
/* this should crash the server */
ret = MHD_gtls_send_handshake (session, data, datalen,
GNUTLS_HANDSHAKE_CLIENT_HELLO);
ret = gnutls_send_handshake (session, data, datalen,
GNUTLS_HANDSHAKE_CLIENT_HELLO);
/* advance to STATE2 */
session->internals.handshake_state = STATE2;
ret = MHD__gnutls_handshake (session);
ret = MHD__gnutls_bye (session, GNUTLS_SHUT_WR);
ret = gnutls_handshake (session);
ret = gnutls_bye (session, GNUTLS_SHUT_WR);
MHD_gnutls_free (data);
gnutls_free (data);
/* make sure daemon is still functioning */
if (CURLE_OK != send_curl_req (url, &cbc, "AES128-SHA",
@@ -195,7 +185,7 @@ test_hello_extension (MHD_gtls_session_t session, extensions_t exten_t,
cleanup:
if (sd != -1)
close (sd);
MHD_gnutls_free (cbc.buf);
gnutls_free (cbc.buf);
return ret;
}
@@ -205,10 +195,10 @@ main (int argc, char *const *argv)
int i, errorCount = 0;
FILE *test_fd;
struct MHD_Daemon *d;
MHD_gtls_session_t session;
MHD_gnutls_datum_t key;
MHD_gnutls_datum_t cert;
MHD_gtls_cert_credentials_t xcred;
gnutls_session_t session;
gnutls_datum_t key;
gnutls_datum_t cert;
gnutls_certificate_credentials_t xcred;
int ext_arr[] = { GNUTLS_EXTENSION_SERVER_NAME,
-1
@@ -29,13 +29,11 @@
#include "platform.h"
#include "microhttpd.h"
#include <sys/stat.h>
#include <limits.h>
#include "gnutls.h"
#include <curl/curl.h>
#include "tls_test_common.h"
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
+13 -60
View File
@@ -28,11 +28,8 @@
#include "platform.h"
#include "microhttpd.h"
#include "internal.h"
#include "gnutls_int.h"
#include "gnutls_datum.h"
#include "gnutls_record.h"
#include "tls_test_common.h"
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -41,51 +38,7 @@ static const int TIME_OUT = 3;
char *http_get_req = "GET / HTTP/1.1\r\n\r\n";
static int
setup_timeout_test (MHD_gtls_session_t * session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert,
MHD_gtls_cert_credentials_t * xcred)
{
int ret;
MHD__gnutls_certificate_allocate_credentials (xcred);
MHD_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc);
MHD_gtls_set_datum_m (cert, srv_self_signed_cert_pem,
strlen (srv_self_signed_cert_pem), &malloc);
MHD__gnutls_certificate_set_x509_key_mem (*xcred, cert, key,
GNUTLS_X509_FMT_PEM);
MHD__gnutls_init (session, GNUTLS_CLIENT);
ret = MHD__gnutls_priority_set_direct (*session, "NORMAL", NULL);
if (ret < 0)
{
return -1;
}
MHD__gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred);
return 0;
}
static int
teardown_timeout_test (MHD_gtls_session_t session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert,
MHD_gtls_cert_credentials_t xcred)
{
MHD_gtls_free_datum_m (key, free);
MHD_gtls_free_datum_m (cert, free);
MHD__gnutls_deinit (session);
MHD__gnutls_certificate_free_credentials (xcred);
return 0;
}
static int
test_tls_session_time_out (MHD_gtls_session_t session)
test_tls_session_time_out (gnutls_session_t session)
{
int sd, ret;
struct sockaddr_in sa;
@@ -102,7 +55,7 @@ test_tls_session_time_out (MHD_gtls_session_t session)
sa.sin_port = htons (DEAMON_TEST_PORT);
inet_pton (AF_INET, "127.0.0.1", &sa.sin_addr);
MHD__gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (long) sd);
ret = connect (sd, &sa, sizeof (struct sockaddr_in));
@@ -112,7 +65,7 @@ test_tls_session_time_out (MHD_gtls_session_t session)
return -1;
}
ret = MHD__gnutls_handshake (session);
ret = gnutls_handshake (session);
if (ret < 0)
{
return -1;
@@ -136,13 +89,13 @@ main (int argc, char *const *argv)
{
int errorCount = 0;;
struct MHD_Daemon *d;
MHD_gtls_session_t session;
MHD_gnutls_datum_t key;
MHD_gnutls_datum_t cert;
MHD_gtls_cert_credentials_t xcred;
gnutls_session_t session;
gnutls_datum_t key;
gnutls_datum_t cert;
gnutls_certificate_credentials_t xcred;
MHD__gnutls_global_init ();
MHD_gtls_global_set_log_level (11);
gnutls_global_init ();
gnutls_global_set_log_level (11);
d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL |
MHD_USE_DEBUG, DEAMON_TEST_PORT,
@@ -158,14 +111,14 @@ main (int argc, char *const *argv)
return -1;
}
setup_timeout_test (&session, &key, &cert, &xcred);
setup_session (&session, &key, &cert, &xcred);
errorCount += test_tls_session_time_out (session);
teardown_timeout_test (session, &key, &cert, xcred);
teardown_session (session, &key, &cert, xcred);
print_test_result (errorCount, argv[0]);
MHD_stop_daemon (d);
MHD__gnutls_global_deinit ();
gnutls_global_deinit ();
return errorCount != 0;
}
+33 -33
View File
@@ -19,14 +19,12 @@
*/
/**
* @file tls_daemon_options_test.c
* @file tls_test_common.c
* @brief Common tls test functions
* @author Sagie Amir
*/
#include "tls_test_common.h"
#include "tls_test_keys.h"
#include "gnutls.h"
#include "gnutls_datum.h"
const char test_file_data[] = "Hello World\n";
@@ -344,46 +342,48 @@ teardown_testcase (struct MHD_Daemon *d)
}
int
setup_session (MHD_gtls_session_t * session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert, MHD_gtls_cert_credentials_t * xcred)
setup_session (gnutls_session_t * session,
gnutls_datum_t * key,
gnutls_datum_t * cert,
gnutls_certificate_credentials_t * xcred)
{
int ret;
const char *err_pos;
MHD__gnutls_certificate_allocate_credentials (xcred);
MHD_gtls_set_datum_m (key, srv_key_pem, strlen (srv_key_pem), &malloc);
MHD_gtls_set_datum_m (cert, srv_self_signed_cert_pem,
strlen (srv_self_signed_cert_pem), &malloc);
MHD__gnutls_certificate_set_x509_key_mem (*xcred, cert, key,
GNUTLS_X509_FMT_PEM);
MHD__gnutls_init (session, GNUTLS_CLIENT);
ret = MHD__gnutls_priority_set_direct (*session, "NORMAL", &err_pos);
gnutls_certificate_allocate_credentials (xcred);
key->size = strlen (srv_key_pem);
key->data = malloc (key->size);
memcpy (key->data, srv_key_pem, key->size);
cert->size = strlen (srv_self_signed_cert_pem);
cert->data = malloc (cert->size);
memcpy (cert->data, srv_self_signed_cert_pem, cert->size);
gnutls_certificate_set_x509_key_mem (*xcred, cert, key,
GNUTLS_X509_FMT_PEM);
gnutls_init (session, GNUTLS_CLIENT);
ret = gnutls_priority_set_direct (*session,
"NORMAL", &err_pos);
if (ret < 0)
{
return -1;
}
MHD__gnutls_credentials_set (*session, MHD_GNUTLS_CRD_CERTIFICATE, xcred);
return -1;
gnutls_credentials_set (*session,
GNUTLS_CRD_CERTIFICATE,
xcred);
return 0;
}
int
teardown_session (MHD_gtls_session_t session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert,
MHD_gtls_cert_credentials_t xcred)
teardown_session (gnutls_session_t session,
gnutls_datum_t * key,
gnutls_datum_t * cert,
gnutls_certificate_credentials_t xcred)
{
MHD_gtls_free_datum_m (key, free);
MHD_gtls_free_datum_m (cert, free);
MHD__gnutls_deinit (session);
MHD__gnutls_certificate_free_credentials (xcred);
free (key->data);
key->data = NULL;
key->size = 0;
free (cert->data);
cert->data = NULL;
cert->size = 0;
gnutls_deinit (session);
gnutls_certificate_free_credentials (xcred);
return 0;
}
+9 -9
View File
@@ -26,7 +26,7 @@
#include <curl/curl.h>
#include <sys/stat.h>
#include <limits.h>
#include "gnutls.h"
#include <gnutls/gnutls.h>
/* this enables verbos CURL version checking */
#define DEBUG_HTTPS_TEST 0
@@ -99,16 +99,16 @@ setup_testcase (struct MHD_Daemon **d, int daemon_flags, va_list arg_list);
void teardown_testcase (struct MHD_Daemon *d);
int
setup_session (MHD_gtls_session_t * session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert,
MHD_gtls_cert_credentials_t * xcred);
setup_session (gnutls_session_t * session,
gnutls_datum_t * key,
gnutls_datum_t * cert,
gnutls_certificate_credentials_t * xcred);
int
teardown_session (MHD_gtls_session_t session,
MHD_gnutls_datum_t * key,
MHD_gnutls_datum_t * cert,
MHD_gtls_cert_credentials_t xcred);
teardown_session (gnutls_session_t session,
gnutls_datum_t * key,
gnutls_datum_t * cert,
gnutls_certificate_credentials_t xcred);
int
test_wrap (char *test_name, int
+1 -3
View File
@@ -29,13 +29,11 @@
#include "platform.h"
#include "microhttpd.h"
#include <sys/stat.h>
#include <limits.h>
#include "gnutls.h"
#include <curl/curl.h>
#include "tls_test_common.h"
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];