Lines Matching refs:sslsock
239 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_handle_ssl_error() local
240 int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); in php_openssl_handle_ssl_error()
256 retry = is_init ? 1 : sslsock->s.is_blocked; in php_openssl_handle_ssl_error()
264 SSL_set_shutdown(sslsock->ssl_handle, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); in php_openssl_handle_ssl_error()
569 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_apply_peer_verification_policy() local
573 : sslsock->is_client; in php_openssl_apply_peer_verification_policy()
577 : sslsock->is_client; in php_openssl_apply_peer_verification_policy()
633 if (peer_name == NULL && sslsock->is_client) { in php_openssl_apply_peer_verification_policy()
634 peer_name = sslsock->url_name; in php_openssl_apply_peer_verification_policy()
686 php_openssl_netstream_data_t *sslsock; in php_openssl_win_cert_verify_callback() local
692 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_win_cert_verify_callback()
770 ssl_policy_params.dwAuthType = (sslsock->is_client) ? AUTHTYPE_SERVER : AUTHTYPE_CLIENT; in php_openssl_win_cert_verify_callback()
891 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_enable_peer_verification() local
899 } else if (!sslsock->is_client) { in php_openssl_enable_peer_verification()
926 if (sslsock->is_client && !SSL_CTX_set_default_verify_paths(ctx)) { in php_openssl_enable_peer_verification()
1122 php_openssl_netstream_data_t *sslsock; in php_openssl_limit_handshake_reneg() local
1127 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_limit_handshake_reneg()
1131 if (sslsock->reneg->prev_handshake == 0) { in php_openssl_limit_handshake_reneg()
1132 sslsock->reneg->prev_handshake = now.tv_sec; in php_openssl_limit_handshake_reneg()
1136 elapsed_time = (now.tv_sec - sslsock->reneg->prev_handshake); in php_openssl_limit_handshake_reneg()
1137 sslsock->reneg->prev_handshake = now.tv_sec; in php_openssl_limit_handshake_reneg()
1138 sslsock->reneg->tokens -= (elapsed_time * (sslsock->reneg->limit / sslsock->reneg->window)); in php_openssl_limit_handshake_reneg()
1140 if (sslsock->reneg->tokens < 0) { in php_openssl_limit_handshake_reneg()
1141 sslsock->reneg->tokens = 0; in php_openssl_limit_handshake_reneg()
1143 ++sslsock->reneg->tokens; in php_openssl_limit_handshake_reneg()
1146 if (sslsock->reneg->tokens > sslsock->reneg->limit) { in php_openssl_limit_handshake_reneg()
1150 sslsock->reneg->should_close = 1; in php_openssl_limit_handshake_reneg()
1168 sslsock->reneg->should_close = 0; in php_openssl_limit_handshake_reneg()
1189 …penssl_init_server_reneg_limit(php_stream *stream, php_openssl_netstream_data_t *sslsock) /* {{{ */ in php_openssl_init_server_reneg_limit() argument
1212 sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t), in php_openssl_init_server_reneg_limit()
1216 sslsock->reneg->limit = limit; in php_openssl_init_server_reneg_limit()
1217 sslsock->reneg->window = window; in php_openssl_init_server_reneg_limit()
1218 sslsock->reneg->prev_handshake = 0; in php_openssl_init_server_reneg_limit()
1219 sslsock->reneg->tokens = 0; in php_openssl_init_server_reneg_limit()
1220 sslsock->reneg->should_close = 0; in php_openssl_init_server_reneg_limit()
1222 SSL_set_info_callback(sslsock->ssl_handle, php_openssl_info_callback); in php_openssl_init_server_reneg_limit()
1390 php_openssl_netstream_data_t *sslsock; in php_openssl_server_sni_callback() local
1401 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_server_sni_callback()
1403 if (!(sslsock->sni_cert_count && sslsock->sni_certs)) { in php_openssl_server_sni_callback()
1407 for (i=0; i < sslsock->sni_cert_count; i++) { in php_openssl_server_sni_callback()
1408 if (php_openssl_matches_wildcard_name(server_name, sslsock->sni_certs[i].name)) { in php_openssl_server_sni_callback()
1409 SSL_set_SSL_CTX(ssl_handle, sslsock->sni_certs[i].ctx); in php_openssl_server_sni_callback()
1446 …php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock) /* {{{ */ in php_openssl_enable_server_sni() argument
1473 sslsock->sni_cert_count = zend_hash_num_elements(Z_ARRVAL_P(val)); in php_openssl_enable_server_sni()
1474 if (sslsock->sni_cert_count == 0) { in php_openssl_enable_server_sni()
1481 sslsock->sni_certs = (php_openssl_sni_cert_t*)safe_pemalloc(sslsock->sni_cert_count, in php_openssl_enable_server_sni()
1484 memset(sslsock->sni_certs, 0, sslsock->sni_cert_count * sizeof(php_openssl_sni_cert_t)); in php_openssl_enable_server_sni()
1567 sslsock->sni_certs[i].name = pestrdup(ZSTR_VAL(key), php_stream_is_persistent(stream)); in php_openssl_enable_server_sni()
1568 sslsock->sni_certs[i].ctx = ctx; in php_openssl_enable_server_sni()
1573 SSL_CTX_set_tlsext_servername_callback(sslsock->ctx, php_openssl_server_sni_callback); in php_openssl_enable_server_sni()
1579 static void php_openssl_enable_client_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock… in php_openssl_enable_client_sni() argument
1589 sni_server_name = sslsock->url_name; in php_openssl_enable_client_sni()
1594 SSL_set_tlsext_host_name(sslsock->ssl_handle, sni_server_name); in php_openssl_enable_client_sni()
1645 php_openssl_netstream_data_t *sslsock = arg; in php_openssl_server_alpn_callback() local
1647 …if (SSL_select_next_proto((unsigned char **)out, outlen, sslsock->alpn_ctx.data, sslsock->alpn_ctx… in php_openssl_server_alpn_callback()
1658 php_openssl_netstream_data_t *sslsock, in php_openssl_setup_crypto() argument
1670 if (sslsock->ssl_handle) { in php_openssl_setup_crypto()
1671 if (sslsock->s.is_blocked) { in php_openssl_setup_crypto()
1683 sslsock->is_client = cparam->inputs.method & STREAM_CRYPTO_IS_CLIENT; in php_openssl_setup_crypto()
1686 method = sslsock->is_client ? SSLv23_client_method() : SSLv23_server_method(); in php_openssl_setup_crypto()
1687 sslsock->ctx = SSL_CTX_new(method); in php_openssl_setup_crypto()
1689 if (sslsock->ctx == NULL) { in php_openssl_setup_crypto()
1719 php_openssl_disable_peer_verification(sslsock->ctx, stream); in php_openssl_setup_crypto()
1720 } else if (FAILURE == php_openssl_enable_peer_verification(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1726 SSL_CTX_set_default_passwd_cb_userdata(sslsock->ctx, stream); in php_openssl_setup_crypto()
1727 SSL_CTX_set_default_passwd_cb(sslsock->ctx, php_openssl_passwd_callback); in php_openssl_setup_crypto()
1737 if (SSL_CTX_set_cipher_list(sslsock->ctx, cipherlist) != 1) { in php_openssl_setup_crypto()
1748 SSL_CTX_set_security_level(sslsock->ctx, lval); in php_openssl_setup_crypto()
1761 SSL_CTX_free(sslsock->ctx); in php_openssl_setup_crypto()
1762 sslsock->ctx = NULL; in php_openssl_setup_crypto()
1765 if (sslsock->is_client) { in php_openssl_setup_crypto()
1766 SSL_CTX_set_alpn_protos(sslsock->ctx, alpn, alpn_len); in php_openssl_setup_crypto()
1768 …sslsock->alpn_ctx.data = (unsigned char *) pestrndup((const char*)alpn, alpn_len, php_stream_is_pe… in php_openssl_setup_crypto()
1769 sslsock->alpn_ctx.len = alpn_len; in php_openssl_setup_crypto()
1770 SSL_CTX_set_alpn_select_cb(sslsock->ctx, php_openssl_server_alpn_callback, sslsock); in php_openssl_setup_crypto()
1781 if (FAILURE == php_openssl_set_local_cert(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1785 SSL_CTX_set_options(sslsock->ctx, ssl_ctx_options); in php_openssl_setup_crypto()
1788 SSL_CTX_set_min_proto_version(sslsock->ctx, php_openssl_get_min_proto_version(method_flags)); in php_openssl_setup_crypto()
1789 SSL_CTX_set_max_proto_version(sslsock->ctx, php_openssl_get_max_proto_version(method_flags)); in php_openssl_setup_crypto()
1792 if (sslsock->is_client == 0 && in php_openssl_setup_crypto()
1794 FAILURE == php_openssl_set_server_specific_opts(stream, sslsock->ctx) in php_openssl_setup_crypto()
1799 sslsock->ssl_handle = SSL_new(sslsock->ctx); in php_openssl_setup_crypto()
1801 if (sslsock->ssl_handle == NULL) { in php_openssl_setup_crypto()
1803 SSL_CTX_free(sslsock->ctx); in php_openssl_setup_crypto()
1804 sslsock->ctx = NULL; in php_openssl_setup_crypto()
1806 if (sslsock->alpn_ctx.data) { in php_openssl_setup_crypto()
1807 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_setup_crypto()
1808 sslsock->alpn_ctx.data = NULL; in php_openssl_setup_crypto()
1813 SSL_set_ex_data(sslsock->ssl_handle, php_openssl_get_ssl_stream_data_index(), stream); in php_openssl_setup_crypto()
1816 if (!SSL_set_fd(sslsock->ssl_handle, sslsock->s.socket)) { in php_openssl_setup_crypto()
1822 if (!sslsock->is_client && php_openssl_enable_server_sni(stream, sslsock) == FAILURE) { in php_openssl_setup_crypto()
1828 if (!sslsock->is_client) { in php_openssl_setup_crypto()
1829 php_openssl_init_server_reneg_limit(stream, sslsock); in php_openssl_setup_crypto()
1833 SSL_set_mode(sslsock->ssl_handle, SSL_MODE_RELEASE_BUFFERS); in php_openssl_setup_crypto()
1842 …SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->a… in php_openssl_setup_crypto()
1851 php_openssl_netstream_data_t *sslsock, X509 *peer_cert) /* {{{ */ in php_openssl_capture_peer_certs() argument
1877 chain = SSL_get_peer_cert_chain(sslsock->ssl_handle); in php_openssl_capture_peer_certs()
1905 php_openssl_netstream_data_t *sslsock, in php_openssl_enable_crypto() argument
1913 if (cparam->inputs.activate && !sslsock->ssl_active) { in php_openssl_enable_crypto()
1915 int blocked = sslsock->s.is_blocked, has_timeout = 0; in php_openssl_enable_crypto()
1918 if (sslsock->is_client) { in php_openssl_enable_crypto()
1919 php_openssl_enable_client_sni(stream, sslsock); in php_openssl_enable_crypto()
1923 if (!sslsock->state_set) { in php_openssl_enable_crypto()
1924 if (sslsock->is_client) { in php_openssl_enable_crypto()
1925 SSL_set_connect_state(sslsock->ssl_handle); in php_openssl_enable_crypto()
1927 SSL_set_accept_state(sslsock->ssl_handle); in php_openssl_enable_crypto()
1929 sslsock->state_set = 1; in php_openssl_enable_crypto()
1932 if (SUCCESS == php_set_sock_blocking(sslsock->s.socket, 0)) { in php_openssl_enable_crypto()
1933 sslsock->s.is_blocked = 0; in php_openssl_enable_crypto()
1936 …SSL_set_mode(sslsock->ssl_handle, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUF… in php_openssl_enable_crypto()
1939 timeout = sslsock->is_client ? &sslsock->connect_timeout : &sslsock->s.timeout; in php_openssl_enable_crypto()
1940 …has_timeout = !sslsock->s.is_blocked && (timeout->tv_sec > 0 || (timeout->tv_sec == 0 && timeout->… in php_openssl_enable_crypto()
1950 if (sslsock->is_client) { in php_openssl_enable_crypto()
1951 n = SSL_connect(sslsock->ssl_handle); in php_openssl_enable_crypto()
1953 n = SSL_accept(sslsock->ssl_handle); in php_openssl_enable_crypto()
1972 int err = SSL_get_error(sslsock->ssl_handle, n); in php_openssl_enable_crypto()
1978 php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ? in php_openssl_enable_crypto()
1986 …if (sslsock->s.is_blocked != blocked && SUCCESS == php_set_sock_blocking(sslsock->s.socket, blocke… in php_openssl_enable_crypto()
1987 sslsock->s.is_blocked = blocked; in php_openssl_enable_crypto()
1991 peer_cert = SSL_get_peer_certificate(sslsock->ssl_handle); in php_openssl_enable_crypto()
1993 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
1996 …if (FAILURE == php_openssl_apply_peer_verification_policy(sslsock->ssl_handle, peer_cert, stream))… in php_openssl_enable_crypto()
1997 SSL_shutdown(sslsock->ssl_handle); in php_openssl_enable_crypto()
2000 sslsock->ssl_active = 1; in php_openssl_enable_crypto()
2007 peer_cert = SSL_get_peer_certificate(sslsock->ssl_handle); in php_openssl_enable_crypto()
2009 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
2019 } else if (!cparam->inputs.activate && sslsock->ssl_active) { in php_openssl_enable_crypto()
2021 SSL_shutdown(sslsock->ssl_handle); in php_openssl_enable_crypto()
2022 sslsock->ssl_active = 0; in php_openssl_enable_crypto()
2049 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_io() local
2052 if (sslsock->ssl_active) { in php_openssl_sockop_io()
2056 int began_blocked = sslsock->s.is_blocked; in php_openssl_sockop_io()
2067 timeout = &sslsock->s.timeout; in php_openssl_sockop_io()
2070 if (timeout && php_set_sock_blocking(sslsock->s.socket, 0) == SUCCESS) { in php_openssl_sockop_io()
2071 sslsock->s.is_blocked = 0; in php_openssl_sockop_io()
2074 …if (!sslsock->s.is_blocked && timeout && (timeout->tv_sec > 0 || (timeout->tv_sec == 0 && timeout-… in php_openssl_sockop_io()
2095 php_set_sock_blocking(sslsock->s.socket, 1); in php_openssl_sockop_io()
2096 sslsock->s.is_blocked = 1; in php_openssl_sockop_io()
2098 sslsock->s.timeout_event = 1; in php_openssl_sockop_io()
2106 nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count); in php_openssl_sockop_io()
2108 if (sslsock->reneg && sslsock->reneg->should_close) { in php_openssl_sockop_io()
2116 nr_bytes = SSL_write(sslsock->ssl_handle, buf, (int)count); in php_openssl_sockop_io()
2128 int err = SSL_get_error(sslsock->ssl_handle, nr_bytes ); in php_openssl_sockop_io()
2141 stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); in php_openssl_sockop_io()
2154 php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ? in php_openssl_sockop_io()
2157 php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ? in php_openssl_sockop_io()
2163 int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); in php_openssl_sockop_io()
2173 php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_WRITE) ? in php_openssl_sockop_io()
2176 php_pollfd_for(sslsock->s.socket, (err == SSL_ERROR_WANT_READ) ? in php_openssl_sockop_io()
2191 if (began_blocked && php_set_sock_blocking(sslsock->s.socket, 1) == SUCCESS) { in php_openssl_sockop_io()
2192 sslsock->s.is_blocked = 1; in php_openssl_sockop_io()
2240 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_close() local
2247 if (sslsock->ssl_active) { in php_openssl_sockop_close()
2248 SSL_shutdown(sslsock->ssl_handle); in php_openssl_sockop_close()
2249 sslsock->ssl_active = 0; in php_openssl_sockop_close()
2251 if (sslsock->ssl_handle) { in php_openssl_sockop_close()
2252 SSL_free(sslsock->ssl_handle); in php_openssl_sockop_close()
2253 sslsock->ssl_handle = NULL; in php_openssl_sockop_close()
2255 if (sslsock->ctx) { in php_openssl_sockop_close()
2256 SSL_CTX_free(sslsock->ctx); in php_openssl_sockop_close()
2257 sslsock->ctx = NULL; in php_openssl_sockop_close()
2260 if (sslsock->alpn_ctx.data) { in php_openssl_sockop_close()
2261 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2265 if (sslsock->s.socket == -1) in php_openssl_sockop_close()
2266 sslsock->s.socket = SOCK_ERR; in php_openssl_sockop_close()
2268 if (sslsock->s.socket != SOCK_ERR) { in php_openssl_sockop_close()
2271 shutdown(sslsock->s.socket, SHUT_RD); in php_openssl_sockop_close()
2280 n = php_pollfd_for_ms(sslsock->s.socket, POLLOUT, 500); in php_openssl_sockop_close()
2283 closesocket(sslsock->s.socket); in php_openssl_sockop_close()
2284 sslsock->s.socket = SOCK_ERR; in php_openssl_sockop_close()
2288 if (sslsock->sni_certs) { in php_openssl_sockop_close()
2289 for (i = 0; i < sslsock->sni_cert_count; i++) { in php_openssl_sockop_close()
2290 if (sslsock->sni_certs[i].ctx) { in php_openssl_sockop_close()
2291 SSL_CTX_free(sslsock->sni_certs[i].ctx); in php_openssl_sockop_close()
2292 pefree(sslsock->sni_certs[i].name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2295 pefree(sslsock->sni_certs, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2296 sslsock->sni_certs = NULL; in php_openssl_sockop_close()
2299 if (sslsock->url_name) { in php_openssl_sockop_close()
2300 pefree(sslsock->url_name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2303 if (sslsock->reneg) { in php_openssl_sockop_close()
2304 pefree(sslsock->reneg, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2307 pefree(sslsock, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2394 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_set_option() local
2400 if (sslsock->ssl_active) { in php_openssl_sockop_set_option()
2407 switch (SSL_version(sslsock->ssl_handle)) { in php_openssl_sockop_set_option()
2424 cipher = SSL_get_current_cipher(sslsock->ssl_handle); in php_openssl_sockop_set_option()
2436 SSL_get0_alpn_selected(sslsock->ssl_handle, &alpn_proto, &alpn_proto_len); in php_openssl_sockop_set_option()
2445 add_assoc_bool((zval *)ptrparam, "timed_out", sslsock->s.timeout_event); in php_openssl_sockop_set_option()
2446 add_assoc_bool((zval *)ptrparam, "blocked", sslsock->s.is_blocked); in php_openssl_sockop_set_option()
2458 if (sslsock->s.timeout.tv_sec == -1) { in php_openssl_sockop_set_option()
2466 tv = sslsock->connect_timeout; in php_openssl_sockop_set_option()
2473 if (sslsock->s.socket == -1) { in php_openssl_sockop_set_option()
2477 !sslsock->ssl_active && in php_openssl_sockop_set_option()
2480 ((MSG_DONTWAIT != 0) || !sslsock->s.is_blocked) in php_openssl_sockop_set_option()
2482 php_pollfd_for(sslsock->s.socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0 in php_openssl_sockop_set_option()
2486 if (sslsock->ssl_active) { in php_openssl_sockop_set_option()
2490 int began_blocked = sslsock->s.is_blocked; in php_openssl_sockop_set_option()
2498 if (timeout && php_set_sock_blocking(sslsock->s.socket, 0) == SUCCESS) { in php_openssl_sockop_set_option()
2499 sslsock->s.is_blocked = 0; in php_openssl_sockop_set_option()
2502 …if (!sslsock->s.is_blocked && timeout && (timeout->tv_sec > 0 || (timeout->tv_sec == 0 && timeout-… in php_openssl_sockop_set_option()
2523 php_set_sock_blocking(sslsock->s.socket, 1); in php_openssl_sockop_set_option()
2524 sslsock->s.is_blocked = 1; in php_openssl_sockop_set_option()
2526 sslsock->s.timeout_event = 1; in php_openssl_sockop_set_option()
2531 int n = SSL_peek(sslsock->ssl_handle, &buf, sizeof(buf)); in php_openssl_sockop_set_option()
2535 int err = SSL_get_error(sslsock->ssl_handle, n); in php_openssl_sockop_set_option()
2561 …if (php_pollfd_for(sslsock->s.socket, PHP_POLLREADABLE|POLLPRI|POLLOUT, has_timeout ? &left_time :… in php_openssl_sockop_set_option()
2573 if (began_blocked && !sslsock->s.is_blocked) { in php_openssl_sockop_set_option()
2575 php_set_sock_blocking(sslsock->s.socket, 1); in php_openssl_sockop_set_option()
2576 sslsock->s.is_blocked = 1; in php_openssl_sockop_set_option()
2586 ret = recv(sslsock->s.socket, &buf, sizeof(buf), MSG_PEEK|MSG_DONTWAIT); in php_openssl_sockop_set_option()
2602 cparam->outputs.returncode = php_openssl_setup_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2606 cparam->outputs.returncode = php_openssl_enable_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2625 if ((sslsock->enable_on_connect) && in php_openssl_sockop_set_option()
2630 if (php_stream_xport_crypto_setup(stream, sslsock->method, NULL) < 0 || in php_openssl_sockop_set_option()
2641 xparam->outputs.returncode = php_openssl_tcp_sockop_accept(stream, sslsock, xparam STREAMS_CC); in php_openssl_sockop_set_option()
2658 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_cast() local
2662 if (sslsock->ssl_active) { in php_openssl_sockop_cast()
2666 *ret = fdopen(sslsock->s.socket, stream->mode); in php_openssl_sockop_cast()
2678 && sslsock->ssl_active in php_openssl_sockop_cast()
2679 && (pending = (size_t)SSL_pending(sslsock->ssl_handle)) > 0) { in php_openssl_sockop_cast()
2685 *(php_socket_t *)ret = sslsock->s.socket; in php_openssl_sockop_cast()
2691 if (sslsock->ssl_active) { in php_openssl_sockop_cast()
2695 *(php_socket_t *)ret = sslsock->s.socket; in php_openssl_sockop_cast()
2772 php_openssl_netstream_data_t *sslsock = NULL; in php_openssl_ssl_socket_factory() local
2774 sslsock = pemalloc(sizeof(php_openssl_netstream_data_t), persistent_id ? 1 : 0); in php_openssl_ssl_socket_factory()
2775 memset(sslsock, 0, sizeof(*sslsock)); in php_openssl_ssl_socket_factory()
2777 sslsock->s.is_blocked = 1; in php_openssl_ssl_socket_factory()
2780 sslsock->s.timeout.tv_sec = (long)FG(default_socket_timeout); in php_openssl_ssl_socket_factory()
2782 sslsock->s.timeout.tv_sec = (time_t)FG(default_socket_timeout); in php_openssl_ssl_socket_factory()
2784 sslsock->s.timeout.tv_usec = 0; in php_openssl_ssl_socket_factory()
2787 sslsock->connect_timeout.tv_sec = timeout->tv_sec; in php_openssl_ssl_socket_factory()
2788 sslsock->connect_timeout.tv_usec = timeout->tv_usec; in php_openssl_ssl_socket_factory()
2792 sslsock->s.socket = -1; in php_openssl_ssl_socket_factory()
2795 sslsock->ctx = NULL; in php_openssl_ssl_socket_factory()
2797 stream = php_stream_alloc_rel(&php_openssl_socket_ops, sslsock, persistent_id, "r+"); in php_openssl_ssl_socket_factory()
2800 pefree(sslsock, persistent_id ? 1 : 0); in php_openssl_ssl_socket_factory()
2805 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2806 sslsock->method = php_openssl_get_crypto_method(context, STREAM_CRYPTO_METHOD_TLS_ANY_CLIENT); in php_openssl_ssl_socket_factory()
2813 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2814 sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT; in php_openssl_ssl_socket_factory()
2822 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2823 sslsock->method = php_openssl_get_crypto_method(context, STREAM_CRYPTO_METHOD_TLS_ANY_CLIENT); in php_openssl_ssl_socket_factory()
2825 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2826 sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT; in php_openssl_ssl_socket_factory()
2829 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2830 sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; in php_openssl_ssl_socket_factory()
2839 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2840 sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; in php_openssl_ssl_socket_factory()
2849 sslsock->enable_on_connect = 1; in php_openssl_ssl_socket_factory()
2850 sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT; in php_openssl_ssl_socket_factory()
2859 sslsock->url_name = php_openssl_get_url_name(resourcename, resourcenamelen, !!persistent_id); in php_openssl_ssl_socket_factory()