Lines Matching refs:ssl

57 static int handle_io_failure(SSL *ssl, int res);
211 static void wait_for_activity(SSL *ssl) in wait_for_activity() argument
219 sock = SSL_get_fd(ssl); in wait_for_activity()
228 if (SSL_net_write_desired(ssl)) in wait_for_activity()
230 if (SSL_net_read_desired(ssl)) in wait_for_activity()
238 if (SSL_get_event_timeout(ssl, &tv, &isinfinite) && !isinfinite) in wait_for_activity()
285 static int handle_io_failure(SSL *ssl, int res) in handle_io_failure() argument
287 switch (SSL_get_error(ssl, res)) { in handle_io_failure()
291 wait_for_activity(ssl); in handle_io_failure()
307 switch (SSL_get_stream_read_state(ssl)) { in handle_io_failure()
329 if (SSL_get_verify_result(ssl) != X509_V_OK) in handle_io_failure()
331 X509_verify_cert_error_string(SSL_get_verify_result(ssl))); in handle_io_failure()
366 static int cache_new_session(struct ssl_st *ssl, SSL_SESSION *sess) in cache_new_session() argument
400 static int setup_session_cache(SSL *ssl, SSL_CTX *ctx, const char *filename) in setup_session_cache() argument
433 if (!SSL_set_session(ssl, sess)) in setup_session_cache()
526 static size_t build_request_set(SSL *ssl) in build_request_set() argument
541 SSL_free(poll_list[poll_idx].desc.value.ssl); in build_request_set()
616 new_stream = SSL_new_stream(ssl, 0); in build_request_set()
635 while (!SSL_write_ex2(poll_list[poll_idx].desc.value.ssl, in build_request_set()
638 if (handle_io_failure(poll_list[poll_idx].desc.value.ssl, 0) == 1) in build_request_set()
651 SSL_free(poll_list[poll_idx].desc.value.ssl); in build_request_set()
686 SSL_CTX **ctx, SSL **ssl) in setup_connection() argument
733 *ssl = SSL_new(*ctx); in setup_connection()
734 if (*ssl == NULL) { in setup_connection()
740 if (!setup_session_cache(*ssl, *ctx, getenv("SSL_SESSION_FILE"))) { in setup_connection()
756 SSL_set_bio(*ssl, bio, bio); in setup_connection()
762 if (!SSL_set_tlsext_host_name(*ssl, hostname)) { in setup_connection()
773 if (!SSL_set1_host(*ssl, hostname)) { in setup_connection()
779 if (SSL_set_alpn_protos(*ssl, alpn, sizeof(alpn)) != 0) { in setup_connection()
785 if (!SSL_set1_initial_peer_addr(*ssl, peer_addr)) { in setup_connection()
795 if (!SSL_set_blocking_mode(*ssl, 0)) { in setup_connection()
801 while ((ret = SSL_connect(*ssl)) != 1) { in setup_connection()
802 if (handle_io_failure(*ssl, ret) == 1) in setup_connection()
811 SSL_free(*ssl); in setup_connection()
843 SSL *ssl = NULL; in main() local
904 if (!setup_connection(hostname, port, ipv6, &ctx, &ssl)) { in main()
919 this_poll_count = build_request_set(ssl); in main()
959 if (!SSL_read_ex(poll_list[poll_idx].desc.value.ssl, buf, in main()
961 switch (handle_io_failure(poll_list[poll_idx].desc.value.ssl, in main()
996 this_poll_count = build_request_set(ssl); in main()
1006 while ((ret = SSL_shutdown(ssl)) != 1) { in main()
1007 if (ret < 0 && handle_io_failure(ssl, ret) == 1) in main()
1032 SSL_free(poll_list[poll_idx].desc.value.ssl); in main()
1034 SSL_free(ssl); in main()