From a439e438f3662f12c003bda3c8cc3f6de09b4da0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 31 Jul 2014 12:19:51 +0200 Subject: ssl: generalize how the ssl backend identifier is set Each backend now defines CURL_SSL_BACKEND accordingly. Added the *AXTLS one which was missing previously. --- lib/vtls/axtls.h | 2 +- lib/vtls/curl_darwinssl.h | 1 + lib/vtls/curl_schannel.h | 3 ++- lib/vtls/cyassl.h | 1 + lib/vtls/gskit.h | 3 ++- lib/vtls/gtls.h | 1 + lib/vtls/nssg.h | 1 + lib/vtls/openssl.h | 1 + lib/vtls/polarssl.h | 1 + lib/vtls/qssl.h | 3 ++- lib/vtls/vtls.c | 5 +++++ lib/vtls/vtls.h | 2 ++ 12 files changed, 20 insertions(+), 4 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/axtls.h b/lib/vtls/axtls.h index 55247b8ec..0459cf228 100644 --- a/lib/vtls/axtls.h +++ b/lib/vtls/axtls.h @@ -66,7 +66,7 @@ int Curl_axtls_random(struct SessionHandle *data, #define curlssl_check_cxn(x) Curl_axtls_check_cxn(x) #define curlssl_data_pending(x,y) (x=x, y=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 25ad3d419..f5c03d838 100644 --- a/lib/vtls/curl_darwinssl.h +++ b/lib/vtls/curl_darwinssl.h @@ -71,6 +71,7 @@ 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) 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 b82c734a0..e9333179e 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, Daniel Stenberg, , et al. + * Copyright (C) 2012 - 2014, 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 @@ -128,5 +128,6 @@ size_t Curl_schannel_version(char *buffer, size_t size); #define curlssl_version Curl_schannel_version #define curlssl_check_cxn(x) (x=x, -1) #define curlssl_data_pending Curl_schannel_data_pending +#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL #endif /* USE_SCHANNEL */ #endif /* HEADER_CURL_SCHANNEL_H */ diff --git a/lib/vtls/cyassl.h b/lib/vtls/cyassl.h index 78cba2ff8..b10b607d7 100644 --- a/lib/vtls/cyassl.h +++ b/lib/vtls/cyassl.h @@ -63,6 +63,7 @@ int Curl_cyassl_random(struct SessionHandle *data, #define curlssl_check_cxn(x) (x=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 7c50452ad..a4caa6f23 100644 --- a/lib/vtls/gskit.h +++ b/lib/vtls/gskit.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2014, 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 @@ -59,6 +59,7 @@ int Curl_gskit_check_cxn(struct connectdata * cxn); #define curlssl_version Curl_gskit_version #define curlssl_check_cxn(x) Curl_gskit_check_cxn(x) #define curlssl_data_pending(x,y) 0 +#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 9f99042cf..cd6152ca1 100644 --- a/lib/vtls/gtls.h +++ b/lib/vtls/gtls.h @@ -73,6 +73,7 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */ #define curlssl_data_pending(x,y) (x=x, y=y, 0) #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 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 d441de9d9..311f873d7 100644 --- a/lib/vtls/nssg.h +++ b/lib/vtls/nssg.h @@ -83,6 +83,7 @@ void Curl_nss_md5sum(unsigned char *tmp, /* input */ #define curlssl_data_pending(x,y) (x=x, y=y, 0) #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 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 fecad7f54..1a55ffc2f 100644 --- a/lib/vtls/openssl.h +++ b/lib/vtls/openssl.h @@ -93,6 +93,7 @@ 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 6c5b872c8..9ab7e47e5 100644 --- a/lib/vtls/polarssl.h +++ b/lib/vtls/polarssl.h @@ -62,6 +62,7 @@ int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); #define curlssl_version Curl_polarssl_version #define curlssl_check_cxn(x) (x=x, -1) #define curlssl_data_pending(x,y) (x=x, y=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/qssl.h b/lib/vtls/qssl.h index c0ce15508..9764eecbe 100644 --- a/lib/vtls/qssl.h +++ b/lib/vtls/qssl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2014, 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 @@ -56,6 +56,7 @@ int Curl_qsossl_check_cxn(struct connectdata * cxn); #define curlssl_version Curl_qsossl_version #define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x) #define curlssl_data_pending(x,y) 0 +#define CURL_SSL_BACKEND CURLSSLBACKEND_QSOSSL #endif /* USE_QSOSSL */ #endif /* HEADER_CURL_QSSL_H */ diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 3c7bc9865..e418955bd 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -697,4 +697,9 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */ } #endif +int Curl_ssl_backend(void) +{ + return (int)CURL_SSL_BACKEND; +} + #endif /* USE_SSL */ diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h index 72c512d50..e3fa20b7a 100644 --- a/lib/vtls/vtls.h +++ b/lib/vtls/vtls.h @@ -96,6 +96,7 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */ size_t tmplen, unsigned char *md5sum, /* output */ size_t md5len); +int Curl_ssl_backend(void); #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ @@ -124,6 +125,7 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */ #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) CURLE_NOT_BUILT_IN +#define CURL_SSL_BACKEND CURLSSLBACKEND_NONE #endif #endif /* HEADER_CURL_VTLS_H */ -- cgit v1.2.3