From: Johannes Schindelin Date: Fri, 23 Jun 2017 22:25:29 +0000 (+0200) Subject: vtls: fold the backend ID into the Curl_ssl structure X-Git-Tag: curl-7_56_0~172 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a53bda35e9a2acf4f2432b2d1b2d44497d68971e;p=curl vtls: fold the backend ID into the Curl_ssl structure Signed-off-by: Johannes Schindelin --- diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c index 9b08d4981..65f3b2409 100644 --- a/lib/vtls/axtls.c +++ b/lib/vtls/axtls.c @@ -703,6 +703,7 @@ static void *Curl_axtls_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_axtls = { "axtls", /* name */ + CURLSSLBACKEND_AXTLS, 0, /* have_ca_path */ 0, /* have_certinfo */ diff --git a/lib/vtls/axtls.h b/lib/vtls/axtls.h index 63adf8fc5..3f1e129c2 100644 --- a/lib/vtls/axtls.h +++ b/lib/vtls/axtls.h @@ -29,9 +29,6 @@ extern const struct Curl_ssl Curl_ssl_axtls; -/* Set the API backend definition to axTLS */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_AXTLS - #endif /* USE_AXTLS */ #endif /* HEADER_CURL_AXTLS_H */ diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c index 6385f8960..01ed678df 100644 --- a/lib/vtls/cyassl.c +++ b/lib/vtls/cyassl.c @@ -979,6 +979,7 @@ static void *Curl_cyassl_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_cyassl = { "cyassl", /* name */ + CURLSSLBACKEND_CYASSL, 0, /* have_ca_path */ 0, /* have_certinfo */ diff --git a/lib/vtls/cyassl.h b/lib/vtls/cyassl.h index 8a6771e2a..01e11cc23 100644 --- a/lib/vtls/cyassl.h +++ b/lib/vtls/cyassl.h @@ -27,8 +27,5 @@ extern const struct Curl_ssl Curl_ssl_cyassl; -/* Set the API backend definition to CyaSSL */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_CYASSL - #endif /* USE_CYASSL */ #endif /* HEADER_CURL_CYASSL_H */ diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c index c0e71ccbe..f65e93d86 100644 --- a/lib/vtls/darwinssl.c +++ b/lib/vtls/darwinssl.c @@ -2891,6 +2891,7 @@ static void *Curl_darwinssl_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_darwinssl = { "darwinssl", /* name */ + CURLSSLBACKEND_DARWINSSL, 0, /* have_ca_path */ 0, /* have_certinfo */ diff --git a/lib/vtls/darwinssl.h b/lib/vtls/darwinssl.h index aace2946d..23c7f705c 100644 --- a/lib/vtls/darwinssl.h +++ b/lib/vtls/darwinssl.h @@ -28,8 +28,5 @@ extern const struct Curl_ssl Curl_ssl_darwinssl; -/* Set the API backend definition to SecureTransport */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_DARWINSSL - #endif /* USE_DARWINSSL */ #endif /* HEADER_CURL_DARWINSSL_H */ diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c index 5d6bb0c8f..9d5568cf9 100644 --- a/lib/vtls/gskit.c +++ b/lib/vtls/gskit.c @@ -1354,6 +1354,7 @@ static void *Curl_gskit_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_gskit = { "gskit", /* name */ + CURLSSLBACKEND_GSKIT, 0, /* have_ca_path */ 1, /* have_certinfo */ diff --git a/lib/vtls/gskit.h b/lib/vtls/gskit.h index 91e55987c..466ee4d9d 100644 --- a/lib/vtls/gskit.h +++ b/lib/vtls/gskit.h @@ -33,9 +33,6 @@ extern const struct Curl_ssl Curl_ssl_gskit; -/* Set the API backend definition to GSKit */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_GSKIT - #endif /* USE_GSKIT */ #endif /* HEADER_CURL_GSKIT_H */ diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 6364a61cf..f63f5460f 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -1807,6 +1807,7 @@ static void *Curl_gtls_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_gnutls = { "gnutls", /* name */ + CURLSSLBACKEND_GNUTLS, 1, /* have_ca_path */ 1, /* have_certinfo */ @@ -1829,7 +1830,7 @@ const struct Curl_ssl Curl_ssl_gnutls = { Curl_gtls_get_internals, /* get_internals */ Curl_gtls_close, /* close */ Curl_none_close_all, /* close_all */ - Curl_glts_session_free, /* session_free */ + Curl_gtls_session_free, /* session_free */ Curl_none_set_engine, /* set_engine */ Curl_none_set_engine_default, /* set_engine_default */ Curl_none_engines_list, /* engines_list */ diff --git a/lib/vtls/gtls.h b/lib/vtls/gtls.h index 0dcf13a56..780fc109d 100644 --- a/lib/vtls/gtls.h +++ b/lib/vtls/gtls.h @@ -30,8 +30,5 @@ extern const struct Curl_ssl Curl_ssl_gnutls; -/* Set the API backend definition to GnuTLS */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_GNUTLS - #endif /* USE_GNUTLS */ #endif /* HEADER_CURL_GTLS_H */ diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index a46fb5fdc..61eee09bc 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -1040,6 +1040,7 @@ static void *Curl_mbedtls_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_mbedtls = { "mbedtls", /* name */ + CURLSSLBACKEND_MBEDTLS, 0, /* have_ca_path */ 0, /* have_certinfo */ diff --git a/lib/vtls/mbedtls.h b/lib/vtls/mbedtls.h index 842b4d50f..4a938605b 100644 --- a/lib/vtls/mbedtls.h +++ b/lib/vtls/mbedtls.h @@ -28,7 +28,5 @@ extern const struct Curl_ssl Curl_ssl_mbedtls; -#define CURL_SSL_BACKEND CURLSSLBACKEND_MBEDTLS - #endif /* USE_MBEDTLS */ #endif /* HEADER_CURL_MBEDTLS_H */ diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index 2d132f5b1..14dd15423 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -2344,6 +2344,7 @@ static void *Curl_nss_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_nss = { "nss", /* name */ + CURLSSLBACKEND_NSS, 1, /* have_ca_path */ 1, /* have_certinfo */ diff --git a/lib/vtls/nssg.h b/lib/vtls/nssg.h index 5c3015a8b..41e51b021 100644 --- a/lib/vtls/nssg.h +++ b/lib/vtls/nssg.h @@ -35,8 +35,5 @@ CURLcode Curl_nss_force_init(struct Curl_easy *data); extern const struct Curl_ssl Curl_ssl_nss; -/* Set the API backend definition to NSS */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_NSS - #endif /* USE_NSS */ #endif /* HEADER_CURL_NSSG_H */ diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index bc5475e53..a96604dd6 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -3417,6 +3417,7 @@ static void *Curl_ossl_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_openssl = { "openssl", /* name */ + CURLSSLBACKEND_OPENSSL, 1, /* have_ca_path */ 1, /* have_certinfo */ diff --git a/lib/vtls/openssl.h b/lib/vtls/openssl.h index 030addac6..114dc4bae 100644 --- a/lib/vtls/openssl.h +++ b/lib/vtls/openssl.h @@ -33,8 +33,5 @@ extern const struct Curl_ssl Curl_ssl_openssl; -/* Set the API backend definition to OpenSSL */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_OPENSSL - #endif /* USE_OPENSSL */ #endif /* HEADER_CURL_SSLUSE_H */ diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c index 7d1b3b1fd..ae3f6f814 100644 --- a/lib/vtls/polarssl.c +++ b/lib/vtls/polarssl.c @@ -902,6 +902,7 @@ static void *Curl_polarssl_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_polarssl = { "polarssl", /* name */ + CURLSSLBACKEND_POLARSSL, 1, /* have_ca_path */ 0, /* have_certinfo */ diff --git a/lib/vtls/polarssl.h b/lib/vtls/polarssl.h index ce534fa53..23c3636ee 100644 --- a/lib/vtls/polarssl.h +++ b/lib/vtls/polarssl.h @@ -28,8 +28,5 @@ extern const struct Curl_ssl Curl_ssl_polarssl; -/* Set the API backend definition to PolarSSL */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_POLARSSL - #endif /* USE_POLARSSL */ #endif /* HEADER_CURL_POLARSSL_H */ diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index d3f44018b..b1cd60e11 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -1817,6 +1817,7 @@ static void *Curl_schannel_get_internals(struct ssl_connect_data *connssl, const struct Curl_ssl Curl_ssl_schannel = { "schannel", /* name */ + CURLSSLBACKEND_SCHANNEL, 0, /* have_ca_path */ 1, /* have_certinfo */ diff --git a/lib/vtls/schannel.h b/lib/vtls/schannel.h index 4a254df4b..932103da4 100644 --- a/lib/vtls/schannel.h +++ b/lib/vtls/schannel.h @@ -30,8 +30,5 @@ extern const struct Curl_ssl Curl_ssl_schannel; -/* Set the API backend definition to Schannel */ -#define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL - #endif /* USE_SCHANNEL */ #endif /* HEADER_CURL_SCHANNEL_H */ diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index bc72ad31e..3e52220fc 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -132,7 +132,11 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc) int Curl_ssl_backend(void) { - return (int)CURL_SSL_BACKEND; +#ifdef USE_SSL + return Curl_ssl->id; +#else + return (int)CURLSSLBACKEND_NONE; +#endif } #ifdef USE_SSL diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h index e993fb77c..7d2296952 100644 --- a/lib/vtls/vtls.h +++ b/lib/vtls/vtls.h @@ -28,6 +28,7 @@ struct ssl_connect_data; struct Curl_ssl { const char *name; + int id; /* one of the CURLSSLBACKEND_* constants */ unsigned have_ca_path:1; /* supports CAPATH */ unsigned have_certinfo:1; /* supports CURLOPT_CERTINFO */ @@ -242,8 +243,6 @@ bool Curl_ssl_false_start(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