aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls/mbedtls.c
diff options
context:
space:
mode:
authorThomas Glanzmann <thomas@glanzmann.de>2016-11-25 10:47:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-25 10:49:38 +0100
commit4f8b17743d7c55a0bfb48463238c88564875ae47 (patch)
treeea77a17d0cc904146e5bd17909c5c4dfbe1002ea /lib/vtls/mbedtls.c
parent1232dbb8bd49b5502834ae9dd9f7ab1cb7a88b7b (diff)
HTTPS Proxy: Implement CURLOPT_PROXY_PINNEDPUBLICKEY
Diffstat (limited to 'lib/vtls/mbedtls.c')
-rw-r--r--lib/vtls/mbedtls.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index c428a210d..8bcaddd25 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -171,7 +171,6 @@ mbed_connect_step1(struct connectdata *conn,
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-
int ret = -1;
char errorbuf[128];
errorbuf[0]=0;
@@ -453,6 +452,9 @@ mbed_connect_step2(struct connectdata *conn,
struct Curl_easy *data = conn->data;
struct ssl_connect_data* connssl = &conn->ssl[sockindex];
const mbedtls_x509_crt *peercert;
+ const char * const pinnedpubkey = SSL_IS_PROXY() ?
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
#ifdef HAS_ALPN
const char *next_protocol;
@@ -524,7 +526,7 @@ mbed_connect_step2(struct connectdata *conn,
free(buffer);
}
- if(data->set.str[STRING_SSL_PINNEDPUBLICKEY]) {
+ if(pinnedpubkey) {
int size;
CURLcode result;
mbedtls_x509_crt *p;
@@ -563,7 +565,7 @@ mbed_connect_step2(struct connectdata *conn,
/* mbedtls_pk_write_pubkey_der writes data at the end of the buffer. */
result = Curl_pin_peer_pubkey(data,
- data->set.str[STRING_SSL_PINNEDPUBLICKEY],
+ pinnedpubkey,
&pubkey[PUB_DER_MAX_BYTES - size], size);
if(result) {
mbedtls_x509_crt_free(p);