1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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.
This commit is contained in:
Daniel Stenberg 2014-07-31 12:19:51 +02:00
parent 028a408d57
commit a439e438f3
15 changed files with 33 additions and 15 deletions

View File

@ -604,6 +604,7 @@ CURLSSH_AUTH_KEYBOARD 7.16.1
CURLSSH_AUTH_NONE 7.16.1 CURLSSH_AUTH_NONE 7.16.1
CURLSSH_AUTH_PASSWORD 7.16.1 CURLSSH_AUTH_PASSWORD 7.16.1
CURLSSH_AUTH_PUBLICKEY 7.16.1 CURLSSH_AUTH_PUBLICKEY 7.16.1
CURLSSLBACKEND_AXTLS 7.38.0
CURLSSLBACKEND_CYASSL 7.34.0 CURLSSLBACKEND_CYASSL 7.34.0
CURLSSLBACKEND_DARWINSSL 7.34.0 CURLSSLBACKEND_DARWINSSL 7.34.0
CURLSSLBACKEND_GNUTLS 7.34.0 CURLSSLBACKEND_GNUTLS 7.34.0

View File

@ -2033,7 +2033,8 @@ typedef enum {
CURLSSLBACKEND_POLARSSL = 6, CURLSSLBACKEND_POLARSSL = 6,
CURLSSLBACKEND_CYASSL = 7, CURLSSLBACKEND_CYASSL = 7,
CURLSSLBACKEND_SCHANNEL = 8, CURLSSLBACKEND_SCHANNEL = 8,
CURLSSLBACKEND_DARWINSSL = 9 CURLSSLBACKEND_DARWINSSL = 9,
CURLSSLBACKEND_AXTLS = 10
} curl_sslbackend; } curl_sslbackend;
/* Information about the SSL library used and the respective internal SSL /* Information about the SSL library used and the respective internal SSL

View File

@ -285,6 +285,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
struct curl_tlssessioninfo *tsi = &data->tsi; struct curl_tlssessioninfo *tsi = &data->tsi;
struct connectdata *conn = data->easy_conn; struct connectdata *conn = data->easy_conn;
unsigned int sockindex = 0; unsigned int sockindex = 0;
void *internals = NULL;
*tsip = tsi; *tsip = tsi;
tsi->backend = CURLSSLBACKEND_NONE; tsi->backend = CURLSSLBACKEND_NONE;
@ -303,25 +304,24 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
/* Return the TLS session information from the relevant backend */ /* Return the TLS session information from the relevant backend */
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
tsi->backend = CURLSSLBACKEND_OPENSSL; internals = conn->ssl[sockindex].ctx;
tsi->internals = conn->ssl[sockindex].ctx;
#endif #endif
#ifdef USE_GNUTLS #ifdef USE_GNUTLS
tsi->backend = CURLSSLBACKEND_GNUTLS; internals = conn->ssl[sockindex].session;
tsi->internals = conn->ssl[sockindex].session;
#endif #endif
#ifdef USE_NSS #ifdef USE_NSS
tsi->backend = CURLSSLBACKEND_NSS; internals = conn->ssl[sockindex].handle;
tsi->internals = conn->ssl[sockindex].handle;
#endif #endif
#ifdef USE_QSOSSL #ifdef USE_QSOSSL
tsi->backend = CURLSSLBACKEND_QSOSSL; internals = conn->ssl[sockindex].handle;
tsi->internals = conn->ssl[sockindex].handle;
#endif #endif
#ifdef USE_GSKIT #ifdef USE_GSKIT
tsi->backend = CURLSSLBACKEND_GSKIT; internals = conn->ssl[sockindex].handle;
tsi->internals = conn->ssl[sockindex].handle;
#endif #endif
if(internals) {
tsi->backend = Curl_ssl_backend();
tsi->internals = internals;
}
/* NOTE: For other SSL backends, it is not immediately clear what data /* NOTE: For other SSL backends, it is not immediately clear what data
to return from 'struct ssl_connect_data'; thus, for now we keep the to return from 'struct ssl_connect_data'; thus, for now we keep the
backend as CURLSSLBACKEND_NONE in those cases, which should be backend as CURLSSLBACKEND_NONE in those cases, which should be

View File

@ -66,7 +66,7 @@ int Curl_axtls_random(struct SessionHandle *data,
#define curlssl_check_cxn(x) Curl_axtls_check_cxn(x) #define curlssl_check_cxn(x) Curl_axtls_check_cxn(x)
#define curlssl_data_pending(x,y) (x=x, y=y, 0) #define curlssl_data_pending(x,y) (x=x, y=y, 0)
#define curlssl_random(x,y,z) Curl_axtls_random(x,y,z) #define curlssl_random(x,y,z) Curl_axtls_random(x,y,z)
#define CURL_SSL_BACKEND CURLSSLBACKEND_AXTLS
#endif /* USE_AXTLS */ #endif /* USE_AXTLS */
#endif /* HEADER_CURL_AXTLS_H */ #endif /* HEADER_CURL_AXTLS_H */

View File

@ -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_data_pending(x,y) Curl_darwinssl_data_pending(x, y)
#define curlssl_random(x,y,z) Curl_darwinssl_random(y,z) #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 curlssl_md5sum(a,b,c,d) Curl_darwinssl_md5sum(a,b,c,d)
#define CURL_SSL_BACKEND CURLSSLBACKEND_DARWINSSL
#endif /* USE_DARWINSSL */ #endif /* USE_DARWINSSL */
#endif /* HEADER_CURL_DARWINSSL_H */ #endif /* HEADER_CURL_DARWINSSL_H */

