Lines Matching refs:h

79 static void helper_cleanup(struct helper *h)  in helper_cleanup()  argument
84 ossl_qrx_pkt_release(h->qrx_pkt); in helper_cleanup()
85 h->qrx_pkt = NULL; in helper_cleanup()
90 ossl_ackm_on_pkt_space_discarded(h->args.ackm, pn_space); in helper_cleanup()
92 ossl_quic_tx_packetiser_free(h->txp); in helper_cleanup()
93 ossl_qtx_free(h->args.qtx); in helper_cleanup()
94 ossl_quic_txpim_free(h->args.txpim); in helper_cleanup()
95 ossl_quic_cfq_free(h->args.cfq); in helper_cleanup()
96 if (h->cc_data != NULL) in helper_cleanup()
97 h->cc_method->free(h->cc_data); in helper_cleanup()
98 if (h->have_statm) in helper_cleanup()
99 ossl_statm_destroy(&h->statm); in helper_cleanup()
100 if (h->have_qsm) in helper_cleanup()
101 ossl_quic_stream_map_cleanup(&h->qsm); in helper_cleanup()
103 ossl_quic_sstream_free(h->args.crypto[i]); in helper_cleanup()
104 ossl_ackm_free(h->args.ackm); in helper_cleanup()
105 ossl_qrx_free(h->qrx); in helper_cleanup()
106 ossl_quic_demux_free(h->demux); in helper_cleanup()
107 BIO_free(h->bio1); in helper_cleanup()
108 BIO_free(h->bio2); in helper_cleanup()
114 struct helper *h = arg; in demux_default_handler() local
119 ossl_qrx_inject_urxe(h->qrx, e); in demux_default_handler()
122 static int helper_init(struct helper *h) in helper_init() argument
127 memset(h, 0, sizeof(*h)); in helper_init()
130 if (!TEST_true(BIO_new_bio_dgram_pair(&h->bio1, 0, &h->bio2, 0))) in helper_init()
133 h->qtx_args.bio = h->bio1; in helper_init()
134 h->qtx_args.mdpl = 1200; in helper_init()
136 if (!TEST_ptr(h->args.qtx = ossl_qtx_new(&h->qtx_args))) in helper_init()
139 if (!TEST_ptr(h->args.txpim = ossl_quic_txpim_new())) in helper_init()
142 if (!TEST_ptr(h->args.cfq = ossl_quic_cfq_new())) in helper_init()
145 if (!TEST_true(ossl_quic_txfc_init(&h->conn_txfc, NULL))) in helper_init()
148 if (!TEST_true(ossl_quic_rxfc_init(&h->conn_rxfc, NULL, in helper_init()
155 if (!TEST_true(ossl_quic_rxfc_init(&h->stream_rxfc, &h->conn_rxfc, in helper_init()
162 if (!TEST_true(ossl_quic_rxfc_init(&h->max_streams_bidi_rxfc, NULL, in helper_init()
168 if (!TEST_true(ossl_quic_rxfc_init(&h->max_streams_uni_rxfc, NULL, in helper_init()
173 if (!TEST_true(ossl_statm_init(&h->statm))) in helper_init()
176 h->have_statm = 1; in helper_init()
178 h->cc_method = &ossl_cc_dummy_method; in helper_init()
179 if (!TEST_ptr(h->cc_data = h->cc_method->new(fake_now, NULL))) in helper_init()
182 if (!TEST_ptr(h->args.ackm = ossl_ackm_new(fake_now, NULL, in helper_init()
183 &h->statm, in helper_init()
184 h->cc_method, in helper_init()
185 h->cc_data))) in helper_init()
188 if (!TEST_true(ossl_quic_stream_map_init(&h->qsm, NULL, NULL, in helper_init()
189 &h->max_streams_bidi_rxfc, in helper_init()
190 &h->max_streams_uni_rxfc, in helper_init()
194 h->have_qsm = 1; in helper_init()
197 if (!TEST_ptr(h->args.crypto[i] = ossl_quic_sstream_new(4096))) in helper_init()
200 h->args.cur_scid = scid_1; in helper_init()
201 h->args.cur_dcid = dcid_1; in helper_init()
202 h->args.qsm = &h->qsm; in helper_init()
203 h->args.conn_txfc = &h->conn_txfc; in helper_init()
204 h->args.conn_rxfc = &h->conn_rxfc; in helper_init()
205 h->args.max_streams_bidi_rxfc = &h->max_streams_bidi_rxfc; in helper_init()
206 h->args.max_streams_uni_rxfc = &h->max_streams_uni_rxfc; in helper_init()
207 h->args.cc_method = h->cc_method; in helper_init()
208 h->args.cc_data = h->cc_data; in helper_init()
209 h->args.now = fake_now; in helper_init()
211 if (!TEST_ptr(h->txp = ossl_quic_tx_packetiser_new(&h->args))) in helper_init()
214 if (!TEST_ptr(h->demux = ossl_quic_demux_new(h->bio2, 8, in helper_init()
218 ossl_quic_demux_set_default_handler(h->demux, demux_default_handler, h); in helper_init()
220 h->qrx_args.demux = h->demux; in helper_init()
221 h->qrx_args.short_conn_id_len = 8; in helper_init()
222 h->qrx_args.max_deferred = 32; in helper_init()
224 if (!TEST_ptr(h->qrx = ossl_qrx_new(&h->qrx_args))) in helper_init()
227 ossl_qrx_allow_1rtt_processing(h->qrx); in helper_init()
232 helper_cleanup(h); in helper_init()
267 int (*check_func)(struct helper *h);
319 static int schedule_handshake_done(struct helper *h) in schedule_handshake_done() argument
321 ossl_quic_tx_packetiser_schedule_handshake_done(h->txp); in schedule_handshake_done()
325 static int schedule_ack_eliciting_app(struct helper *h) in schedule_ack_eliciting_app() argument
327 ossl_quic_tx_packetiser_schedule_ack_eliciting(h->txp, QUIC_PN_SPACE_APP); in schedule_ack_eliciting_app()
367 static int schedule_max_data(struct helper *h) in schedule_max_data() argument
371 cwm = ossl_quic_rxfc_get_cwm(&h->stream_rxfc); in schedule_max_data()
373 if (!TEST_true(ossl_quic_rxfc_on_rx_stream_frame(&h->stream_rxfc, cwm, 0)) in schedule_max_data()
374 || !TEST_true(ossl_quic_rxfc_on_retire(&h->stream_rxfc, cwm, in schedule_max_data()
404 static int schedule_cfq_new_conn_id(struct helper *h) in schedule_cfq_new_conn_id() argument
434 if (!TEST_ptr(cfq_item = ossl_quic_cfq_add_frame(h->args.cfq, 1, in schedule_cfq_new_conn_id()
449 static int check_cfq_new_conn_id(struct helper *h) in check_cfq_new_conn_id() argument
451 if (!TEST_uint64_t_eq(h->frame.new_conn_id.seq_num, 2345) in check_cfq_new_conn_id()
452 || !TEST_uint64_t_eq(h->frame.new_conn_id.retire_prior_to, 1234) in check_cfq_new_conn_id()
453 || !TEST_mem_eq(&h->frame.new_conn_id.conn_id, sizeof(cid_1), in check_cfq_new_conn_id()
455 || !TEST_mem_eq(&h->frame.new_conn_id.stateless_reset.token, in check_cfq_new_conn_id()
485 static int schedule_cfq_new_token(struct helper *h) in schedule_cfq_new_token() argument
510 if (!TEST_ptr(cfq_item = ossl_quic_cfq_add_frame(h->args.cfq, 1, in schedule_cfq_new_token()
525 static int check_cfq_new_token(struct helper *h) in check_cfq_new_token() argument
527 if (!TEST_mem_eq(h->frame.new_token.token, in check_cfq_new_token()
528 h->frame.new_token.token_len, in check_cfq_new_token()
553 static int schedule_ack(struct helper *h) in schedule_ack() argument
565 if (!TEST_true(ossl_ackm_on_rx_packet(h->args.ackm, &rx_pkt))) in schedule_ack()
632 static int check_stream_9(struct helper *h) in check_stream_9() argument
634 if (!TEST_mem_eq(h->frame.stream.data, (size_t)h->frame.stream.len, in check_stream_9()
892 static int check_stream_10a(struct helper *h) in check_stream_10a() argument
898 if (!TEST_uint64_t_ge(h->frame.stream.len, 1150) in check_stream_10a()
899 || !TEST_uint64_t_le(h->frame.stream.len, 1200)) in check_stream_10a()
902 if (!TEST_mem_eq(h->frame.stream.data, (size_t)h->frame.stream.len, in check_stream_10a()
903 stream_10a, (size_t)h->frame.stream.len)) in check_stream_10a()
906 stream_10a_off = h->frame.stream.offset + h->frame.stream.len; in check_stream_10a()
910 static int check_stream_10b(struct helper *h) in check_stream_10b() argument
912 if (!TEST_uint64_t_ge(h->frame.stream.len, 1150) in check_stream_10b()
913 || !TEST_uint64_t_le(h->frame.stream.len, 1200)) in check_stream_10b()
916 if (!TEST_mem_eq(h->frame.stream.data, (size_t)h->frame.stream.len, in check_stream_10b()
917 stream_10b, (size_t)h->frame.stream.len)) in check_stream_10b()
920 stream_10b_off = h->frame.stream.offset + h->frame.stream.len; in check_stream_10b()
924 static int check_stream_10c(struct helper *h) in check_stream_10c() argument
926 if (!TEST_uint64_t_ge(h->frame.stream.len, 5) in check_stream_10c()
927 || !TEST_uint64_t_le(h->frame.stream.len, 200)) in check_stream_10c()
930 if (!TEST_mem_eq(h->frame.stream.data, (size_t)h->frame.stream.len, in check_stream_10c()
931 stream_10a + stream_10a_off, (size_t)h->frame.stream.len)) in check_stream_10c()
937 static int check_stream_10d(struct helper *h) in check_stream_10d() argument
939 if (!TEST_uint64_t_ge(h->frame.stream.len, 5) in check_stream_10d()
940 || !TEST_uint64_t_le(h->frame.stream.len, 200)) in check_stream_10d()
943 if (!TEST_mem_eq(h->frame.stream.data, (size_t)h->frame.stream.len, in check_stream_10d()
944 stream_10b + stream_10b_off, (size_t)h->frame.stream.len)) in check_stream_10d()
1015 static int check_stream_12(struct helper *h) in check_stream_12() argument
1017 if (!TEST_uint64_t_eq(h->frame.stop_sending.stream_id, 42) in check_stream_12()
1018 || !TEST_uint64_t_eq(h->frame.stop_sending.app_error_code, 4568)) in check_stream_12()
1047 static ossl_unused int check_stream_13(struct helper *h) in check_stream_13() argument
1049 if (!TEST_uint64_t_eq(h->frame.reset_stream.stream_id, 42) in check_stream_13()
1050 || !TEST_uint64_t_eq(h->frame.reset_stream.app_error_code, 4568) in check_stream_13()
1051 || !TEST_uint64_t_eq(h->frame.reset_stream.final_size, 0)) in check_stream_13()
1080 static int gen_conn_close(struct helper *h) in gen_conn_close() argument
1089 if (!TEST_true(ossl_quic_tx_packetiser_schedule_conn_close(h->txp, &f))) in gen_conn_close()
1095 static int check_14(struct helper *h) in check_14() argument
1097 if (!TEST_int_eq(h->frame.conn_close.is_app, 0) in check_14()
1098 || !TEST_uint64_t_eq(h->frame.conn_close.frame_type, in check_14()
1100 || !TEST_uint64_t_eq(h->frame.conn_close.error_code, 2345) in check_14()
1101 || !TEST_mem_eq(h->frame.conn_close.reason, h->frame.conn_close.reason_len, in check_14()
1125 static int gen_probe_initial(struct helper *h) in gen_probe_initial() argument
1127 OSSL_ACKM_PROBE_INFO *probe = ossl_ackm_get0_probe_request(h->args.ackm); in gen_probe_initial()
1153 static int gen_probe_handshake(struct helper *h) in gen_probe_handshake() argument
1155 OSSL_ACKM_PROBE_INFO *probe = ossl_ackm_get0_probe_request(h->args.ackm); in gen_probe_handshake()
1182 static int gen_probe_1rtt(struct helper *h) in gen_probe_1rtt() argument
1184 OSSL_ACKM_PROBE_INFO *probe = ossl_ackm_get0_probe_request(h->args.ackm); in gen_probe_1rtt()
1214 static int try_big_token(struct helper *h) in try_big_token() argument
1219 if (!TEST_false(ossl_quic_tx_packetiser_set_initial_token(h->txp, in try_big_token()
1234 if (ossl_quic_tx_packetiser_set_initial_token(h->txp, big_token, i, in try_big_token()
1280 static void skip_padding(struct helper *h) in skip_padding() argument
1284 if (!ossl_quic_wire_peek_frame_header(&h->pkt, &frame_type, NULL)) in skip_padding()
1288 ossl_quic_wire_decode_padding(&h->pkt); in skip_padding()
1295 struct helper h; in run_script() local
1299 if (!helper_init(&h)) in run_script()
1306 if (!TEST_true(ossl_quic_tx_packetiser_generate(h.txp, &status)) in run_script()
1310 ossl_qtx_finish_dgram(h.args.qtx); in run_script()
1311 ossl_qtx_flush_net(h.args.qtx); in run_script()
1314 if (!TEST_true(ossl_quic_tx_packetiser_generate(h.txp, &status)) in run_script()
1320 ossl_quic_demux_pump(h.demux); in run_script()
1321 ossl_qrx_pkt_release(h.qrx_pkt); in run_script()
1322 h.qrx_pkt = NULL; in run_script()
1323 if (!TEST_true(ossl_qrx_read_pkt(h.qrx, &h.qrx_pkt))) in run_script()
1325 if (!TEST_true(PACKET_buf_init(&h.pkt, in run_script()
1326 h.qrx_pkt->hdr->data, in run_script()
1327 h.qrx_pkt->hdr->len))) in run_script()
1329 h.frame_type = UINT64_MAX; in run_script()
1332 ossl_quic_demux_pump(h.demux); in run_script()
1333 if (!TEST_false(ossl_qrx_read_pkt(h.qrx, &h.qrx_pkt))) in run_script()
1335 h.frame_type = UINT64_MAX; in run_script()
1338 if (!TEST_size_t_ge(h.qrx_pkt->datagram_len, (size_t)op->arg0) in run_script()
1339 || !TEST_size_t_le(h.qrx_pkt->datagram_len, (size_t)op->arg1)) in run_script()
1343 if (!TEST_uint64_t_eq(h.frame_type, op->arg0)) in run_script()
1347 if (!TEST_mem_eq(h.qrx_pkt->hdr->token, h.qrx_pkt->hdr->token_len, in run_script()
1352 if (!TEST_true(cmp_pkt_hdr(h.qrx_pkt->hdr, op->buf, in run_script()
1357 if (!TEST_true(op->check_func(&h))) in run_script()
1361 skip_padding(&h); in run_script()
1362 if (!ossl_quic_wire_peek_frame_header(&h.pkt, &h.frame_type, NULL)) { in run_script()
1363 h.frame_type = UINT64_MAX; in run_script()
1367 switch (h.frame_type) { in run_script()
1369 if (!TEST_true(ossl_quic_wire_decode_frame_handshake_done(&h.pkt))) in run_script()
1373 if (!TEST_true(ossl_quic_wire_decode_frame_ping(&h.pkt))) in run_script()
1377 if (!TEST_true(ossl_quic_wire_decode_frame_max_data(&h.pkt, in run_script()
1378 &h.frame.max_data))) in run_script()
1382 if (!TEST_true(ossl_quic_wire_decode_frame_new_conn_id(&h.pkt, in run_script()
1383 &h.frame.new_conn_id))) in run_script()
1387 if (!TEST_true(ossl_quic_wire_decode_frame_new_token(&h.pkt, in run_script()
1388 &h.frame.new_token.token, in run_script()
1389 &h.frame.new_token.token_len))) in run_script()
1394 h.frame.ack.ack_ranges = h.ack_ranges; in run_script()
1395 h.frame.ack.num_ack_ranges = OSSL_NELEM(h.ack_ranges); in run_script()
1396 if (!TEST_true(ossl_quic_wire_decode_frame_ack(&h.pkt, in run_script()
1397 h.args.ack_delay_exponent, in run_script()
1398 &h.frame.ack, in run_script()
1403 if (!TEST_true(ossl_quic_wire_decode_frame_crypto(&h.pkt, 0, &h.frame.crypto))) in run_script()
1415 if (!TEST_true(ossl_quic_wire_decode_frame_stream(&h.pkt, 0, &h.frame.stream))) in run_script()
1420 if (!TEST_true(ossl_quic_wire_decode_frame_stop_sending(&h.pkt, in run_script()
1421 &h.frame.stop_sending))) in run_script()
1426 if (!TEST_true(ossl_quic_wire_decode_frame_reset_stream(&h.pkt, in run_script()
1427 &h.frame.reset_stream))) in run_script()
1433 if (!TEST_true(ossl_quic_wire_decode_frame_conn_close(&h.pkt, in run_script()
1434 &h.frame.conn_close))) in run_script()
1444 skip_padding(&h); in run_script()
1445 if (!TEST_size_t_eq(PACKET_remaining(&h.pkt), 0)) in run_script()
1449 if (!TEST_true(ossl_qtx_provide_secret(h.args.qtx, in run_script()
1454 if (!TEST_true(ossl_qrx_provide_secret(h.qrx, in run_script()
1461 if (!TEST_true(ossl_quic_tx_packetiser_discard_enc_level(h.txp, in run_script()
1474 if (!TEST_true(ossl_quic_sstream_append(h.args.crypto[op->arg0], in run_script()
1487 if (!TEST_ptr(s = ossl_quic_stream_map_alloc(h.args.qsm, op->arg0, in run_script()
1492 || !TEST_true(ossl_quic_txfc_init(&s->txfc, &h.conn_txfc)) in run_script()
1493 || !TEST_true(ossl_quic_rxfc_init(&s->rxfc, &h.conn_rxfc, in run_script()
1500 ossl_quic_stream_map_release(h.args.qsm, s); in run_script()
1510 if (!TEST_ptr(s = ossl_quic_stream_map_get_by_id(h.args.qsm, in run_script()
1521 ossl_quic_stream_map_update_state(h.args.qsm, s); in run_script()
1528 if (!TEST_ptr(s = ossl_quic_stream_map_get_by_id(h.args.qsm, in run_script()
1539 if (!TEST_ptr(s = ossl_quic_stream_map_get_by_id(h.args.qsm, in run_script()
1543 if (!TEST_true(ossl_quic_stream_map_stop_sending_recv_part(h.args.qsm, in run_script()
1547 ossl_quic_stream_map_update_state(h.args.qsm, s); in run_script()
1557 if (!TEST_ptr(s = ossl_quic_stream_map_get_by_id(h.args.qsm, in run_script()
1561 if (!TEST_true(ossl_quic_stream_map_reset_stream_send_part(h.args.qsm, in run_script()
1565 ossl_quic_stream_map_update_state(h.args.qsm, s); in run_script()
1572 if (!TEST_true(ossl_quic_txfc_bump_cwm(h.args.conn_txfc, op->arg0))) in run_script()
1580 if (!TEST_ptr(s = ossl_quic_stream_map_get_by_id(h.args.qsm, in run_script()
1587 ossl_quic_stream_map_update_state(h.args.qsm, s); in run_script()
1591 ossl_quic_tx_packetiser_notify_handshake_complete(h.txp); in run_script()
1606 helper_cleanup(&h); in run_script()
1642 static int check_is_initial(struct helper *h) in check_is_initial() argument
1644 return h->qrx_pkt->hdr->type == QUIC_PKT_TYPE_INITIAL; in check_is_initial()
1647 static int check_is_handshake(struct helper *h) in check_is_handshake() argument
1649 return h->qrx_pkt->hdr->type == QUIC_PKT_TYPE_HANDSHAKE; in check_is_handshake()