summaryrefslogtreecommitdiff
path: root/lib/vtls/vtls.h
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2020-07-27 15:44:01 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-10-01 16:36:24 +0200
commit7920be94738e0d84f7aa30c3605d29ec4274c714 (patch)
tree17045085217c0c05061db989052ea2b8304cb975 /lib/vtls/vtls.h
parentce95c5e01340d684eb9ab7fb1f28f39dcc51ff29 (diff)
downloadcurl-7920be94738e0d84f7aa30c3605d29ec4274c714.tar.gz
vtls: deduplicate some DISABLE_PROXY ifdefs
... in the code of gtls, nss, and openssl Closes #5735
Diffstat (limited to 'lib/vtls/vtls.h')
-rw-r--r--lib/vtls/vtls.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h
index 1a0bb1865..b86bdbc1d 100644
--- a/lib/vtls/vtls.h
+++ b/lib/vtls/vtls.h
@@ -131,12 +131,26 @@ CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
CURL_SOCKET_BAD ? FIRSTSOCKET : SECONDARYSOCKET].state)
#define SSL_SET_OPTION(var) \
(SSL_IS_PROXY() ? data->set.proxy_ssl.var : data->set.ssl.var)
+#define SSL_SET_OPTION_LVALUE(var) \
+ (*(SSL_IS_PROXY() ? &data->set.proxy_ssl.var : &data->set.ssl.var))
#define SSL_CONN_CONFIG(var) \
(SSL_IS_PROXY() ? conn->proxy_ssl_config.var : conn->ssl_config.var)
+#define SSL_HOST_NAME() \
+ (SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name)
+#define SSL_HOST_DISPNAME() \
+ (SSL_IS_PROXY() ? conn->http_proxy.host.dispname : conn->host.dispname)
+#define SSL_PINNED_PUB_KEY() (SSL_IS_PROXY() \
+ ? data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] \
+ : data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG])
#else
#define SSL_IS_PROXY() FALSE
#define SSL_SET_OPTION(var) data->set.ssl.var
+#define SSL_SET_OPTION_LVALUE(var) data->set.ssl.var
#define SSL_CONN_CONFIG(var) conn->ssl_config.var
+#define SSL_HOST_NAME() conn->host.name
+#define SSL_HOST_DISPNAME() conn->host.dispname
+#define SSL_PINNED_PUB_KEY() \
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]
#endif
bool Curl_ssl_config_matches(struct ssl_primary_config *data,