]> granicus.if.org Git - curl/commitdiff
vtls: fold the backend ID into the Curl_ssl structure
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 23 Jun 2017 22:25:29 +0000 (00:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 28 Aug 2017 12:56:58 +0000 (14:56 +0200)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
22 files changed:
lib/vtls/axtls.c
lib/vtls/axtls.h
lib/vtls/cyassl.c
lib/vtls/cyassl.h
lib/vtls/darwinssl.c
lib/vtls/darwinssl.h
lib/vtls/gskit.c
lib/vtls/gskit.h
lib/vtls/gtls.c
lib/vtls/gtls.h
lib/vtls/mbedtls.c
lib/vtls/mbedtls.h
lib/vtls/nss.c
lib/vtls/nssg.h
lib/vtls/openssl.c
lib/vtls/openssl.h
lib/vtls/polarssl.c
lib/vtls/polarssl.h
lib/vtls/schannel.c
lib/vtls/schannel.h
lib/vtls/vtls.c
lib/vtls/vtls.h

index 9b08d4981e194f1567b5f62183e32af9b760de86..65f3b24092cb46351d696ede443dd01e9d1faad5 100644 (file)
@@ -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 */
index 63adf8fc5762c32247c1ecd9f093e9e64cd31b01..3f1e129c285d543807a2c771ff893efb66fb5714 100644 (file)
@@ -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 */
 
index 6385f8960f3e3fdf77c8df92d08b370a4a6adf78..01ed678df98338b6d3c37b5cf2cf41661c397692 100644 (file)
@@ -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 */
index 8a6771e2a731cc3c00b5e0c3ef06c7f59fcacdde..01e11cc23a744288ee4a54e02d85f5c8a4f13c98 100644 (file)
@@ -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 */
index c0e71ccbe46dcf2376ad02c2a7e6f83ec3ca06a7..f65e93d861a833be7636ce21f3c3c0566fbda4ca 100644 (file)
@@ -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 */
index aace2946dbd3689becb0f9fd28db8a3398ca6520..23c7f705cbd98b6cc09a2a1621d4c72536616f76 100644 (file)
@@ -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 */
index 5d6bb0c8f2302b3d4c376af687dd89f5bb402594..9d5568cf92a5ca0c9e935246c1393581fb45afa8 100644 (file)
@@ -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 */
index 91e55987c48a03b4af7b8202d7d9c39e76f4b355..466ee4d9de4d287229b6b1f58c528dae6d46e561 100644 (file)
@@ -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 */
index 6364a61cf42784a5a1ce91c677a02a536006d13d..f63f5460f074de6915e419b605e557234f7dffbe 100644 (file)
@@ -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 */
index 0dcf13a565058b144e898b2fb7158dad2961fdf3..780fc109d7dbf55fae8e8014f5075eb56759b609 100644 (file)
@@ -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 */
index a46fb5fdc8dac3e62fa55a08f35de1587edaecbd..61eee09bcab60a97082cab6db2b6dd71a3e9a5a8 100644 (file)
@@ -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 */
index 842b4d50f9b6f06988ed77f596c9058c98deec38..4a938605bdbd29ebcfc8e2da03c3c2174ddd153b 100644 (file)
@@ -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 */
index 2d132f5b15c8a0ba787af448960754b6f7193357..14dd154239df935bf95c4811f3cc3a8b3a339ca7 100644 (file)
@@ -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 */
index 5c3015a8b2cd0a59a3d418284d0ff5e5878d5a08..41e51b021da2bac0626afc426d438218b45eb688 100644 (file)
@@ -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 */
index bc5475e535e94c6e65959916bb1622d6e297a65b..a96604dd656c365ab4c6e33413a9e94f4cddfd97 100644 (file)
@@ -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 */
index 030addac6006c2498ebd9c6154da2ded59e00d41..114dc4baeb38d65aa4662bb7fdb432480f0e0689 100644 (file)
@@ -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 */
index 7d1b3b1fd9bf392aeef46d2445f9bdb636721137..ae3f6f81492e9003b9e768cc280f1b622439b847 100644 (file)
@@ -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 */
index ce534fa53789a0e363d0950ef1c7d8ea346dd44f..23c3636ee6afc4d5b298489ffbd153a255aea27c 100644 (file)
@@ -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 */
index d3f44018b686fc982673d4fce09604f21b40ddcb..b1cd60e11eb0f4f4d9c6be682ccb1fce52ffddd4 100644 (file)
@@ -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 */
index 4a254df4b81710056cc024ad5082f157944fb72c..932103da4737fd31f344123a805246a46fa0e0a5 100644 (file)
@@ -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 */
index bc72ad31ebbf8e3f8ced332f0f14dd737691b3e7..3e52220fc2f56cba3697ece5bbeff1e4efebde8a 100644 (file)
@@ -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
index e993fb77ca25d58ae60ccb3d0ec2dac8d648bf79..7d22969523074f8697143e081fcb079e69d95472 100644 (file)
@@ -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