diff options
author | Brad King <brad.king@kitware.com> | 2023-08-01 17:58:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-08-01 17:58:24 (GMT) |
commit | 188c065e5a447e4c659426e0c27051928c8adb6e (patch) | |
tree | 91af173dfc4e42b50510e998778aa4886d68faeb /Utilities/cmcurl/lib/vtls/gtls.c | |
parent | 1345c21275574dd66f7adadc9123682488856ba1 (diff) | |
parent | e2ab2da70a2b390eb9067d45dfa47023b00c5cd7 (diff) | |
download | CMake-188c065e5a447e4c659426e0c27051928c8adb6e.zip CMake-188c065e5a447e4c659426e0c27051928c8adb6e.tar.gz CMake-188c065e5a447e4c659426e0c27051928c8adb6e.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2023-07-26 (50490c06)
Diffstat (limited to 'Utilities/cmcurl/lib/vtls/gtls.c')
-rw-r--r-- | Utilities/cmcurl/lib/vtls/gtls.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/Utilities/cmcurl/lib/vtls/gtls.c b/Utilities/cmcurl/lib/vtls/gtls.c index 3d1906e..f6f1e10 100644 --- a/Utilities/cmcurl/lib/vtls/gtls.c +++ b/Utilities/cmcurl/lib/vtls/gtls.c @@ -76,7 +76,7 @@ static bool gtls_inited = FALSE; # include <gnutls/ocsp.h> -struct ssl_backend_data { +struct gtls_ssl_backend_data { struct gtls_instance gtls; }; @@ -91,7 +91,9 @@ static ssize_t gtls_push(void *s, const void *buf, size_t blen) DEBUGASSERT(data); nwritten = Curl_conn_cf_send(cf->next, data, buf, blen, &result); if(nwritten < 0) { - gnutls_transport_set_errno(connssl->backend->gtls.session, + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; + gnutls_transport_set_errno(backend->gtls.session, (CURLE_AGAIN == result)? EAGAIN : EINVAL); nwritten = -1; } @@ -109,7 +111,9 @@ static ssize_t gtls_pull(void *s, void *buf, size_t blen) DEBUGASSERT(data); nread = Curl_conn_cf_recv(cf->next, data, buf, blen, &result); if(nread < 0) { - gnutls_transport_set_errno(connssl->backend->gtls.session, + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; + gnutls_transport_set_errno(backend->gtls.session, (CURLE_AGAIN == result)? EAGAIN : EINVAL); nread = -1; } @@ -212,7 +216,8 @@ static CURLcode handshake(struct Curl_cfilter *cf, bool nonblocking) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; gnutls_session_t session; curl_socket_t sockfd = Curl_conn_cf_get_socket(cf, data); @@ -679,7 +684,8 @@ static CURLcode gtls_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf); struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data); long * const pverifyresult = &ssl_config->certverifyresult; @@ -1346,7 +1352,8 @@ gtls_connect_common(struct Curl_cfilter *cf, /* Finish connecting once the handshake is done */ if(ssl_connect_1 == connssl->connecting_state) { - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; gnutls_session_t session; DEBUGASSERT(backend); session = backend->gtls.session; @@ -1390,11 +1397,13 @@ static bool gtls_data_pending(struct Curl_cfilter *cf, const struct Curl_easy *data) { struct ssl_connect_data *ctx = cf->ctx; + struct gtls_ssl_backend_data *backend; (void)data; DEBUGASSERT(ctx && ctx->backend); - if(ctx->backend->gtls.session && - 0 != gnutls_record_check_pending(ctx->backend->gtls.session)) + backend = (struct gtls_ssl_backend_data *)ctx->backend; + if(backend->gtls.session && + 0 != gnutls_record_check_pending(backend->gtls.session)) return TRUE; return FALSE; } @@ -1406,7 +1415,8 @@ static ssize_t gtls_send(struct Curl_cfilter *cf, CURLcode *curlcode) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; ssize_t rc; (void)data; @@ -1428,7 +1438,8 @@ static void gtls_close(struct Curl_cfilter *cf, struct Curl_easy *data) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; (void) data; DEBUGASSERT(backend); @@ -1463,7 +1474,8 @@ static int gtls_shutdown(struct Curl_cfilter *cf, { struct ssl_connect_data *connssl = cf->ctx; struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data); - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; int retval = 0; DEBUGASSERT(backend); @@ -1541,7 +1553,8 @@ static ssize_t gtls_recv(struct Curl_cfilter *cf, CURLcode *curlcode) { struct ssl_connect_data *connssl = cf->ctx; - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; ssize_t ret; (void)data; @@ -1620,7 +1633,8 @@ static bool gtls_cert_status_request(void) static void *gtls_get_internals(struct ssl_connect_data *connssl, CURLINFO info UNUSED_PARAM) { - struct ssl_backend_data *backend = connssl->backend; + struct gtls_ssl_backend_data *backend = + (struct gtls_ssl_backend_data *)connssl->backend; (void)info; DEBUGASSERT(backend); return backend->gtls.session; @@ -1634,7 +1648,7 @@ const struct Curl_ssl Curl_ssl_gnutls = { SSLSUPP_PINNEDPUBKEY | SSLSUPP_HTTPS_PROXY, - sizeof(struct ssl_backend_data), + sizeof(struct gtls_ssl_backend_data), gtls_init, /* init */ gtls_cleanup, /* cleanup */ |