X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Ftlsproxy.c;h=b4beceaa2cd25f115196fad43a5737754494aa09;hb=23787d573fd2e4f31c1205f17c5d90fd5516a3fc;hp=0257d6788f79d121832a04117e67b98a95ce84ad;hpb=f3ca90e517a9ae54e831e5a5b91fcc2afb9df5bf;p=tlsproxy%2Ftlsproxy.git diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 0257d67..b4becea 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -32,9 +32,11 @@ #include #include +#if GNUTLS_VERSION_NUMBER <= 0x020b00 /* Necessary for GnuTLS when used with threads. */ #include GCRY_THREAD_OPTION_PTHREAD_IMPL; +#endif /* Size of ringbuffer. */ @@ -256,7 +258,7 @@ static void parse_arguments(int argc, char **argv) { /* Default values. */ thread_count = 10; #ifdef DEBUG - global_log_level = LOG_DEBUG_LEVEL; + global_log_level = LOG_DEBUG1_LEVEL; #else global_log_level = LOG_WARNING_LEVEL; #endif @@ -362,8 +364,18 @@ 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 + * in gnutls_global_init(). */ +#if GNUTLS_VERSION_NUMBER <= 0x020b00 gcry_error_t error; /* Thread safe setup. Must be called before gnutls_global_init(). */ @@ -380,11 +392,17 @@ static void initialize_gnutls(void) { gcry_strerror(error)); exit(EXIT_FAILURE); } +#endif /* Initialize GnuTLS. */ 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()");