Lines Matching refs:h
30 struct helper *h; member
94 int (*qtf_packet_plain_cb)(struct helper *h, QUIC_PKT_HDR *hdr,
96 int (*qtf_handshake_cb)(struct helper *h,
98 int (*qtf_datagram_cb)(struct helper *h,
114 struct helper *h; member
125 int (*check_func)(struct helper *h, struct helper_local *hl);
128 int (*qtf_packet_plain_cb)(struct helper *h, QUIC_PKT_HDR *hdr,
130 int (*qtf_handshake_cb)(struct helper *h,
132 int (*qtf_datagram_cb)(struct helper *h,
342 struct helper *h = arg; in get_time() local
345 if (!TEST_true(CRYPTO_THREAD_read_lock(h->time_lock))) in get_time()
348 t = ossl_time_add(ossl_time_now(), h->time_slip); in get_time()
350 CRYPTO_THREAD_unlock(h->time_lock); in get_time()
354 static int skip_time_ms(struct helper *h, struct helper_local *hl) in skip_time_ms() argument
356 if (!TEST_true(CRYPTO_THREAD_write_lock(h->time_lock))) in skip_time_ms()
359 h->time_slip = ossl_time_add(h->time_slip, ossl_ms2time(hl->check_op->arg2)); in skip_time_ms()
361 CRYPTO_THREAD_unlock(h->time_lock); in skip_time_ms()
365 static QUIC_TSERVER *s_lock(struct helper *h, struct helper_local *hl);
366 static void s_unlock(struct helper *h, struct helper_local *hl);
368 #define ACQUIRE_S() s_lock(h, hl)
369 #define ACQUIRE_S_NOHL() s_lock(h, NULL)
371 static int check_rejected(struct helper *h, struct helper_local *hl) in check_rejected() argument
377 h->check_spin_again = 1; in check_rejected()
384 static int check_stream_reset(struct helper *h, struct helper_local *hl) in check_stream_reset() argument
389 h->check_spin_again = 1; in check_stream_reset()
396 static int check_stream_stopped(struct helper *h, struct helper_local *hl) in check_stream_stopped() argument
401 h->check_spin_again = 1; in check_stream_stopped()
408 static int override_key_update(struct helper *h, struct helper_local *hl) in override_key_update() argument
410 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn); in override_key_update()
416 static int trigger_key_update(struct helper *h, struct helper_local *hl) in trigger_key_update() argument
418 if (!TEST_true(SSL_key_update(h->c_conn, SSL_KEY_UPDATE_REQUESTED))) in trigger_key_update()
424 static int check_key_update_ge(struct helper *h, struct helper_local *hl) in check_key_update_ge() argument
426 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn); in check_key_update_ge()
445 static int check_key_update_lt(struct helper *h, struct helper_local *hl) in check_key_update_lt() argument
447 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn); in check_key_update_lt()
510 static int join_server_thread(struct helper *h) in join_server_thread() argument
514 if (h->server_thread.t == NULL) in join_server_thread()
517 ossl_crypto_mutex_lock(h->server_thread.m); in join_server_thread()
518 h->server_thread.stop = 1; in join_server_thread()
519 ossl_crypto_condvar_signal(h->server_thread.c); in join_server_thread()
520 ossl_crypto_mutex_unlock(h->server_thread.m); in join_server_thread()
522 ossl_crypto_thread_native_join(h->server_thread.t, &rv); in join_server_thread()
523 ossl_crypto_thread_native_clean(h->server_thread.t); in join_server_thread()
524 h->server_thread.t = NULL; in join_server_thread()
529 static int *s_checked_out_p(struct helper *h, int thread_idx) in s_checked_out_p() argument
531 return (thread_idx < 0) ? &h->s_checked_out in s_checked_out_p()
532 : &h->threads[thread_idx].s_checked_out; in s_checked_out_p()
535 static QUIC_TSERVER *s_lock(struct helper *h, struct helper_local *hl) in s_lock() argument
537 int *p_checked_out = s_checked_out_p(h, hl == NULL ? -1 : hl->thread_idx); in s_lock()
539 if (h->server_thread.m == NULL || *p_checked_out) in s_lock()
540 return h->s; in s_lock()
542 ossl_crypto_mutex_lock(h->server_thread.m); in s_lock()
543 h->s = h->s_priv; in s_lock()
545 return h->s; in s_lock()
549 static void s_unlock(struct helper *h, struct helper_local *hl) in s_unlock() argument
551 int *p_checked_out = s_checked_out_p(h, hl->thread_idx); in s_unlock()
553 if (h->server_thread.m == NULL || !*p_checked_out) in s_unlock()
557 h->s = NULL; in s_unlock()
558 ossl_crypto_mutex_unlock(h->server_thread.m); in s_unlock()
563 struct helper *h = arg; in server_helper_thread() local
565 ossl_crypto_mutex_lock(h->server_thread.m); in server_helper_thread()
570 ready = h->server_thread.ready; in server_helper_thread()
571 stop = h->server_thread.stop; in server_helper_thread()
577 ossl_crypto_condvar_wait(h->server_thread.c, h->server_thread.m); in server_helper_thread()
581 ossl_quic_tserver_tick(h->s_priv); in server_helper_thread()
582 ossl_crypto_mutex_unlock(h->server_thread.m); in server_helper_thread()
588 ossl_crypto_mutex_lock(h->server_thread.m); in server_helper_thread()
591 ossl_crypto_mutex_unlock(h->server_thread.m); in server_helper_thread()
597 static QUIC_TSERVER *s_lock(struct helper *h, struct helper_local *hl) in s_lock() argument
599 return h->s; in s_lock()
602 static void s_unlock(struct helper *h, struct helper_local *hl) in s_unlock() argument
607 static void helper_cleanup(struct helper *h) in helper_cleanup() argument
610 join_threads(h->threads, h->num_threads); in helper_cleanup()
611 join_server_thread(h); in helper_cleanup()
612 OPENSSL_free(h->threads); in helper_cleanup()
613 h->threads = NULL; in helper_cleanup()
614 h->num_threads = 0; in helper_cleanup()
617 if (h->free_order == 0) { in helper_cleanup()
619 helper_cleanup_streams(&h->c_streams); in helper_cleanup()
621 SSL_free(h->c_conn); in helper_cleanup()
622 h->c_conn = NULL; in helper_cleanup()
625 SSL_free(h->c_conn); in helper_cleanup()
626 h->c_conn = NULL; in helper_cleanup()
628 helper_cleanup_streams(&h->c_streams); in helper_cleanup()
631 helper_cleanup_streams(&h->s_streams); in helper_cleanup()
632 ossl_quic_tserver_free(h->s_priv); in helper_cleanup()
633 h->s_priv = h->s = NULL; in helper_cleanup()
635 BIO_free(h->s_net_bio_own); in helper_cleanup()
636 h->s_net_bio_own = NULL; in helper_cleanup()
638 BIO_free(h->c_net_bio_own); in helper_cleanup()
639 h->c_net_bio_own = NULL; in helper_cleanup()
641 BIO_free(h->s_qtf_wbio_own); in helper_cleanup()
642 h->s_qtf_wbio_own = NULL; in helper_cleanup()
644 qtest_fault_free(h->qtf); in helper_cleanup()
645 h->qtf = NULL; in helper_cleanup()
647 if (h->s_fd >= 0) { in helper_cleanup()
648 BIO_closesocket(h->s_fd); in helper_cleanup()
649 h->s_fd = -1; in helper_cleanup()
652 if (h->c_fd >= 0) { in helper_cleanup()
653 BIO_closesocket(h->c_fd); in helper_cleanup()
654 h->c_fd = -1; in helper_cleanup()
657 BIO_ADDR_free(h->s_net_bio_addr); in helper_cleanup()
658 h->s_net_bio_addr = NULL; in helper_cleanup()
659 BIO_ADDR_free(h->s_net_bio_orig_addr); in helper_cleanup()
660 h->s_net_bio_orig_addr = NULL; in helper_cleanup()
662 SSL_CTX_free(h->c_ctx); in helper_cleanup()
663 h->c_ctx = NULL; in helper_cleanup()
665 CRYPTO_THREAD_lock_free(h->time_lock); in helper_cleanup()
666 h->time_lock = NULL; in helper_cleanup()
669 ossl_crypto_mutex_free(&h->misc_m); in helper_cleanup()
670 ossl_crypto_condvar_free(&h->misc_cv); in helper_cleanup()
671 ossl_crypto_mutex_free(&h->server_thread.m); in helper_cleanup()
672 ossl_crypto_condvar_free(&h->server_thread.c); in helper_cleanup()
676 static int helper_init(struct helper *h, const char *script_name, in helper_init() argument
685 memset(h, 0, sizeof(*h)); in helper_init()
686 h->c_fd = -1; in helper_init()
687 h->s_fd = -1; in helper_init()
688 h->free_order = free_order; in helper_init()
689 h->blocking = blocking; in helper_init()
690 h->need_injector = need_injector; in helper_init()
691 h->time_slip = ossl_time_zero(); in helper_init()
693 if (!TEST_ptr(h->time_lock = CRYPTO_THREAD_lock_new())) in helper_init()
696 if (!TEST_ptr(h->s_streams = lh_STREAM_INFO_new(stream_info_hash, in helper_init()
700 if (!TEST_ptr(h->c_streams = lh_STREAM_INFO_new(stream_info_hash, in helper_init()
706 h->s_fd = BIO_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, 0); in helper_init()
707 if (!TEST_int_ge(h->s_fd, 0)) in helper_init()
710 if (!TEST_true(BIO_socket_nbio(h->s_fd, 1))) in helper_init()
713 if (!TEST_ptr(h->s_net_bio_orig_addr = BIO_ADDR_new()) in helper_init()
714 || !TEST_ptr(h->s_net_bio_addr = BIO_ADDR_new())) in helper_init()
717 if (!TEST_true(BIO_ADDR_rawmake(h->s_net_bio_orig_addr, AF_INET, in helper_init()
721 if (!TEST_true(BIO_bind(h->s_fd, h->s_net_bio_orig_addr, 0))) in helper_init()
724 info.addr = h->s_net_bio_addr; in helper_init()
725 if (!TEST_true(BIO_sock_info(h->s_fd, BIO_SOCK_INFO_ADDRESS, &info))) in helper_init()
728 if (!TEST_int_gt(BIO_ADDR_rawport(h->s_net_bio_addr), 0)) in helper_init()
731 if (!TEST_ptr(h->s_net_bio = h->s_net_bio_own = BIO_new_dgram(h->s_fd, 0))) in helper_init()
734 if (!BIO_up_ref(h->s_net_bio)) in helper_init()
738 h->s_qtf_wbio = h->s_qtf_wbio_own = BIO_new(qtest_get_bio_method()); in helper_init()
739 if (!TEST_ptr(h->s_qtf_wbio)) in helper_init()
742 if (!TEST_ptr(BIO_push(h->s_qtf_wbio, h->s_net_bio))) in helper_init()
745 s_args.net_wbio = h->s_qtf_wbio; in helper_init()
747 s_args.net_wbio = h->s_net_bio; in helper_init()
750 s_args.net_rbio = h->s_net_bio; in helper_init()
753 s_args.now_cb_arg = h; in helper_init()
756 if (!TEST_ptr(h->s_priv = ossl_quic_tserver_new(&s_args, certfile, keyfile))) in helper_init()
760 h->s = h->s_priv; in helper_init()
763 h->qtf = qtest_create_injector(h->s_priv); in helper_init()
764 if (!TEST_ptr(h->qtf)) in helper_init()
767 BIO_set_data(h->s_qtf_wbio, h->qtf); in helper_init()
770 h->s_net_bio_own = NULL; in helper_init()
771 h->s_qtf_wbio_own = NULL; in helper_init()
773 h->c_fd = BIO_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, 0); in helper_init()
774 if (!TEST_int_ge(h->c_fd, 0)) in helper_init()
777 if (!TEST_true(BIO_socket_nbio(h->c_fd, 1))) in helper_init()
780 if (!TEST_ptr(h->c_net_bio = h->c_net_bio_own = BIO_new_dgram(h->c_fd, 0))) in helper_init()
783 if (!TEST_true(BIO_dgram_set_peer(h->c_net_bio, h->s_net_bio_addr))) in helper_init()
786 if (!TEST_ptr(h->c_ctx = SSL_CTX_new(OSSL_QUIC_client_method()))) in helper_init()
791 if (!TEST_true(ossl_quic_set_diag_title(h->c_ctx, title))) in helper_init()
794 if (!TEST_ptr(h->c_conn = SSL_new(h->c_ctx))) in helper_init()
798 if (!TEST_true(ossl_quic_conn_set_override_now_cb(h->c_conn, get_time, h))) in helper_init()
802 SSL_set0_rbio(h->c_conn, h->c_net_bio); in helper_init()
803 h->c_net_bio_own = NULL; in helper_init()
805 if (!TEST_true(BIO_up_ref(h->c_net_bio))) in helper_init()
808 SSL_set0_wbio(h->c_conn, h->c_net_bio); in helper_init()
810 if (!TEST_true(SSL_set_blocking_mode(h->c_conn, h->blocking))) in helper_init()
814 if (!TEST_ptr(h->misc_m = ossl_crypto_mutex_new())) in helper_init()
816 if (!TEST_ptr(h->misc_cv = ossl_crypto_condvar_new())) in helper_init()
820 if (h->blocking) { in helper_init()
822 if (!TEST_ptr(h->server_thread.m = ossl_crypto_mutex_new())) in helper_init()
825 if (!TEST_ptr(h->server_thread.c = ossl_crypto_condvar_new())) in helper_init()
828 h->server_thread.t in helper_init()
829 = ossl_crypto_thread_native_start(server_helper_thread, h, 1); in helper_init()
830 if (!TEST_ptr(h->server_thread.t)) in helper_init()
838 h->start_time = ossl_time_now(); in helper_init()
839 h->init = 1; in helper_init()
843 helper_cleanup(h); in helper_init()
847 static int helper_local_init(struct helper_local *hl, struct helper *h, in helper_local_init() argument
850 hl->h = h; in helper_local_init()
855 if (!TEST_ptr(h)) in helper_local_init()
859 hl->c_streams = h->c_streams; in helper_local_init()
871 if (hl->h == NULL) in helper_local_cleanup()
877 hl->h = NULL; in helper_local_cleanup()
926 return hl->h->c_conn; in helper_local_get_c_stream()
936 helper_set_s_stream(struct helper *h, const char *stream_name, in helper_set_s_stream() argument
944 info = get_stream_info(h->s_streams, stream_name); in helper_set_s_stream()
953 static uint64_t helper_get_s_stream(struct helper *h, const char *stream_name) in helper_get_s_stream() argument
960 info = get_stream_info(h->s_streams, stream_name); in helper_get_s_stream()
971 struct helper *h = arg; in helper_packet_plain_listener() local
973 return h->qtf_packet_plain_cb(h, hdr, buf, buf_len); in helper_packet_plain_listener()
980 struct helper *h = arg; in helper_handshake_listener() local
982 return h->qtf_handshake_cb(h, buf, buf_len); in helper_handshake_listener()
989 struct helper *h = arg; in helper_datagram_listener() local
991 return h->qtf_datagram_cb(h, msg, stride); in helper_datagram_listener()
1024 static int run_script_worker(struct helper *h, const struct script_op *script, in run_script_worker() argument
1045 if (!TEST_true(helper_local_init(hl, h, thread_idx))) in run_script_worker()
1055 s_lock(h, hl); \ in run_script_worker()
1056 ossl_quic_tserver_tick(h->s); \ in run_script_worker()
1061 if (h->blocking) { \ in run_script_worker()
1069 SSL *c_tgt = h->c_conn; in run_script_worker()
1072 s_unlock(h, hl); in run_script_worker()
1096 s_stream_id = helper_get_s_stream(h, op->stream_name); in run_script_worker()
1102 if (!h->blocking) { in run_script_worker()
1103 ossl_quic_tserver_tick(h->s); in run_script_worker()
1106 else if (h->blocking && !h->server_thread.ready) { in run_script_worker()
1107 ossl_crypto_mutex_lock(h->server_thread.m); in run_script_worker()
1108 h->server_thread.ready = 1; in run_script_worker()
1109 ossl_crypto_condvar_signal(h->server_thread.c); in run_script_worker()
1110 ossl_crypto_mutex_unlock(h->server_thread.m); in run_script_worker()
1112 if (h->blocking) in run_script_worker()
1113 assert(h->s == NULL); in run_script_worker()
1119 SSL_handle_events(h->c_conn); in run_script_worker()
1161 for (i = 0; i < h->num_threads; ++i) { in run_script_worker()
1162 if (h->threads[i].m == NULL) in run_script_worker()
1165 ossl_crypto_mutex_lock(h->threads[i].m); in run_script_worker()
1166 done = h->threads[i].done; in run_script_worker()
1167 ossl_crypto_mutex_unlock(h->threads[i].m); in run_script_worker()
1206 if (!h->blocking) in run_script_worker()
1232 ok = op->check_func(h, hl); in run_script_worker()
1235 if (thread_idx < 0 && h->check_spin_again) { in run_script_worker()
1236 h->check_spin_again = 0; in run_script_worker()
1258 if (!TEST_false(SSL_set_alpn_protos(h->c_conn, tmp_buf, in run_script_worker()
1273 ret = SSL_connect(h->c_conn); in run_script_worker()
1277 if (!h->blocking && is_want(h->c_conn, ret)) in run_script_worker()
1470 if (!TEST_ptr(c_stream = ossl_quic_detach_stream(h->c_conn))) in run_script_worker()
1486 if (!TEST_true(ossl_quic_attach_stream(h->c_conn, c_tgt))) in run_script_worker()
1508 c_stream = SSL_new_stream(h->c_conn, flags); in run_script_worker()
1517 ++h->fail_count; in run_script_worker()
1550 if (!TEST_true(helper_set_s_stream(h, op->stream_name, in run_script_worker()
1566 if ((c_stream = SSL_accept_stream(h->c_conn, 0)) == NULL) in run_script_worker()
1589 if (!TEST_true(helper_set_s_stream(h, op->stream_name, new_stream_id))) in run_script_worker()
1598 if (!TEST_ptr_null(c_stream = SSL_accept_stream(h->c_conn, in run_script_worker()
1647 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn); in run_script_worker()
1682 if (h->blocking in run_script_worker()
1734 if (!TEST_true(helper_set_s_stream(h, op->stream_name, op->arg2))) in run_script_worker()
1747 if (!TEST_true(helper_set_s_stream(h, op->stream_name, UINT64_MAX))) in run_script_worker()
1867 if (!TEST_ptr_null(h->threads)) { in run_script_worker()
1872 h->threads = OPENSSL_zalloc(op->arg1 * sizeof(struct child_thread_args)); in run_script_worker()
1873 if (!TEST_ptr(h->threads)) in run_script_worker()
1876 h->num_threads = op->arg1; in run_script_worker()
1879 h->threads[i].h = h; in run_script_worker()
1880 h->threads[i].script = op->arg0; in run_script_worker()
1881 h->threads[i].script_name = script_name; in run_script_worker()
1882 h->threads[i].thread_idx = i; in run_script_worker()
1884 h->threads[i].m = ossl_crypto_mutex_new(); in run_script_worker()
1885 if (!TEST_ptr(h->threads[i].m)) in run_script_worker()
1888 h->threads[i].t in run_script_worker()
1890 &h->threads[i], 1); in run_script_worker()
1891 if (!TEST_ptr(h->threads[i].t)) in run_script_worker()
1900 BIO_closesocket(h->c_fd); in run_script_worker()
1901 h->c_fd = -1; in run_script_worker()
1939 h->qtf_packet_plain_cb = op->qtf_packet_plain_cb; in run_script_worker()
1941 if (!TEST_true(qtest_fault_set_packet_plain_listener(h->qtf, in run_script_worker()
1942 h->qtf_packet_plain_cb != NULL ? in run_script_worker()
1944 h))) in run_script_worker()
1950 h->qtf_handshake_cb = op->qtf_handshake_cb; in run_script_worker()
1952 if (!TEST_true(qtest_fault_set_handshake_listener(h->qtf, in run_script_worker()
1953 h->qtf_handshake_cb != NULL ? in run_script_worker()
1955 h))) in run_script_worker()
1961 h->qtf_datagram_cb = op->qtf_datagram_cb; in run_script_worker()
1963 if (!TEST_true(qtest_fault_set_datagram_listener(h->qtf, in run_script_worker()
1964 h->qtf_datagram_cb != NULL ? in run_script_worker()
1966 h))) in run_script_worker()
1977 h->inject_word0 = op->arg1; in run_script_worker()
1978 h->inject_word1 = op->arg2; in run_script_worker()
1983 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn); in run_script_worker()
2011 s_unlock(h, hl); /* idempotent */ in run_script_worker()
2028 if (h->c_conn != NULL) { in run_script_worker()
2031 if (SSL_get_conn_close_info(h->c_conn, &cc_info, sizeof(cc_info))) { in run_script_worker()
2054 tcause = (h->s != NULL in run_script_worker()
2055 ? ossl_quic_tserver_get_terminate_cause(h->s) : NULL); in run_script_worker()
2088 struct helper h; in run_script() local
2090 if (!TEST_true(helper_init(&h, script_name, in run_script()
2094 if (!TEST_true(run_script_worker(&h, script, script_name, -1))) in run_script()
2098 if (!TEST_true(join_threads(h.threads, h.num_threads))) in run_script()
2104 helper_cleanup(&h); in run_script()
2114 testresult = run_script_worker(args->h, args->script, in run_script_child_thread()
2213 OP_S_NEW_STREAM_BIDI (h, S_BIDI_ID(3))
2214 OP_S_WRITE (h, "UNSEEN", 6)
2215 OP_S_CONCLUDE (h)
2724 static int script_20_trigger(struct helper *h, volatile uint64_t *counter) in script_20_trigger() argument
2727 ossl_crypto_mutex_lock(h->misc_m); in script_20_trigger()
2729 ossl_crypto_condvar_broadcast(h->misc_cv); in script_20_trigger()
2730 ossl_crypto_mutex_unlock(h->misc_m); in script_20_trigger()
2735 static int script_20_wait(struct helper *h, volatile uint64_t *counter, uint64_t threshold) in script_20_wait() argument
2740 ossl_crypto_mutex_lock(h->misc_m); in script_20_wait()
2746 ossl_crypto_condvar_wait(h->misc_cv, h->misc_m); in script_20_wait()
2749 ossl_crypto_mutex_unlock(h->misc_m); in script_20_wait()
2754 static int script_20_trigger1(struct helper *h, struct helper_local *hl) in script_20_trigger1() argument
2756 return script_20_trigger(h, &h->scratch0); in script_20_trigger1()
2759 static int script_20_wait1(struct helper *h, struct helper_local *hl) in script_20_wait1() argument
2761 return script_20_wait(h, &h->scratch0, hl->check_op->arg2); in script_20_wait1()
2764 static int script_20_trigger2(struct helper *h, struct helper_local *hl) in script_20_trigger2() argument
2766 return script_20_trigger(h, &h->scratch1); in script_20_trigger2()
2769 static int script_20_wait2(struct helper *h, struct helper_local *hl) in script_20_wait2() argument
2771 return script_20_wait(h, &h->scratch1, hl->check_op->arg2); in script_20_wait2()
2820 static int script_21_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_21_inject_plain() argument
2828 if (h->inject_word0 == 0 || hdr->type != h->inject_word0) in script_21_inject_plain()
2835 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1))) in script_21_inject_plain()
2841 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_21_inject_plain()
2872 static int script_22_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_22_inject_plain() argument
2875 if (h->inject_word0 == 0) in script_22_inject_plain()
2901 static int script_23_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_23_inject_plain() argument
2909 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_23_inject_plain()
2923 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_23_inject_plain()
2954 static int script_24_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_24_inject_plain() argument
2962 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_24_inject_plain()
2969 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1)) in script_24_inject_plain()
2976 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_24_inject_plain()
3064 static int script_28_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_28_inject_plain() argument
3072 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_28_inject_plain()
3079 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1)) in script_28_inject_plain()
3081 h->inject_word0 - 1)) in script_28_inject_plain()
3083 || (h->inject_word1 == OSSL_QUIC_FRAME_TYPE_RESET_STREAM in script_28_inject_plain()
3090 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_28_inject_plain()
3198 static int script_32_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_32_inject_plain() argument
3210 switch (h->inject_word1) { in script_32_inject_plain()
3239 h->inject_word0 - 1)) in script_32_inject_plain()
3251 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_32_inject_plain()
3413 static int script_39_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_39_inject_plain() argument
3422 QUIC_CHANNEL *ch = ossl_quic_tserver_get_channel(h->s_priv); in script_39_inject_plain()
3427 switch (h->inject_word1) { in script_39_inject_plain()
3488 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_39_inject_plain()
3562 static int script_41_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_41_inject_plain() argument
3570 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_41_inject_plain()
3577 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1)) in script_41_inject_plain()
3585 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_41_inject_plain()
3588 --h->inject_word0; in script_41_inject_plain()
3603 struct helper *h = arg; in script_41_trace() local
3612 ++h->scratch1; in script_41_trace()
3618 ++h->scratch1; in script_41_trace()
3627 ++h->scratch1; in script_41_trace()
3631 ++h->scratch0; in script_41_trace()
3634 static int script_41_setup(struct helper *h, struct helper_local *hl) in script_41_setup() argument
3636 ossl_quic_tserver_set_msg_callback(ACQUIRE_S(), script_41_trace, h); in script_41_setup()
3640 static int script_41_check(struct helper *h, struct helper_local *hl) in script_41_check() argument
3643 if (!TEST_uint64_t_gt(h->scratch0, 0)) in script_41_check()
3647 if (!TEST_uint64_t_eq(h->scratch1, 0)) in script_41_check()
3676 static int script_42_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_42_inject_plain() argument
3684 if (h->inject_word0 == 0) in script_42_inject_plain()
3687 --h->inject_word0; in script_42_inject_plain()
3694 || !TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1)) in script_42_inject_plain()
3702 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_42_inject_plain()
3756 static int script_44_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_44_inject_plain() argument
3764 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_44_inject_plain()
3777 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_44_inject_plain()
3807 static int force_ping(struct helper *h, struct helper_local *hl) in force_ping() argument
3811 h->scratch0 = ossl_quic_channel_get_diag_num_rx_ack(ch); in force_ping()
3819 static int wait_incoming_acks_increased(struct helper *h, struct helper_local *hl) in wait_incoming_acks_increased() argument
3826 if (count == h->scratch0) { in wait_incoming_acks_increased()
3827 h->check_spin_again = 1; in wait_incoming_acks_increased()
3856 static int script_46_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_46_inject_plain() argument
3867 if (h->inject_word0 == 0) in script_46_inject_plain()
3876 switch (h->inject_word0) { in script_46_inject_plain()
3914 h->inject_word0 = 0; in script_46_inject_plain()
3937 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_46_inject_plain()
4067 static int script_52_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_52_inject_plain() argument
4074 uint64_t type = h->inject_word1; in script_52_inject_plain()
4076 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_52_inject_plain()
4079 --h->inject_word0; in script_52_inject_plain()
4098 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_52_inject_plain()
4155 static int script_53_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_53_inject_plain() argument
4165 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_53_inject_plain()
4168 h->inject_word0 = 0; in script_53_inject_plain()
4170 switch (h->inject_word1) { in script_53_inject_plain()
4202 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_53_inject_plain()
4233 static int script_54_inject_handshake(struct helper *h, in script_54_inject_handshake() argument
4329 static int script_58_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_58_inject_plain() argument
4337 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_58_inject_plain()
4344 if (h->inject_word0 == 1) { in script_58_inject_plain()
4357 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_58_inject_plain()
4411 static int init_reason(struct helper *h, struct helper_local *hl) in init_reason() argument
4419 static int check_shutdown_reason(struct helper *h, struct helper_local *hl) in check_shutdown_reason() argument
4424 h->check_spin_again = 1; in check_shutdown_reason()
4452 static int script_61_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_61_inject_plain() argument
4460 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_61_inject_plain()
4467 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word0)) in script_61_inject_plain()
4469 h->inject_word1)) in script_61_inject_plain()
4471 || (h->inject_word0 == OSSL_QUIC_FRAME_TYPE_RESET_STREAM in script_61_inject_plain()
4478 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_61_inject_plain()
4575 static int script_65_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_65_inject_plain() argument
4583 if (h->inject_word0 == 0) in script_65_inject_plain()
4586 --h->inject_word0; in script_65_inject_plain()
4600 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_65_inject_plain()
4632 static int script_66_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr, in script_66_inject_plain() argument
4640 if (h->inject_word0 == 0 || hdr->type != QUIC_PKT_TYPE_1RTT) in script_66_inject_plain()
4647 if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1))) in script_66_inject_plain()
4650 if (h->inject_word1 == OSSL_QUIC_FRAME_TYPE_MAX_STREAM_DATA) in script_66_inject_plain()
4652 h->inject_word0 - 1))) in script_66_inject_plain()
4661 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written)) in script_66_inject_plain()
4717 static int script_68_inject_handshake(struct helper *h, unsigned char *msg, in script_68_inject_handshake() argument
4739 switch(h->inject_word0) { in script_68_inject_handshake()
4759 if (!TEST_true(qtest_fault_resize_message(h->qtf, in script_68_inject_handshake()
4811 static int set_max_early_data(struct helper *h, struct helper_local *hl) in set_max_early_data() argument
4861 static int script_72_check(struct helper *h, struct helper_local *hl) in script_72_check() argument
4863 if (!TEST_uint64_t_ge(h->fail_count, 50)) in script_72_check()
4936 static int server_gen_version_neg(struct helper *h, BIO_MSG *msg, size_t stride) in server_gen_version_neg() argument
4944 switch (h->inject_word0) { in server_gen_version_neg()
4968 if (!TEST_true(qtest_fault_resize_datagram(h->qtf, l))) in server_gen_version_neg()
4972 h->inject_word0 = 0; in server_gen_version_neg()
5014 static int script_76_check(struct helper *h, struct helper_local *hl) in script_76_check() argument
5016 if (!TEST_false(SSL_shutdown_ex(h->c_conn, in script_76_check()
5076 static int setup_session(struct helper *h, struct helper_local *hl) in setup_session() argument
5078 SSL_CTX_set_session_cache_mode(h->c_ctx, SSL_SESS_CACHE_BOTH); in setup_session()
5079 SSL_CTX_sess_set_new_cb(h->c_ctx, on_new_session); in setup_session()
5083 static int trigger_late_session_ticket(struct helper *h, struct helper_local *hl) in trigger_late_session_ticket() argument
5093 static int check_got_session_ticket(struct helper *h, struct helper_local *hl) in check_got_session_ticket() argument
5101 static int check_idle_timeout(struct helper *h, struct helper_local *hl);
5160 static int script_80_send_stateless_reset(struct helper *h, QUIC_PKT_HDR *hdr, in script_80_send_stateless_reset() argument
5165 if (h->inject_word1 == 0) in script_80_send_stateless_reset()
5168 h->inject_word1 = 0; in script_80_send_stateless_reset()
5177 if (!TEST_int_eq(SSL_inject_net_dgram(h->c_conn, databuf, sizeof(databuf), in script_80_send_stateless_reset()
5178 NULL, h->s_net_bio_addr), 1)) in script_80_send_stateless_reset()
5184 static int script_80_gen_new_conn_id(struct helper *h, QUIC_PKT_HDR *hdr, in script_80_gen_new_conn_id() argument
5195 if (h->inject_word0 == 0) in script_80_gen_new_conn_id()
5198 h->inject_word0 = 0; in script_80_gen_new_conn_id()
5219 if (!qtest_fault_prepend_frame(h->qtf, frame_buf, l)) in script_80_gen_new_conn_id()
5232 static int script_80_inject_pkt(struct helper *h, QUIC_PKT_HDR *hdr, in script_80_inject_pkt() argument
5235 if (h->inject_word1 == 1) in script_80_inject_pkt()
5236 return script_80_send_stateless_reset(h, hdr, buf, len); in script_80_inject_pkt()
5237 else if (h->inject_word0 == 1) in script_80_inject_pkt()
5238 return script_80_gen_new_conn_id(h, hdr, buf, len); in script_80_inject_pkt()
5261 static int modify_idle_timeout(struct helper *h, struct helper_local *hl) in modify_idle_timeout() argument
5266 if (!TEST_false(SSL_set_feature_request_uint(h->c_conn, in modify_idle_timeout()
5272 if (!TEST_true(SSL_set_feature_request_uint(h->c_conn, in modify_idle_timeout()
5277 if (!TEST_true(SSL_get_feature_request_uint(h->c_conn, in modify_idle_timeout()
5288 static int check_idle_timeout(struct helper *h, struct helper_local *hl) in check_idle_timeout() argument
5292 if (!TEST_true(SSL_get_value_uint(h->c_conn, hl->check_op->arg1, in check_idle_timeout()
5334 static int cannot_change_idle_timeout(struct helper *h, struct helper_local *hl) in cannot_change_idle_timeout() argument
5338 if (!TEST_true(SSL_get_feature_request_uint(h->c_conn, in cannot_change_idle_timeout()
5346 if (!TEST_false(SSL_set_feature_request_uint(h->c_conn, in cannot_change_idle_timeout()
5370 static int check_avail_streams(struct helper *h, struct helper_local *hl) in check_avail_streams() argument
5376 if (!TEST_true(SSL_get_quic_stream_bidi_local_avail(h->c_conn, &v))) in check_avail_streams()
5380 if (!TEST_true(SSL_get_quic_stream_bidi_remote_avail(h->c_conn, &v))) in check_avail_streams()
5384 if (!TEST_true(SSL_get_quic_stream_uni_local_avail(h->c_conn, &v))) in check_avail_streams()
5388 if (!TEST_true(SSL_get_quic_stream_uni_remote_avail(h->c_conn, &v))) in check_avail_streams()
5401 static int set_event_handling_mode_conn(struct helper *h, struct helper_local *hl);
5402 static int reenable_test_event_handling(struct helper *h, struct helper_local *hl);
5404 static int check_write_buf_stat(struct helper *h, struct helper_local *hl) in check_write_buf_stat() argument
5491 ossl_unused static int script_85_poll(struct helper *h, struct helper_local *hl) in script_85_poll() argument
5528 item->desc = SSL_as_poll_descriptor(h->c_conn); in script_85_poll()
5643 static int set_event_handling_mode_conn(struct helper *h, struct helper_local *hl) in set_event_handling_mode_conn() argument
5646 return SSL_set_event_handling_mode(h->c_conn, hl->check_op->arg2); in set_event_handling_mode_conn()
5649 static int reenable_test_event_handling(struct helper *h, struct helper_local *hl) in reenable_test_event_handling() argument
5655 static ossl_unused int set_event_handling_mode_stream(struct helper *h, struct helper_local *hl) in set_event_handling_mode_stream() argument