diff options
Diffstat (limited to 'Utilities/cmcurl/lib/vtls/rustls.c')
-rw-r--r-- | Utilities/cmcurl/lib/vtls/rustls.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/Utilities/cmcurl/lib/vtls/rustls.c b/Utilities/cmcurl/lib/vtls/rustls.c index 097c58c..76d3e24 100644 --- a/Utilities/cmcurl/lib/vtls/rustls.c +++ b/Utilities/cmcurl/lib/vtls/rustls.c @@ -40,7 +40,7 @@ #include "strerror.h" #include "multiif.h" -struct ssl_backend_data +struct rustls_ssl_backend_data { const struct rustls_client_config *config; struct rustls_connection *conn; @@ -67,10 +67,12 @@ static bool cr_data_pending(struct Curl_cfilter *cf, const struct Curl_easy *data) { struct ssl_connect_data *ctx = cf->ctx; + struct rustls_ssl_backend_data *backend; (void)data; DEBUGASSERT(ctx && ctx->backend); - return ctx->backend->data_pending; + backend = (struct rustls_ssl_backend_data *)ctx->backend; + return backend->data_pending; } static CURLcode @@ -136,7 +138,8 @@ static ssize_t tls_recv_more(struct Curl_cfilter *cf, struct Curl_easy *data, CURLcode *err) { struct ssl_connect_data *const connssl = cf->ctx; - struct ssl_backend_data *const backend = connssl->backend; + struct rustls_ssl_backend_data *const backend = + (struct rustls_ssl_backend_data *)connssl->backend; struct io_ctx io_ctx; size_t tls_bytes_read = 0; rustls_io_result io_error; @@ -191,7 +194,8 @@ cr_recv(struct Curl_cfilter *cf, struct Curl_easy *data, char *plainbuf, size_t plainlen, CURLcode *err) { struct ssl_connect_data *const connssl = cf->ctx; - struct ssl_backend_data *const backend = connssl->backend; + struct rustls_ssl_backend_data *const backend = + (struct rustls_ssl_backend_data *)connssl->backend; struct rustls_connection *rconn = NULL; size_t n = 0; size_t plain_bytes_copied = 0; @@ -283,7 +287,8 @@ cr_send(struct Curl_cfilter *cf, struct Curl_easy *data, const void *plainbuf, size_t plainlen, CURLcode *err) { struct ssl_connect_data *const connssl = cf->ctx; - struct ssl_backend_data *const backend = connssl->backend; + struct rustls_ssl_backend_data *const backend = + (struct rustls_ssl_backend_data *)connssl->backend; struct rustls_connection *rconn = NULL; struct io_ctx io_ctx; size_t plainwritten = 0; @@ -373,7 +378,7 @@ cr_hostname_is_ip(const char *hostname) static CURLcode cr_init_backend(struct Curl_cfilter *cf, struct Curl_easy *data, - struct ssl_backend_data *const backend) + struct rustls_ssl_backend_data *const backend) { struct ssl_connect_data *connssl = cf->ctx; struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf); @@ -491,7 +496,8 @@ cr_connect_nonblocking(struct Curl_cfilter *cf, { struct ssl_connect_data *const connssl = cf->ctx; curl_socket_t sockfd = Curl_conn_cf_get_socket(cf, data); - struct ssl_backend_data *const backend = connssl->backend; + struct rustls_ssl_backend_data *const backend = + (struct rustls_ssl_backend_data *)connssl->backend; struct rustls_connection *rconn = NULL; CURLcode tmperr = CURLE_OK; int result; @@ -504,7 +510,8 @@ cr_connect_nonblocking(struct Curl_cfilter *cf, DEBUGASSERT(backend); if(ssl_connection_none == connssl->state) { - result = cr_init_backend(cf, data, connssl->backend); + result = cr_init_backend(cf, data, + (struct rustls_ssl_backend_data *)connssl->backend); if(result != CURLE_OK) { return result; } @@ -594,7 +601,8 @@ cr_get_select_socks(struct Curl_cfilter *cf, struct Curl_easy *data, { struct ssl_connect_data *const connssl = cf->ctx; curl_socket_t sockfd = Curl_conn_cf_get_socket(cf, data); - struct ssl_backend_data *const backend = connssl->backend; + struct rustls_ssl_backend_data *const backend = + (struct rustls_ssl_backend_data *)connssl->backend; struct rustls_connection *rconn = NULL; (void)data; @@ -617,7 +625,8 @@ static void * cr_get_internals(struct ssl_connect_data *connssl, CURLINFO info UNUSED_PARAM) { - struct ssl_backend_data *backend = connssl->backend; + struct rustls_ssl_backend_data *backend = + (struct rustls_ssl_backend_data *)connssl->backend; DEBUGASSERT(backend); return &backend->conn; } @@ -626,7 +635,8 @@ static void cr_close(struct Curl_cfilter *cf, struct Curl_easy *data) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct rustls_ssl_backend_data *backend = + (struct rustls_ssl_backend_data *)connssl->backend; CURLcode tmperr = CURLE_OK; ssize_t n = 0; @@ -659,7 +669,7 @@ const struct Curl_ssl Curl_ssl_rustls = { SSLSUPP_CAINFO_BLOB | /* supports */ SSLSUPP_TLS13_CIPHERSUITES | SSLSUPP_HTTPS_PROXY, - sizeof(struct ssl_backend_data), + sizeof(struct rustls_ssl_backend_data), Curl_none_init, /* init */ Curl_none_cleanup, /* cleanup */ |