From 8bb3443a210e9aed888055b8a3d39646ca234c49 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 17 Jan 2015 16:03:49 +0000 Subject: vtls: Separate the SSL backend definition from the API setup Slight code cleanup as the SSL backend #define is mixed up with the API function setup. --- lib/vtls/axtls.h | 6 ++++-- lib/vtls/curl_darwinssl.h | 6 ++++-- lib/vtls/curl_schannel.h | 6 ++++-- lib/vtls/cyassl.h | 6 ++++-- lib/vtls/gskit.h | 6 ++++-- lib/vtls/gtls.h | 4 +++- lib/vtls/nssg.h | 4 +++- lib/vtls/openssl.h | 6 ++++-- lib/vtls/polarssl.h | 6 ++++-- lib/vtls/vtls.h | 4 +++- 10 files changed, 37 insertions(+), 17 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/axtls.h b/lib/vtls/axtls.h index 62b4ab0e6..da8e16487 100644 --- a/lib/vtls/axtls.h +++ b/lib/vtls/axtls.h @@ -8,7 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2010, DirecTV, Contact: Eric Hu - * Copyright (C) 2010 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 2010 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -50,6 +50,9 @@ int Curl_axtls_random(struct SessionHandle *data, unsigned char *entropy, size_t length); +/* Set the API backend definition to axTLS */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_AXTLS + /* API setup for axTLS */ #define curlssl_init Curl_axtls_init #define curlssl_cleanup Curl_axtls_cleanup @@ -66,7 +69,6 @@ int Curl_axtls_random(struct SessionHandle *data, #define curlssl_check_cxn(x) Curl_axtls_check_cxn(x) #define curlssl_data_pending(x,y) ((void)x, (void)y, 0) #define curlssl_random(x,y,z) Curl_axtls_random(x,y,z) -#define CURL_SSL_BACKEND CURLSSLBACKEND_AXTLS #endif /* USE_AXTLS */ #endif /* HEADER_CURL_AXTLS_H */ diff --git a/lib/vtls/curl_darwinssl.h b/lib/vtls/curl_darwinssl.h index 7c80edfc6..656f07ca0 100644 --- a/lib/vtls/curl_darwinssl.h +++ b/lib/vtls/curl_darwinssl.h @@ -8,7 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2012 - 2014, Nick Zitzmann, . - * Copyright (C) 2012 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 2012 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -52,6 +52,9 @@ void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum, /* output */ size_t md5len); +/* Set the API backend definition to SecureTransport */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_DARWINSSL + /* API setup for SecureTransport */ #define curlssl_init() (1) #define curlssl_cleanup() Curl_nop_stmt @@ -69,7 +72,6 @@ void Curl_darwinssl_md5sum(unsigned char *tmp, /* input */ #define curlssl_data_pending(x,y) Curl_darwinssl_data_pending(x, y) #define curlssl_random(x,y,z) ((void)x, Curl_darwinssl_random(y,z)) #define curlssl_md5sum(a,b,c,d) Curl_darwinssl_md5sum(a,b,c,d) -#define CURL_SSL_BACKEND CURLSSLBACKEND_DARWINSSL #endif /* USE_DARWINSSL */ #endif /* HEADER_CURL_DARWINSSL_H */ diff --git a/lib/vtls/curl_schannel.h b/lib/vtls/curl_schannel.h index 11e83f9e5..e019a8606 100644 --- a/lib/vtls/curl_schannel.h +++ b/lib/vtls/curl_schannel.h @@ -8,7 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2012, Marc Hoersken, , et al. - * Copyright (C) 2012 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 2012 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -93,6 +93,9 @@ size_t Curl_schannel_version(char *buffer, size_t size); int Curl_schannel_random(unsigned char *entropy, size_t length); +/* Set the API backend definition to Schannel */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL + /* API setup for Schannel */ #define curlssl_init Curl_schannel_init #define curlssl_cleanup Curl_schannel_cleanup @@ -108,7 +111,6 @@ int Curl_schannel_random(unsigned char *entropy, size_t length); #define curlssl_version Curl_schannel_version #define curlssl_check_cxn(x) ((void)x, -1) #define curlssl_data_pending Curl_schannel_data_pending -#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL #define curlssl_random(x,y,z) ((void)x, Curl_schannel_random(y,z)) #endif /* USE_SCHANNEL */ diff --git a/lib/vtls/cyassl.h b/lib/vtls/cyassl.h index a691e16c3..4d3ea544c 100644 --- a/lib/vtls/cyassl.h +++ b/lib/vtls/cyassl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -47,6 +47,9 @@ int Curl_cyassl_random(struct SessionHandle *data, unsigned char *entropy, size_t length); +/* Set the API backend definition to Schannel */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL + /* API setup for CyaSSL */ #define curlssl_init Curl_cyassl_init #define curlssl_cleanup() Curl_nop_stmt @@ -63,7 +66,6 @@ int Curl_cyassl_random(struct SessionHandle *data, #define curlssl_check_cxn(x) ((void)x, -1) #define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y) #define curlssl_random(x,y,z) Curl_cyassl_random(x,y,z) -#define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL #endif /* USE_CYASSL */ #endif /* HEADER_CURL_CYASSL_H */ diff --git a/lib/vtls/gskit.h b/lib/vtls/gskit.h index baec82323..566eb281b 100644 --- a/lib/vtls/gskit.h +++ b/lib/vtls/gskit.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -42,6 +42,9 @@ int Curl_gskit_shutdown(struct connectdata * conn, int sockindex); size_t Curl_gskit_version(char * buffer, size_t size); int Curl_gskit_check_cxn(struct connectdata * cxn); +/* Set the API backend definition to GSKit */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_GSKIT + /* this backend supports CURLOPT_CERTINFO */ #define have_curlssl_certinfo 1 @@ -63,7 +66,6 @@ int Curl_gskit_check_cxn(struct connectdata * cxn); #define curlssl_check_cxn(x) Curl_gskit_check_cxn(x) #define curlssl_data_pending(x,y) 0 #define curlssl_random(x,y,z) -1 -#define CURL_SSL_BACKEND CURLSSLBACKEND_GSKIT #endif /* USE_GSKIT */ #endif /* HEADER_CURL_GSKIT_H */ diff --git a/lib/vtls/gtls.h b/lib/vtls/gtls.h index 356acce2f..a06a238c7 100644 --- a/lib/vtls/gtls.h +++ b/lib/vtls/gtls.h @@ -55,6 +55,9 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */ bool Curl_gtls_cert_status_request(void); +/* Set the API backend definition to GnuTLS */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_GNUTLS + /* API setup for GnuTLS */ #define curlssl_init Curl_gtls_init #define curlssl_cleanup Curl_gtls_cleanup @@ -73,7 +76,6 @@ bool Curl_gtls_cert_status_request(void); #define curlssl_random(x,y,z) Curl_gtls_random(x,y,z) #define curlssl_md5sum(a,b,c,d) Curl_gtls_md5sum(a,b,c,d) #define curlssl_cert_status_request() Curl_gtls_cert_status_request() -#define CURL_SSL_BACKEND CURLSSLBACKEND_GNUTLS #endif /* USE_GNUTLS */ #endif /* HEADER_CURL_GTLS_H */ diff --git a/lib/vtls/nssg.h b/lib/vtls/nssg.h index 318710628..9ab8f76ea 100644 --- a/lib/vtls/nssg.h +++ b/lib/vtls/nssg.h @@ -62,6 +62,9 @@ void Curl_nss_md5sum(unsigned char *tmp, /* input */ bool Curl_nss_cert_status_request(void); +/* Set the API backend definition to NSS */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_NSS + /* this backend supports the CAPATH option */ #define have_curlssl_ca_path 1 @@ -89,7 +92,6 @@ bool Curl_nss_cert_status_request(void); #define curlssl_random(x,y,z) Curl_nss_random(x,y,z) #define curlssl_md5sum(a,b,c,d) Curl_nss_md5sum(a,b,c,d) #define curlssl_cert_status_request() Curl_nss_cert_status_request() -#define CURL_SSL_BACKEND CURLSSLBACKEND_NSS #endif /* USE_NSS */ #endif /* HEADER_CURL_NSSG_H */ diff --git a/lib/vtls/openssl.h b/lib/vtls/openssl.h index 9f5f3a28f..9e9ba1e1e 100644 --- a/lib/vtls/openssl.h +++ b/lib/vtls/openssl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -73,6 +73,9 @@ void Curl_ossl_md5sum(unsigned char *tmp, /* input */ unsigned char *md5sum /* output */, size_t unused); +/* Set the API backend definition to OpenSSL */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_OPENSSL + /* this backend supports the CAPATH option */ #define have_curlssl_ca_path 1 @@ -99,7 +102,6 @@ void Curl_ossl_md5sum(unsigned char *tmp, /* input */ #define curlssl_data_pending(x,y) Curl_ossl_data_pending(x,y) #define curlssl_random(x,y,z) Curl_ossl_random(x,y,z) #define curlssl_md5sum(a,b,c,d) Curl_ossl_md5sum(a,b,c,d) -#define CURL_SSL_BACKEND CURLSSLBACKEND_OPENSSL #define DEFAULT_CIPHER_SELECTION "ALL!EXPORT!EXPORT40!EXPORT56!aNULL!LOW!RC4" diff --git a/lib/vtls/polarssl.h b/lib/vtls/polarssl.h index 57dfb6763..4d34f5f06 100644 --- a/lib/vtls/polarssl.h +++ b/lib/vtls/polarssl.h @@ -8,7 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2010, Hoi-Ho Chan, - * Copyright (C) 2012 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 2012 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -48,6 +48,9 @@ void Curl_polarssl_session_free(void *ptr); size_t Curl_polarssl_version(char *buffer, size_t size); int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); +/* Set the API backend definition to PolarSSL */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_POLARSSL + /* this backend supports the CAPATH option */ #define have_curlssl_ca_path 1 @@ -66,7 +69,6 @@ int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); #define curlssl_version Curl_polarssl_version #define curlssl_check_cxn(x) ((void)x, -1) #define curlssl_data_pending(x,y) ((void)x, (void)y, 0) -#define CURL_SSL_BACKEND CURLSSLBACKEND_POLARSSL /* This might cause libcurl to use a weeker random! TODO: implement proper use of Polarssl's CTR-DRBG or HMAC-DRBG and use that diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h index 71c101920..96321ec98 100644 --- a/lib/vtls/vtls.h +++ b/lib/vtls/vtls.h @@ -121,6 +121,9 @@ bool Curl_ssl_cert_status_request(void); #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ #else +/* Set the API backend definition to none */ +#define CURL_SSL_BACKEND CURLSSLBACKEND_NONE + /* When SSL support is not present, just define away these function calls */ #define Curl_ssl_init() 1 #define Curl_ssl_cleanup() Curl_nop_stmt @@ -141,7 +144,6 @@ bool Curl_ssl_cert_status_request(void); #define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN #define Curl_ssl_kill_session(x) Curl_nop_stmt #define Curl_ssl_random(x,y,z) ((void)x, CURLE_NOT_BUILT_IN) -#define CURL_SSL_BACKEND CURLSSLBACKEND_NONE #define Curl_ssl_cert_status_request() FALSE #endif -- cgit v1.2.3