From 23787d573fd2e4f31c1205f17c5d90fd5516a3fc Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 6 Aug 2013 06:16:15 +0200 Subject: [PATCH] Add disabled debug functions for GnuTLS. --- src/tlsproxy.c | 12 ++++++++++++ tests/client.c | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/tlsproxy.c b/src/tlsproxy.c index cfd240f..b4becea 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -364,6 +364,13 @@ static void print_usage(const char *argv) { fprintf(stderr, " WARNING: might be a security problem!\n"); } +#if 0 +static void log_function_gnutls(int level, const char *string) { + (void)level; + fprintf(stderr, " => %s", string); +} +#endif + static void initialize_gnutls(void) { int result; /* Recent versions of GnuTLS automatically initialize the cryptography layer @@ -391,6 +398,11 @@ static void initialize_gnutls(void) { result = gnutls_global_init(); GNUTLS_ERROR_EXIT(result, "gnutls_global_init()"); +#if 0 + gnutls_global_set_log_level(10); + gnutls_global_set_log_function(log_function_gnutls); +#endif + /* Setup GnuTLS cipher suites. */ result = gnutls_priority_init(&global_tls_priority_cache, "NORMAL", NULL); GNUTLS_ERROR_EXIT(result, "gnutls_priority_init()"); diff --git a/tests/client.c b/tests/client.c index 41ddf5d..028189a 100644 --- a/tests/client.c +++ b/tests/client.c @@ -39,6 +39,12 @@ static int fdopen_read_write(int socket, FILE **read_fd, FILE **write_fd); static int connect_to_host(const char *hostname, const char *port); static int read_http_request(FILE *client_fd, char *request, size_t length); +#if 0 +static void log_function_gnutls(int level, const char *string) { + (void)level; + fprintf(stderr, " => %s", string); +} +#endif int main (int argc, char *argv[]) { int result, response; @@ -65,6 +71,11 @@ int main (int argc, char *argv[]) { gnutls_global_init(); gnutls_certificate_allocate_credentials(&xcred); +#if 0 + gnutls_global_set_log_level(10); + gnutls_global_set_log_function(log_function_gnutls); +#endif + gnutls_certificate_set_x509_trust_file(xcred, argv[1], GNUTLS_X509_FMT_PEM); -- 2.43.2