Lines Matching refs:backend

473   struct schannel_ssl_backend_data *backend =  in schannel_acquire_credential_handle()  local
474 (struct schannel_ssl_backend_data *)(connssl->backend); in schannel_acquire_credential_handle()
476 DEBUGASSERT(backend); in schannel_acquire_credential_handle()
480 if(backend->use_manual_cred_validation) in schannel_acquire_credential_handle()
749 backend->cred = (struct Curl_schannel_cred *) in schannel_acquire_credential_handle()
751 if(!backend->cred) { in schannel_acquire_credential_handle()
763 backend->cred->refcount = 1; in schannel_acquire_credential_handle()
769 backend->cred->client_cert_store = client_cert_store; in schannel_acquire_credential_handle()
807 &backend->cred->cred_handle, in schannel_acquire_credential_handle()
808 &backend->cred->time_stamp); in schannel_acquire_credential_handle()
847 &backend->cred->cred_handle, in schannel_acquire_credential_handle()
848 &backend->cred->time_stamp); in schannel_acquire_credential_handle()
860 Curl_safefree(backend->cred); in schannel_acquire_credential_handle()
882 struct schannel_ssl_backend_data *backend = in schannel_connect_step1() local
883 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_connect_step1()
897 DEBUGASSERT(backend); in schannel_connect_step1()
913 backend->use_alpn = connssl->alpn && in schannel_connect_step1()
919 backend->use_alpn = FALSE; in schannel_connect_step1()
926 backend->use_manual_cred_validation = TRUE; in schannel_connect_step1()
935 backend->use_manual_cred_validation = TRUE; in schannel_connect_step1()
944 backend->use_manual_cred_validation = FALSE; in schannel_connect_step1()
953 backend->cred = NULL; in schannel_connect_step1()
960 backend->cred = old_cred; in schannel_connect_step1()
964 backend->cred->refcount++; in schannel_connect_step1()
967 backend->cred->refcount)); in schannel_connect_step1()
972 if(!backend->cred) { in schannel_connect_step1()
983 backend->cred->sni_hostname = curlx_convert_UTF8_to_tchar(snihost); in schannel_connect_step1()
984 if(!backend->cred->sni_hostname) in schannel_connect_step1()
994 if(backend->use_alpn) { in schannel_connect_step1()
1051 backend->req_flags = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT | in schannel_connect_step1()
1056 backend->req_flags |= ISC_REQ_USE_SUPPLIED_CREDS; in schannel_connect_step1()
1060 backend->ctxt = (struct Curl_schannel_ctxt *) in schannel_connect_step1()
1062 if(!backend->ctxt) { in schannel_connect_step1()
1075 &backend->cred->cred_handle, NULL, backend->cred->sni_hostname, in schannel_connect_step1()
1076 backend->req_flags, 0, 0, in schannel_connect_step1()
1077 (backend->use_alpn ? &inbuf_desc : NULL), in schannel_connect_step1()
1078 0, &backend->ctxt->ctxt_handle, in schannel_connect_step1()
1079 &outbuf_desc, &backend->ret_flags, &backend->ctxt->time_stamp); in schannel_connect_step1()
1083 Curl_safefree(backend->ctxt); in schannel_connect_step1()
1128 backend->recv_unrecoverable_err = CURLE_OK; in schannel_connect_step1()
1129 backend->recv_sspi_close_notify = FALSE; in schannel_connect_step1()
1130 backend->recv_connection_closed = FALSE; in schannel_connect_step1()
1131 backend->recv_renegotiating = FALSE; in schannel_connect_step1()
1132 backend->encdata_is_incomplete = FALSE; in schannel_connect_step1()
1144 struct schannel_ssl_backend_data *backend = in schannel_connect_step2() local
1145 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_connect_step2()
1159 DEBUGASSERT(backend); in schannel_connect_step2()
1168 if(!backend->cred || !backend->ctxt) in schannel_connect_step2()
1172 if(!backend->decdata_buffer) { in schannel_connect_step2()
1173 backend->decdata_offset = 0; in schannel_connect_step2()
1174 backend->decdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE; in schannel_connect_step2()
1175 backend->decdata_buffer = malloc(backend->decdata_length); in schannel_connect_step2()
1176 if(!backend->decdata_buffer) { in schannel_connect_step2()
1183 if(!backend->encdata_buffer) { in schannel_connect_step2()
1184 backend->encdata_is_incomplete = FALSE; in schannel_connect_step2()
1185 backend->encdata_offset = 0; in schannel_connect_step2()
1186 backend->encdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE; in schannel_connect_step2()
1187 backend->encdata_buffer = malloc(backend->encdata_length); in schannel_connect_step2()
1188 if(!backend->encdata_buffer) { in schannel_connect_step2()
1195 if(backend->encdata_length - backend->encdata_offset < in schannel_connect_step2()
1198 size_t reallocated_length = backend->encdata_offset + in schannel_connect_step2()
1200 reallocated_buffer = realloc(backend->encdata_buffer, in schannel_connect_step2()
1208 backend->encdata_buffer = reallocated_buffer; in schannel_connect_step2()
1209 backend->encdata_length = reallocated_length; in schannel_connect_step2()
1217 (char *) (backend->encdata_buffer + in schannel_connect_step2()
1218 backend->encdata_offset), in schannel_connect_step2()
1219 backend->encdata_length - in schannel_connect_step2()
1220 backend->encdata_offset, in schannel_connect_step2()
1235 backend->encdata_offset += nread; in schannel_connect_step2()
1236 backend->encdata_is_incomplete = FALSE; in schannel_connect_step2()
1242 backend->encdata_offset, backend->encdata_length)); in schannel_connect_step2()
1245 InitSecBuffer(&inbuf[0], SECBUFFER_TOKEN, malloc(backend->encdata_offset), in schannel_connect_step2()
1246 curlx_uztoul(backend->encdata_offset)); in schannel_connect_step2()
1262 memcpy(inbuf[0].pvBuffer, backend->encdata_buffer, in schannel_connect_step2()
1263 backend->encdata_offset); in schannel_connect_step2()
1266 &backend->cred->cred_handle, &backend->ctxt->ctxt_handle, in schannel_connect_step2()
1267 backend->cred->sni_hostname, backend->req_flags, in schannel_connect_step2()
1269 &outbuf_desc, &backend->ret_flags, &backend->ctxt->time_stamp); in schannel_connect_step2()
1276 backend->encdata_is_incomplete = TRUE; in schannel_connect_step2()
1287 !(backend->req_flags & ISC_REQ_USE_SUPPLIED_CREDS)) { in schannel_connect_step2()
1288 backend->req_flags |= ISC_REQ_USE_SUPPLIED_CREDS; in schannel_connect_step2()
1370 if(backend->encdata_offset > inbuf[1].cbBuffer) { in schannel_connect_step2()
1371 memmove(backend->encdata_buffer, in schannel_connect_step2()
1372 (backend->encdata_buffer + backend->encdata_offset) - in schannel_connect_step2()
1374 backend->encdata_offset = inbuf[1].cbBuffer; in schannel_connect_step2()
1382 backend->encdata_offset = 0; in schannel_connect_step2()
1415 if(conn_config->verifypeer && backend->use_manual_cred_validation) { in schannel_connect_step2()
1530 struct schannel_ssl_backend_data *backend = in schannel_connect_step3() local
1531 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_connect_step3()
1541 DEBUGASSERT(backend); in schannel_connect_step3()
1547 if(!backend->cred) in schannel_connect_step3()
1551 if(backend->ret_flags != backend->req_flags) { in schannel_connect_step3()
1552 if(!(backend->ret_flags & ISC_RET_SEQUENCE_DETECT)) in schannel_connect_step3()
1554 if(!(backend->ret_flags & ISC_RET_REPLAY_DETECT)) in schannel_connect_step3()
1556 if(!(backend->ret_flags & ISC_RET_CONFIDENTIALITY)) in schannel_connect_step3()
1558 if(!(backend->ret_flags & ISC_RET_ALLOCATED_MEMORY)) in schannel_connect_step3()
1560 if(!(backend->ret_flags & ISC_RET_STREAM)) in schannel_connect_step3()
1566 if(backend->use_alpn) { in schannel_connect_step3()
1568 Curl_pSecFn->QueryContextAttributes(&backend->ctxt->ctxt_handle, in schannel_connect_step3()
1583 if(backend->recv_renegotiating) { in schannel_connect_step3()
1594 if(!backend->recv_renegotiating) in schannel_connect_step3()
1604 backend->cred->refcount++; in schannel_connect_step3()
1606 backend->cred, in schannel_connect_step3()
1617 Curl_pSecFn->QueryContextAttributes(&backend->ctxt->ctxt_handle, in schannel_connect_step3()
1748 struct schannel_ssl_backend_data *backend = in schannel_connect_common() local
1749 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_connect_common()
1750 DEBUGASSERT(backend); in schannel_connect_common()
1751 cf->conn->sslContext = &backend->ctxt->ctxt_handle; in schannel_connect_common()
1778 struct schannel_ssl_backend_data *backend = in schannel_send() local
1779 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_send()
1781 DEBUGASSERT(backend); in schannel_send()
1784 if(backend->stream_sizes.cbMaximumMessage == 0) { in schannel_send()
1786 &backend->ctxt->ctxt_handle, in schannel_send()
1788 &backend->stream_sizes); in schannel_send()
1796 if(len > backend->stream_sizes.cbMaximumMessage) { in schannel_send()
1797 len = backend->stream_sizes.cbMaximumMessage; in schannel_send()
1801 data_len = backend->stream_sizes.cbHeader + len + in schannel_send()
1802 backend->stream_sizes.cbTrailer; in schannel_send()
1811 ptr, backend->stream_sizes.cbHeader); in schannel_send()
1813 ptr + backend->stream_sizes.cbHeader, curlx_uztoul(len)); in schannel_send()
1815 ptr + backend->stream_sizes.cbHeader + len, in schannel_send()
1816 backend->stream_sizes.cbTrailer); in schannel_send()
1824 sspi_status = Curl_pSecFn->EncryptMessage(&backend->ctxt->ctxt_handle, 0, in schannel_send()
1929 struct schannel_ssl_backend_data *backend = in schannel_recv() local
1930 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_recv()
1932 DEBUGASSERT(backend); in schannel_recv()
1953 if(len && len <= backend->decdata_offset) { in schannel_recv()
1958 else if(backend->recv_unrecoverable_err) { in schannel_recv()
1959 *err = backend->recv_unrecoverable_err; in schannel_recv()
1963 else if(backend->recv_sspi_close_notify) { in schannel_recv()
1972 else if(len && !backend->recv_connection_closed) { in schannel_recv()
1974 size = backend->encdata_length - backend->encdata_offset; in schannel_recv()
1976 backend->encdata_length < min_encdata_length) { in schannel_recv()
1977 reallocated_length = backend->encdata_offset + in schannel_recv()
1982 reallocated_buffer = realloc(backend->encdata_buffer, in schannel_recv()
1990 backend->encdata_buffer = reallocated_buffer; in schannel_recv()
1991 backend->encdata_length = reallocated_length; in schannel_recv()
1992 size = backend->encdata_length - backend->encdata_offset; in schannel_recv()
1994 backend->encdata_length)); in schannel_recv()
1999 backend->encdata_offset, backend->encdata_length)); in schannel_recv()
2003 (char *)(backend->encdata_buffer + in schannel_recv()
2004 backend->encdata_offset), in schannel_recv()
2016 backend->recv_connection_closed = TRUE; in schannel_recv()
2020 backend->encdata_offset += (size_t)nread; in schannel_recv()
2021 backend->encdata_is_incomplete = FALSE; in schannel_recv()
2027 backend->encdata_offset, backend->encdata_length)); in schannel_recv()
2030 while(backend->encdata_offset > 0 && sspi_status == SEC_E_OK && in schannel_recv()
2031 (!len || backend->decdata_offset < len || in schannel_recv()
2032 backend->recv_connection_closed)) { in schannel_recv()
2034 InitSecBuffer(&inbuf[0], SECBUFFER_DATA, backend->encdata_buffer, in schannel_recv()
2035 curlx_uztoul(backend->encdata_offset)); in schannel_recv()
2045 sspi_status = Curl_pSecFn->DecryptMessage(&backend->ctxt->ctxt_handle, in schannel_recv()
2061 if(backend->decdata_length - backend->decdata_offset < size || in schannel_recv()
2062 backend->decdata_length < len) { in schannel_recv()
2064 reallocated_length = backend->decdata_offset + size; in schannel_recv()
2069 reallocated_buffer = realloc(backend->decdata_buffer, in schannel_recv()
2076 backend->decdata_buffer = reallocated_buffer; in schannel_recv()
2077 backend->decdata_length = reallocated_length; in schannel_recv()
2083 memcpy(backend->decdata_buffer + backend->decdata_offset, in schannel_recv()
2085 backend->decdata_offset += size; in schannel_recv()
2091 backend->decdata_offset, backend->decdata_length)); in schannel_recv()
2102 if(backend->encdata_offset > inbuf[3].cbBuffer) { in schannel_recv()
2105 memmove(backend->encdata_buffer, in schannel_recv()
2106 (backend->encdata_buffer + backend->encdata_offset) - in schannel_recv()
2108 backend->encdata_offset = inbuf[3].cbBuffer; in schannel_recv()
2113 backend->encdata_offset, backend->encdata_length)); in schannel_recv()
2117 backend->encdata_offset = 0; in schannel_recv()
2133 backend->recv_renegotiating = TRUE; in schannel_recv()
2135 backend->recv_renegotiating = FALSE; in schannel_recv()
2149 backend->recv_sspi_close_notify = TRUE; in schannel_recv()
2150 if(!backend->recv_connection_closed) in schannel_recv()
2151 backend->recv_connection_closed = TRUE; in schannel_recv()
2163 backend->encdata_is_incomplete = TRUE; in schannel_recv()
2181 backend->encdata_offset, backend->encdata_length)); in schannel_recv()
2184 backend->decdata_offset, backend->decdata_length)); in schannel_recv()
2201 if(len && !backend->decdata_offset && backend->recv_connection_closed && in schannel_recv()
2202 !backend->recv_sspi_close_notify) { in schannel_recv()
2207 backend->recv_sspi_close_notify = TRUE; in schannel_recv()
2216 backend->recv_unrecoverable_err = *err; in schannel_recv()
2218 size = len < backend->decdata_offset ? len : backend->decdata_offset; in schannel_recv()
2220 memcpy(buf, backend->decdata_buffer, size); in schannel_recv()
2221 memmove(backend->decdata_buffer, backend->decdata_buffer + size, in schannel_recv()
2222 backend->decdata_offset - size); in schannel_recv()
2223 backend->decdata_offset -= size; in schannel_recv()
2227 backend->decdata_offset, backend->decdata_length)); in schannel_recv()
2232 if(!*err && !backend->recv_connection_closed) in schannel_recv()
2271 struct schannel_ssl_backend_data *backend = in schannel_data_pending() local
2272 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_data_pending()
2275 DEBUGASSERT(backend); in schannel_data_pending()
2277 if(backend->ctxt) /* SSL/TLS is in use */ in schannel_data_pending()
2278 return (backend->decdata_offset > 0 || in schannel_data_pending()
2279 (backend->encdata_offset > 0 && !backend->encdata_is_incomplete) || in schannel_data_pending()
2280 backend->recv_connection_closed || in schannel_data_pending()
2281 backend->recv_sspi_close_notify || in schannel_data_pending()
2282 backend->recv_unrecoverable_err); in schannel_data_pending()
2298 struct schannel_ssl_backend_data *backend = in schannel_shutdown() local
2299 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_shutdown()
2308 DEBUGASSERT(backend); in schannel_shutdown()
2314 if(backend->ctxt) { in schannel_shutdown()
2319 if(!backend->ctxt || cf->shutdown) { in schannel_shutdown()
2324 if(backend->cred && backend->ctxt && !backend->sent_shutdown) { in schannel_shutdown()
2335 sspi_status = Curl_pSecFn->ApplyControlToken(&backend->ctxt->ctxt_handle, in schannel_shutdown()
2351 &backend->cred->cred_handle, in schannel_shutdown()
2352 &backend->ctxt->ctxt_handle, in schannel_shutdown()
2353 backend->cred->sni_hostname, in schannel_shutdown()
2354 backend->req_flags, in schannel_shutdown()
2359 &backend->ctxt->ctxt_handle, in schannel_shutdown()
2361 &backend->ret_flags, in schannel_shutdown()
2362 &backend->ctxt->time_stamp); in schannel_shutdown()
2378 backend->sent_shutdown = TRUE; in schannel_shutdown()
2387 if(!backend->recv_connection_closed) { in schannel_shutdown()
2402 if(backend->cred && backend->ctxt && in schannel_shutdown()
2403 !backend->recv_sspi_close_notify && !backend->recv_connection_closed) { in schannel_shutdown()
2413 backend->recv_connection_closed = TRUE; in schannel_shutdown()
2433 struct schannel_ssl_backend_data *backend = in schannel_close() local
2434 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_close()
2437 DEBUGASSERT(backend); in schannel_close()
2440 if(backend->ctxt) { in schannel_close()
2442 Curl_pSecFn->DeleteSecurityContext(&backend->ctxt->ctxt_handle); in schannel_close()
2443 Curl_safefree(backend->ctxt); in schannel_close()
2447 if(backend->cred) { in schannel_close()
2449 schannel_session_free(backend->cred, 0); in schannel_close()
2451 backend->cred = NULL; in schannel_close()
2455 if(backend->encdata_buffer) { in schannel_close()
2456 Curl_safefree(backend->encdata_buffer); in schannel_close()
2457 backend->encdata_length = 0; in schannel_close()
2458 backend->encdata_offset = 0; in schannel_close()
2459 backend->encdata_is_incomplete = FALSE; in schannel_close()
2463 if(backend->decdata_buffer) { in schannel_close()
2464 Curl_safefree(backend->decdata_buffer); in schannel_close()
2465 backend->decdata_length = 0; in schannel_close()
2466 backend->decdata_offset = 0; in schannel_close()
2498 struct schannel_ssl_backend_data *backend = in schannel_pkp_pin_peer_pubkey() local
2499 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_pkp_pin_peer_pubkey()
2505 DEBUGASSERT(backend); in schannel_pkp_pin_peer_pubkey()
2519 Curl_pSecFn->QueryContextAttributes(&backend->ctxt->ctxt_handle, in schannel_pkp_pin_peer_pubkey()
2632 struct schannel_ssl_backend_data *backend = in schannel_get_internals() local
2633 (struct schannel_ssl_backend_data *)connssl->backend; in schannel_get_internals()
2635 DEBUGASSERT(backend); in schannel_get_internals()
2636 return &backend->ctxt->ctxt_handle; in schannel_get_internals()