Lines Matching refs:stream

108 …(PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "s…
130 static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count);
183 static int php_openssl_is_http_stream_talking_to_iis(php_stream *stream) /* {{{ */ in php_openssl_is_http_stream_talking_to_iis() argument
185 if (Z_TYPE(stream->wrapperdata) == IS_ARRAY && in php_openssl_is_http_stream_talking_to_iis()
186 stream->wrapper && in php_openssl_is_http_stream_talking_to_iis()
187 strcasecmp(stream->wrapper->wops->label, "HTTP") == 0 in php_openssl_is_http_stream_talking_to_iis()
195 ZEND_HASH_FOREACH_VAL(Z_ARRVAL(stream->wrapperdata), tmp) { in php_openssl_is_http_stream_talking_to_iis()
207 static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init) /* {{{… in php_openssl_handle_ssl_error() argument
209 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_handle_ssl_error()
231 if (!php_openssl_is_http_stream_talking_to_iis(stream) && ERR_get_error() != 0) { in php_openssl_handle_ssl_error()
235 stream->eof = 1; in php_openssl_handle_ssl_error()
295 php_stream *stream; in verify_callback() local
310 stream = (php_stream*)SSL_get_ex_data(ssl, php_openssl_get_ssl_stream_data_index()); in verify_callback()
510 static int php_openssl_apply_peer_verification_policy(SSL *ssl, X509 *peer, php_stream *stream) /* … in php_openssl_apply_peer_verification_policy() argument
520 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_apply_peer_verification_policy()
606 php_stream *stream = (php_stream *)data; in php_openssl_passwd_callback() local
635 php_stream *stream; in php_openssl_win_cert_verify_callback() local
641 stream = (php_stream*)arg; in php_openssl_win_cert_verify_callback()
642 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_win_cert_verify_callback()
758 php_stream *stream; in php_openssl_load_stream_cafile() local
766 stream = php_stream_open_wrapper(cafile, "rb", 0, NULL); in php_openssl_load_stream_cafile()
768 if (stream == NULL) { in php_openssl_load_stream_cafile()
771 } else if (stream->wrapper->is_url) { in php_openssl_load_stream_cafile()
772 php_stream_close(stream); in php_openssl_load_stream_cafile()
778 line = php_stream_get_line(stream, NULL, 0, &line_len); in php_openssl_load_stream_cafile()
796 line = php_stream_get_line(stream, NULL, 0, &line_len); in php_openssl_load_stream_cafile()
823 php_stream_close(stream); in php_openssl_load_stream_cafile()
837 static int php_openssl_enable_peer_verification(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_enable_peer_verification() argument
842 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_enable_peer_verification()
875 SSL_CTX_set_cert_verify_callback(ctx, php_openssl_win_cert_verify_callback, (void *)stream); in php_openssl_enable_peer_verification()
892 static void php_openssl_disable_peer_verification(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_disable_peer_verification() argument
898 static int php_openssl_set_local_cert(SSL_CTX *ctx, php_stream *stream) /* {{{ */ in php_openssl_set_local_cert() argument
1072 php_stream *stream; in php_openssl_limit_handshake_reneg() local
1077 stream = php_openssl_get_stream_from_ssl_handle(ssl); in php_openssl_limit_handshake_reneg()
1078 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_limit_handshake_reneg()
1103 if (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_limit_handshake_reneg()
1108 php_stream_to_zval(stream, &param); in php_openssl_limit_handshake_reneg()
1111 stream->flags |= PHP_STREAM_FLAG_NO_FCLOSE; in php_openssl_limit_handshake_reneg()
1115 stream->flags ^= PHP_STREAM_FLAG_NO_FCLOSE; in php_openssl_limit_handshake_reneg()
1140 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
1146 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_init_server_reneg_limit()
1147 NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit")) in php_openssl_init_server_reneg_limit()
1157 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_init_server_reneg_limit()
1158 NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_window")) in php_openssl_init_server_reneg_limit()
1164 php_stream_is_persistent(stream) in php_openssl_init_server_reneg_limit()
1201 static int php_openssl_set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_dh_param() argument
1207 zdhpath = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "dh_param"); in php_openssl_set_server_dh_param()
1250 static int php_openssl_set_server_ecdh_curve(php_stream *stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_ecdh_curve() argument
1256 zvcurve = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "ecdh_curve"); in php_openssl_set_server_ecdh_curve()
1290 static int php_openssl_set_server_specific_opts(php_stream *stream, SSL_CTX *ctx) /* {{{ */ in php_openssl_set_server_specific_opts() argument
1296 if (php_openssl_set_server_ecdh_curve(stream, ctx) == FAILURE) { in php_openssl_set_server_specific_opts()
1305 if (php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size") != NULL) { in php_openssl_set_server_specific_opts()
1309 php_openssl_set_server_dh_param(stream, ctx); in php_openssl_set_server_specific_opts()
1310 zv = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "single_dh_use"); in php_openssl_set_server_specific_opts()
1315 zv = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "honor_cipher_order"); in php_openssl_set_server_specific_opts()
1329 php_stream *stream; in php_openssl_server_sni_callback() local
1340 stream = (php_stream*)SSL_get_ex_data(ssl_handle, php_openssl_get_ssl_stream_data_index()); in php_openssl_server_sni_callback()
1341 sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_server_sni_callback()
1386 static int php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock)… in php_openssl_enable_server_sni() argument
1422 sizeof(php_openssl_sni_cert_t), 0, php_stream_is_persistent(stream) in php_openssl_enable_server_sni()
1501 sslsock->sni_certs[i].name = pestrdup(ZSTR_VAL(key), php_stream_is_persistent(stream)); in php_openssl_enable_server_sni()
1513 static void php_openssl_enable_client_sni(php_stream *stream, php_openssl_netstream_data_t *sslsock… in php_openssl_enable_client_sni() argument
1591 int php_openssl_setup_crypto(php_stream *stream, in php_openssl_setup_crypto() argument
1648 php_openssl_disable_peer_verification(sslsock->ctx, stream); in php_openssl_setup_crypto()
1649 } else if (FAILURE == php_openssl_enable_peer_verification(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1655 SSL_CTX_set_default_passwd_cb_userdata(sslsock->ctx, stream); in php_openssl_setup_crypto()
1697 ….data = (unsigned char *) pestrndup((const char*)alpn, alpn_len, php_stream_is_persistent(stream)); in php_openssl_setup_crypto()
1710 if (FAILURE == php_openssl_set_local_cert(sslsock->ctx, stream)) { in php_openssl_setup_crypto()
1722 PHP_STREAM_CONTEXT(stream) && in php_openssl_setup_crypto()
1723 FAILURE == php_openssl_set_server_specific_opts(stream, sslsock->ctx) in php_openssl_setup_crypto()
1736 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_setup_crypto()
1742 SSL_set_ex_data(sslsock->ssl_handle, php_openssl_get_ssl_stream_data_index(), stream); in php_openssl_setup_crypto()
1746 php_openssl_handle_ssl_error(stream, 0, 1); in php_openssl_setup_crypto()
1751 if (!sslsock->is_client && php_openssl_enable_server_sni(stream, sslsock) == FAILURE) { in php_openssl_setup_crypto()
1758 php_openssl_init_server_reneg_limit(stream, sslsock); in php_openssl_setup_crypto()
1823 static int php_openssl_capture_peer_certs(php_stream *stream, in php_openssl_capture_peer_certs() argument
1829 if (NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_capture_peer_certs()
1834 php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_certificate", &zcert); in php_openssl_capture_peer_certs()
1839 if (NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_capture_peer_certs()
1862 php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_certificate_chain", &arr); in php_openssl_capture_peer_certs()
1870 static int php_openssl_enable_crypto(php_stream *stream, in php_openssl_enable_crypto() argument
1885 php_openssl_enable_client_sni(stream, sslsock); in php_openssl_enable_crypto()
1941 retry = php_openssl_handle_ssl_error(stream, n, blocked); in php_openssl_enable_crypto()
1965 if (peer_cert && PHP_STREAM_CONTEXT(stream)) { in php_openssl_enable_crypto()
1966 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
1969 …if (FAILURE == php_openssl_apply_peer_verification_policy(sslsock->ssl_handle, peer_cert, stream))… in php_openssl_enable_crypto()
1975 if (PHP_STREAM_CONTEXT(stream)) { in php_openssl_enable_crypto()
1977 if (NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), in php_openssl_enable_crypto()
1988 php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "session_meta", &meta_arr); in php_openssl_enable_crypto()
1999 if (peer_cert && PHP_STREAM_CONTEXT(stream)) { in php_openssl_enable_crypto()
2000 cert_captured = php_openssl_capture_peer_certs(stream, sslsock, peer_cert); in php_openssl_enable_crypto()
2020 static ssize_t php_openssl_sockop_read(php_stream *stream, char *buf, size_t count) /* {{{ */ in php_openssl_sockop_read() argument
2022 return php_openssl_sockop_io( 1, stream, buf, count ); in php_openssl_sockop_read()
2026 static ssize_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count) /* {{{ */ in php_openssl_sockop_write() argument
2028 return php_openssl_sockop_io( 0, stream, (char*)buf, count ); in php_openssl_sockop_write()
2038 static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, size_t count) /* {{{ … in php_openssl_sockop_io() argument
2040 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_io()
2101 php_stream_xport_shutdown(stream, (stream_shutdown_t)SHUT_RDWR); in php_openssl_sockop_io()
2103 stream->eof = 1; in php_openssl_sockop_io()
2120 retry = php_openssl_handle_ssl_error(stream, nr_bytes, 0); in php_openssl_sockop_io()
2132 stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); in php_openssl_sockop_io()
2178 php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), nr_bytes, 0); in php_openssl_sockop_io()
2192 nr_bytes = php_stream_socket_ops.read(stream, buf, count); in php_openssl_sockop_io()
2194 nr_bytes = php_stream_socket_ops.write(stream, buf, count); in php_openssl_sockop_io()
2229 static int php_openssl_sockop_close(php_stream *stream, int close_handle) /* {{{ */ in php_openssl_sockop_close() argument
2231 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_close()
2252 pefree(sslsock->alpn_ctx.data, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2283 pefree(sslsock->sni_certs[i].name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2286 pefree(sslsock->sni_certs, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2291 pefree(sslsock->url_name, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2295 pefree(sslsock->reneg, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2298 pefree(sslsock, php_stream_is_persistent(stream)); in php_openssl_sockop_close()
2304 static int php_openssl_sockop_flush(php_stream *stream) /* {{{ */ in php_openssl_sockop_flush() argument
2306 return php_stream_socket_ops.flush(stream); in php_openssl_sockop_flush()
2310 static int php_openssl_sockop_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ */ in php_openssl_sockop_stat() argument
2312 return php_stream_socket_ops.stat(stream, ssb); in php_openssl_sockop_stat()
2316 static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_netstream_data_t *s… in php_openssl_tcp_sockop_accept() argument
2325 if (PHP_STREAM_CONTEXT(stream) && in php_openssl_tcp_sockop_accept()
2326 …(tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "tcp_nodelay")) != … in php_openssl_tcp_sockop_accept()
2349 xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+"); in php_openssl_tcp_sockop_accept()
2351 xparam->outputs.client->ctx = stream->ctx; in php_openssl_tcp_sockop_accept()
2352 if (stream->ctx) { in php_openssl_tcp_sockop_accept()
2353 GC_ADDREF(stream->ctx); in php_openssl_tcp_sockop_accept()
2381 static int php_openssl_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam)… in php_openssl_sockop_set_option() argument
2383 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_set_option()
2436 add_assoc_bool((zval *)ptrparam, "eof", stream->eof); in php_openssl_sockop_set_option()
2494 cparam->outputs.returncode = php_openssl_setup_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2498 cparam->outputs.returncode = php_openssl_enable_crypto(stream, sslsock, cparam); in php_openssl_sockop_set_option()
2515 php_stream_socket_ops.set_option(stream, option, value, ptrparam); in php_openssl_sockop_set_option()
2522 if (php_stream_xport_crypto_setup(stream, sslsock->method, NULL) < 0 || in php_openssl_sockop_set_option()
2523 php_stream_xport_crypto_enable(stream, 1) < 0) { in php_openssl_sockop_set_option()
2533 xparam->outputs.returncode = php_openssl_tcp_sockop_accept(stream, sslsock, xparam STREAMS_CC); in php_openssl_sockop_set_option()
2544 return php_stream_socket_ops.set_option(stream, option, value, ptrparam); in php_openssl_sockop_set_option()
2548 static int php_openssl_sockop_cast(php_stream *stream, int castas, void **ret) /* {{{ */ in php_openssl_sockop_cast() argument
2550 php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; in php_openssl_sockop_cast()
2558 *ret = fdopen(sslsock->s.socket, stream->mode); in php_openssl_sockop_cast()
2569 if (stream->writepos == stream->readpos in php_openssl_sockop_cast()
2572 php_stream_fill_read_buffer(stream, pending < stream->chunk_size in php_openssl_sockop_cast()
2574 : stream->chunk_size); in php_openssl_sockop_cast()
2663 php_stream *stream = NULL; in php_openssl_ssl_socket_factory() local
2689 stream = php_stream_alloc_rel(&php_openssl_socket_ops, sslsock, persistent_id, "r+"); in php_openssl_ssl_socket_factory()
2691 if (stream == NULL) { in php_openssl_ssl_socket_factory()
2701 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2710 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2726 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2736 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2746 php_stream_close(stream); in php_openssl_ssl_socket_factory()
2753 return stream; in php_openssl_ssl_socket_factory()