Lines Matching refs:stream

106 …(PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "s…
145 static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count);
198 static int php_openssl_is_http_stream_talking_to_iis(php_stream *stream) /* {{{ */ in php_openssl_is_http_stream_talking_to_iis() argument
200 if (Z_TYPE(stream->wrapperdata) == IS_ARRAY && in php_openssl_is_http_stream_talking_to_iis()
201 stream->wrapper && in php_openssl_is_http_stream_talking_to_iis()
202 strcasecmp(stream->wrapper->wops->label, "HTTP") == 0 in php_openssl_is_http_stream_talking_to_iis()
210 ZEND_HASH_FOREACH_VAL(Z_ARRVAL(stream->wrapperdata), tmp) { in php_openssl_is_http_stream_talking_to_iis()
222 static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, bool is_init) /* {{{ */ in php_openssl_handle_ssl_error() argument
224 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_handle_ssl_error()
246 if (!php_openssl_is_http_stream_talking_to_iis(stream) && ERR_get_error() != 0) { in php_openssl_handle_ssl_error()
250 stream->eof = 1; in php_openssl_handle_ssl_error()
309 php_stream *stream; in verify_callback() local
324 stream = (php_stream*)SSL_get_ex_data(ssl, php_openssl_get_ssl_stream_data_index()); in verify_callback()
544 static int php_openssl_apply_peer_verification_policy(SSL *ssl, X509 *peer, php_stream *stream) /* … in php_openssl_apply_peer_verification_policy() argument
554 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_apply_peer_verification_policy()
641 php_stream *stream = (php_stream *)data; in php_openssl_passwd_callback() local
670 php_stream *stream; in php_openssl_win_cert_verify_callback() local
676 stream = (php_stream*)arg; in php_openssl_win_cert_verify_callback()
677 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_win_cert_verify_callback()
793 php_stream *stream; in php_openssl_load_stream_cafile() local
801 stream = php_stream_open_wrapper(cafile, "rb", 0, NULL); in php_openssl_load_stream_cafile()
803 if (stream == NULL) { in php_openssl_load_stream_cafile()
806 } else if (stream->wrapper->is_url) { in php_openssl_load_stream_cafile()
807 php_stream_close(stream); in php_openssl_load_stream_cafile()
813 line = php_stream_get_line(stream, NULL, 0, &line_len); in php_openssl_load_stream_cafile()
831 line = php_stream_get_line(stream, NULL, 0, &line_len); in php_openssl_load_stream_cafile()
858 php_stream_close(stream); in php_openssl_load_stream_cafile()
872 static int php_openssl_enable_peer_verification(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_enable_peer_verification() argument
877 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_enable_peer_verification()
910 SSL_CTX_set_cert_verify_callback(ctx, php_openssl_win_cert_verify_callback, (void *)stream); in php_openssl_enable_peer_verification()
926 static void php_openssl_disable_peer_verification(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_disable_peer_verification() argument
932 static int php_openssl_set_local_cert(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_set_local_cert() argument
1106 php_stream *stream; in php_openssl_limit_handshake_reneg() local
1111 stream = php_openssl_get_stream_from_ssl_handle(ssl); in php_openssl_limit_handshake_reneg()
1112 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_limit_handshake_reneg()
1137 if (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_limit_handshake_reneg()
1142 php_stream_to_zval(stream, &param); in php_openssl_limit_handshake_reneg()
1145 stream->flags |= PHP_STREAM_FLAG_NO_FCLOSE; in php_openssl_limit_handshake_reneg()
1149 stream->flags ^= PHP_STREAM_FLAG_NO_FCLOSE; in php_openssl_limit_handshake_reneg()
1174 static void php_openssl_init_server_reneg_limit(php_stream *stream, php_openssl_netstream_data_t *s… in php_openssl_init_server_reneg_limit() argument
1180 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_init_server_reneg_limit()
1181 NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit")) in php_openssl_init_server_reneg_limit()
1191 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_init_server_reneg_limit()
1192 NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_window")) in php_openssl_init_server_reneg_limit()
1198 php_stream_is_persistent(stream) in php_openssl_init_server_reneg_limit()
1235 static int php_openssl_set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_dh_param() argument
1237 zval *zdhpath = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "dh_param"); in php_openssl_set_server_dh_param()
1296 static int php_openssl_set_server_ecdh_curve(php_stream *stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_ecdh_curve() argument
1302 zvcurve = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "ecdh_curve"); in php_openssl_set_server_ecdh_curve()
1332 static int php_openssl_set_server_specific_opts(php_stream *stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_specific_opts() argument
1338 if (php_openssl_set_server_ecdh_curve(stream, ctx) == FAILURE) { in php_openssl_set_server_specific_opts()
1347 if (php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size") != NULL) { in php_openssl_set_server_specific_opts()
1351 if (php_openssl_set_server_dh_param(stream, ctx) == FAILURE) { in php_openssl_set_server_specific_opts()
1355 zv = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "single_dh_use"); in php_openssl_set_server_specific_opts()
1360 zv = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "honor_cipher_order"); in php_openssl_set_server_specific_opts()
1374 php_stream *stream; in php_openssl_server_sni_callback() local
1385 stream = (php_stream*)SSL_get_ex_data(ssl_handle, php_openssl_get_ssl_stream_data_index()); in php_openssl_server_sni_callback()
1386 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_server_sni_callback()
1431 static int php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock)… in php_openssl_enable_server_sni() argument
1467 sizeof(php_openssl_sni_cert_t), 0, php_stream_is_persistent(stream) in php_openssl_enable_server_sni()
1546 sslsock->sni_certs[i].name = pestrdup(ZSTR_VAL(key), php_stream_is_persistent(stream)); in php_openssl_enable_server_sni()
1558 static void php_openssl_enable_client_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock… in php_openssl_enable_client_sni() argument
1636 int php_openssl_setup_crypto(php_stream *stream, in php_openssl_setup_crypto() argument
1698 php_openssl_disable_peer_verification(sslsock->ctx, stream); in php_openssl_setup_crypto()
1699 } else if (FAILURE == php_openssl_enable_peer_verification(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1705 SSL_CTX_set_default_passwd_cb_userdata(sslsock->ctx, stream); in php_openssl_setup_crypto()
1747 ….data = (unsigned char *) pestrndup((const char*)alpn, alpn_len, php_stream_is_persistent(stream)); in php_openssl_setup_crypto()
1760 if (FAILURE == php_openssl_set_local_cert(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1772 PHP_STREAM_CONTEXT(stream) && in php_openssl_setup_crypto()
1773 FAILURE == php_openssl_set_server_specific_opts(stream, sslsock->ctx) in php_openssl_setup_crypto()
1786 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_setup_crypto()
1792 SSL_set_ex_data(sslsock->ssl_handle, php_openssl_get_ssl_stream_data_index(), stream); in php_openssl_setup_crypto()
1796 php_openssl_handle_ssl_error(stream, 0, 1); in php_openssl_setup_crypto()
1801 if (!sslsock->is_client && php_openssl_enable_server_sni(stream, sslsock) == FAILURE) { in php_openssl_setup_crypto()
1808 php_openssl_init_server_reneg_limit(stream, sslsock); in php_openssl_setup_crypto()
1829 static int php_openssl_capture_peer_certs(php_stream *stream, in php_openssl_capture_peer_certs() argument
1836 if (NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_capture_peer_certs()
1844 php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_certificate", &zcert); in php_openssl_capture_peer_certs()
1849 if (NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_capture_peer_certs()
1875 php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_certificate_chain", &arr); in php_openssl_capture_peer_certs()
1883 static int php_openssl_enable_crypto(php_stream *stream, in php_openssl_enable_crypto() argument
1898 php_openssl_enable_client_sni(stream, sslsock); in php_openssl_enable_crypto()
1954 retry = php_openssl_handle_ssl_error(stream, n, blocked); in php_openssl_enable_crypto()
1978 if (peer_cert && PHP_STREAM_CONTEXT(stream)) { in php_openssl_enable_crypto()
1979 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
1982 …if (FAILURE == php_openssl_apply_peer_verification_policy(sslsock->ssl_handle, peer_cert, stream))… in php_openssl_enable_crypto()
1994 if (peer_cert && PHP_STREAM_CONTEXT(stream)) { in php_openssl_enable_crypto()
1995 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
2015 static ssize_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count) /* {{{ */ in php_openssl_sockop_read() argument
2017 return php_openssl_sockop_io( 1, stream, buf, count ); in php_openssl_sockop_read()
2021 static ssize_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count) /* {{{ */ in php_openssl_sockop_write() argument
2023 return php_openssl_sockop_io( 0, stream, (char*)buf, count ); in php_openssl_sockop_write()
2033 static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count) /* {{{ … in php_openssl_sockop_io() argument
2035 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_io()
2096 php_stream_xport_shutdown(stream, (stream_shutdown_t)SHUT_RDWR); in php_openssl_sockop_io()
2098 stream->eof = 1; in php_openssl_sockop_io()
2115 retry = php_openssl_handle_ssl_error(stream, nr_bytes, 0); in php_openssl_sockop_io()
2127 stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); in php_openssl_sockop_io()
2173 php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), nr_bytes, 0); in php_openssl_sockop_io()
2187 nr_bytes = php_stream_socket_ops.read(stream, buf, count); in php_openssl_sockop_io()
2189 nr_bytes = php_stream_socket_ops.write(stream, buf, count); in php_openssl_sockop_io()
2224 static int php_openssl_sockop_close(php_stream *stream, int close_handle) /* {{{ */ in php_openssl_sockop_close() argument
2226 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_close()
2247 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2278 pefree(sslsock->sni_certs[i].name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2281 pefree(sslsock->sni_certs, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2286 pefree(sslsock->url_name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2290 pefree(sslsock->reneg, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2293 pefree(sslsock, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2299 static int php_openssl_sockop_flush(php_stream *stream) /* {{{ */ in php_openssl_sockop_flush() argument
2301 return php_stream_socket_ops.flush(stream); in php_openssl_sockop_flush()
2305 static int php_openssl_sockop_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ */ in php_openssl_sockop_stat() argument
2307 return php_stream_socket_ops.stat(stream, ssb); in php_openssl_sockop_stat()
2311 static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_netstream_data_t *s… in php_openssl_tcp_sockop_accept() argument
2320 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_tcp_sockop_accept()
2321 …(tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "tcp_nodelay")) != … in php_openssl_tcp_sockop_accept()
2348 xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+"); in php_openssl_tcp_sockop_accept()
2350 xparam->outputs.client->ctx = stream->ctx; in php_openssl_tcp_sockop_accept()
2351 if (stream->ctx) { in php_openssl_tcp_sockop_accept()
2352 GC_ADDREF(stream->ctx); in php_openssl_tcp_sockop_accept()
2380 static int php_openssl_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam)… in php_openssl_sockop_set_option() argument
2382 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_set_option()
2435 add_assoc_bool((zval *)ptrparam, "eof", stream->eof); in php_openssl_sockop_set_option()
2493 cparam->outputs.returncode = php_openssl_setup_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2497 cparam->outputs.returncode = php_openssl_enable_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2514 php_stream_socket_ops.set_option(stream, option, value, ptrparam); in php_openssl_sockop_set_option()
2521 if (php_stream_xport_crypto_setup(stream, sslsock->method, NULL) < 0 || in php_openssl_sockop_set_option()
2522 php_stream_xport_crypto_enable(stream, 1) < 0) { in php_openssl_sockop_set_option()
2532 xparam->outputs.returncode = php_openssl_tcp_sockop_accept(stream, sslsock, xparam STREAMS_CC); in php_openssl_sockop_set_option()
2543 return php_stream_socket_ops.set_option(stream, option, value, ptrparam); in php_openssl_sockop_set_option()
2547 static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret) /* {{{ */ in php_openssl_sockop_cast() argument
2549 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_cast()
2557 *ret = fdopen(sslsock->s.socket, stream->mode); in php_openssl_sockop_cast()
2568 if (stream->writepos == stream->readpos in php_openssl_sockop_cast()
2571 php_stream_fill_read_buffer(stream, pending < stream->chunk_size in php_openssl_sockop_cast()
2573 : stream->chunk_size); in php_openssl_sockop_cast()
2662 php_stream *stream = NULL; in php_openssl_ssl_socket_factory() local
2688 stream = php_stream_alloc_rel(&php_openssl_socket_ops, sslsock, persistent_id, "r+"); in php_openssl_ssl_socket_factory()
2690 if (stream == NULL) { in php_openssl_ssl_socket_factory()
2700 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2709 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2725 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2735 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2745 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2752 return stream; in php_openssl_ssl_socket_factory()