View File

@ -8,7 +8,7 @@
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al. * Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al.
* Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2012 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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_version Curl_schannel_version
#define curlssl_check_cxn(x) (x=x, -1) #define curlssl_check_cxn(x) (x=x, -1)
#define curlssl_data_pending Curl_schannel_data_pending #define curlssl_data_pending Curl_schannel_data_pending
#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL
#endif /* USE_SCHANNEL */ #endif /* USE_SCHANNEL */
#endif /* HEADER_CURL_SCHANNEL_H */ #endif /* HEADER_CURL_SCHANNEL_H */

View File

@ -63,6 +63,7 @@ int Curl_cyassl_random(struct SessionHandle *data,
#define curlssl_check_cxn(x) (x=x, -1) #define curlssl_check_cxn(x) (x=x, -1)
#define curlssl_data_pending(x,y) Curl_cyassl_data_pending(x,y) #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 curlssl_random(x,y,z) Curl_cyassl_random(x,y,z)
#define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL
#endif /* USE_CYASSL */ #endif /* USE_CYASSL */
#endif /* HEADER_CURL_CYASSL_H */ #endif /* HEADER_CURL_CYASSL_H */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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_version Curl_gskit_version
#define curlssl_check_cxn(x) Curl_gskit_check_cxn(x) #define curlssl_check_cxn(x) Curl_gskit_check_cxn(x)
#define curlssl_data_pending(x,y) 0 #define curlssl_data_pending(x,y) 0
#define CURL_SSL_BACKEND CURLSSLBACKEND_GSKIT
#endif /* USE_GSKIT */ #endif /* USE_GSKIT */
#endif /* HEADER_CURL_GSKIT_H */ #endif /* HEADER_CURL_GSKIT_H */

View File

@ -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_data_pending(x,y) (x=x, y=y, 0)
#define curlssl_random(x,y,z) Curl_gtls_random(x,y,z) #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_md5sum(a,b,c,d) Curl_gtls_md5sum(a,b,c,d)
#define CURL_SSL_BACKEND CURLSSLBACKEND_GNUTLS
#endif /* USE_GNUTLS */ #endif /* USE_GNUTLS */
#endif /* HEADER_CURL_GTLS_H */ #endif /* HEADER_CURL_GTLS_H */

View File

@ -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_data_pending(x,y) (x=x, y=y, 0)
#define curlssl_random(x,y,z) Curl_nss_random(x,y,z) #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_md5sum(a,b,c,d) Curl_nss_md5sum(a,b,c,d)
#define CURL_SSL_BACKEND CURLSSLBACKEND_NSS
#endif /* USE_NSS */ #endif /* USE_NSS */
#endif /* HEADER_CURL_NSSG_H */ #endif /* HEADER_CURL_NSSG_H */

View File

@ -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_data_pending(x,y) Curl_ossl_data_pending(x,y)
#define curlssl_random(x,y,z) Curl_ossl_random(x,y,z) #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 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" #define DEFAULT_CIPHER_SELECTION "ALL!EXPORT!EXPORT40!EXPORT56!aNULL!LOW!RC4"

View File

@ -62,6 +62,7 @@ int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex);
#define curlssl_version Curl_polarssl_version #define curlssl_version Curl_polarssl_version
#define curlssl_check_cxn(x) (x=x, -1) #define curlssl_check_cxn(x) (x=x, -1)
#define curlssl_data_pending(x,y) (x=x, y=y, 0) #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! /* This might cause libcurl to use a weeker random!
TODO: implement proper use of Polarssl's CTR-DRBG or HMAC-DRBG and use that TODO: implement proper use of Polarssl's CTR-DRBG or HMAC-DRBG and use that

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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_version Curl_qsossl_version
#define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x) #define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x)
#define curlssl_data_pending(x,y) 0 #define curlssl_data_pending(x,y) 0
#define CURL_SSL_BACKEND CURLSSLBACKEND_QSOSSL
#endif /* USE_QSOSSL */ #endif /* USE_QSOSSL */
#endif /* HEADER_CURL_QSSL_H */ #endif /* HEADER_CURL_QSSL_H */

View File

@ -697,4 +697,9 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */
} }
#endif #endif
int Curl_ssl_backend(void)
{
return (int)CURL_SSL_BACKEND;
}
#endif /* USE_SSL */ #endif /* USE_SSL */

View File

@ -96,6 +96,7 @@ void Curl_ssl_md5sum(unsigned char *tmp, /* input */
size_t tmplen, size_t tmplen,
unsigned char *md5sum, /* output */ unsigned char *md5sum, /* output */
size_t md5len); size_t md5len);
int Curl_ssl_backend(void);
#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ #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_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN
#define Curl_ssl_kill_session(x) Curl_nop_stmt #define Curl_ssl_kill_session(x) Curl_nop_stmt
#define Curl_ssl_random(x,y,z) CURLE_NOT_BUILT_IN #define Curl_ssl_random(x,y,z) CURLE_NOT_BUILT_IN
#define CURL_SSL_BACKEND CURLSSLBACKEND_NONE
#endif #endif
#endif /* HEADER_CURL_VTLS_H */ #endif /* HEADER_CURL_VTLS_H */