From f2361e6d582d4343d71d294ed1da654afe7750ee Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 2 Oct 2014 17:33:57 +0200 Subject: First changes for future use of NTBTLS. * configure.ac (NEED_NTBTLS_ABI, NEED_NTBTLS_VERSION): New. (HTTP_USE_NTBTLS): New. Prefer over GNUTLS. * m4/ntbtls.m4: New. * m4/Makefile.am (EXTRA_DIST): Add new file. * common/http.c: Add conditionals to eventually use NTBTLS. -- This is only the configure stuff. If you have NTBTLS installed GNUTLS will not be used but there won't be any https support either :-(. This patch is used to have a real world test bench for the forthcoming library. --- common/t-http.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'common/t-http.c') diff --git a/common/t-http.c b/common/t-http.c index 9872f9a74..e031ef943 100644 --- a/common/t-http.c +++ b/common/t-http.c @@ -42,7 +42,9 @@ #include "http.h" -#ifdef HTTP_USE_GNUTLS +#if HTTP_USE_NTBTLS +# include +#elif HTTP_USE_GNUTLS # include /* For init, logging, and deinit. */ #endif /*HTTP_USE_GNUTLS*/ @@ -97,6 +99,7 @@ static int no_verify; +#if HTTP_USE_GNUTLS static gpg_error_t verify_callback (http_t hd, http_session_t session, int reserved) { @@ -104,14 +107,15 @@ verify_callback (http_t hd, http_session_t session, int reserved) (void)reserved; return no_verify? 0 : http_verify_server_credentials (session); } +#endif - +#if HTTP_USE_GNUTLS static void my_gnutls_log (int level, const char *text) { fprintf (stderr, "gnutls:L%d: %s", level, text); } - +#endif /* Prepend FNAME with the srcdir environment variable's value and return an allocated filename. */ @@ -233,7 +237,14 @@ main (int argc, char **argv) if (!cafile) cafile = prepend_srcdir ("tls-ca.pem"); -#ifdef HTTP_USE_GNUTLS +#if HTTP_USE_NTBTLS + + (void)err; + + ntbtls_set_debug (tls_dbg, NULL, NULL); + +#elif HTTP_USE_GNUTLS + rc = gnutls_global_init (); if (rc) log_error ("gnutls_global_init failed: %s\n", gnutls_strerror (rc)); -- cgit v1.2.3