Lines Matching refs:qtx

115     OSSL_QTX *qtx;  in ossl_qtx_new()  local
120 qtx = OPENSSL_zalloc(sizeof(OSSL_QTX)); in ossl_qtx_new()
121 if (qtx == NULL) in ossl_qtx_new()
124 qtx->libctx = args->libctx; in ossl_qtx_new()
125 qtx->propq = args->propq; in ossl_qtx_new()
126 qtx->bio = args->bio; in ossl_qtx_new()
127 qtx->mdpl = args->mdpl; in ossl_qtx_new()
128 qtx->get_qlog_cb = args->get_qlog_cb; in ossl_qtx_new()
129 qtx->get_qlog_cb_arg = args->get_qlog_cb_arg; in ossl_qtx_new()
131 return qtx; in ossl_qtx_new()
145 void ossl_qtx_free(OSSL_QTX *qtx) in ossl_qtx_free() argument
149 if (qtx == NULL) in ossl_qtx_free()
153 qtx_cleanup_txl(&qtx->pending); in ossl_qtx_free()
154 qtx_cleanup_txl(&qtx->free); in ossl_qtx_free()
155 OPENSSL_free(qtx->cons); in ossl_qtx_free()
159 ossl_qrl_enc_level_set_discard(&qtx->el_set, i); in ossl_qtx_free()
161 OPENSSL_free(qtx); in ossl_qtx_free()
165 void ossl_qtx_set_mutator(OSSL_QTX *qtx, ossl_mutate_packet_cb mutatecb, in ossl_qtx_set_mutator() argument
168 qtx->mutatecb = mutatecb; in ossl_qtx_set_mutator()
169 qtx->finishmutatecb = finishmutatecb; in ossl_qtx_set_mutator()
170 qtx->mutatearg = mutatearg; in ossl_qtx_set_mutator()
173 void ossl_qtx_set_qlog_cb(OSSL_QTX *qtx, QLOG *(*get_qlog_cb)(void *arg), in ossl_qtx_set_qlog_cb() argument
176 qtx->get_qlog_cb = get_qlog_cb; in ossl_qtx_set_qlog_cb()
177 qtx->get_qlog_cb_arg = get_qlog_cb_arg; in ossl_qtx_set_qlog_cb()
180 int ossl_qtx_provide_secret(OSSL_QTX *qtx, in ossl_qtx_provide_secret() argument
190 return ossl_qrl_enc_level_set_provide_secret(&qtx->el_set, in ossl_qtx_provide_secret()
191 qtx->libctx, in ossl_qtx_provide_secret()
192 qtx->propq, in ossl_qtx_provide_secret()
202 int ossl_qtx_discard_enc_level(OSSL_QTX *qtx, uint32_t enc_level) in ossl_qtx_discard_enc_level() argument
207 ossl_qrl_enc_level_set_discard(&qtx->el_set, enc_level); in ossl_qtx_discard_enc_level()
211 int ossl_qtx_is_enc_level_provisioned(OSSL_QTX *qtx, uint32_t enc_level) in ossl_qtx_is_enc_level_provisioned() argument
213 return ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1) != NULL; in ossl_qtx_is_enc_level_provisioned()
241 static TXE *qtx_ensure_free_txe(OSSL_QTX *qtx, size_t alloc_len) in qtx_ensure_free_txe() argument
245 txe = ossl_list_txe_head(&qtx->free); in qtx_ensure_free_txe()
253 ossl_list_txe_insert_tail(&qtx->free, txe); in qtx_ensure_free_txe()
262 static TXE *qtx_resize_txe(OSSL_QTX *qtx, TXE_LIST *txl, TXE *txe, size_t n) in qtx_resize_txe() argument
295 if (qtx->cons == txe) in qtx_resize_txe()
296 qtx->cons = txe2; in qtx_resize_txe()
306 static TXE *qtx_reserve_txe(OSSL_QTX *qtx, TXE_LIST *txl, in qtx_reserve_txe() argument
312 return qtx_resize_txe(qtx, txl, txe, n); in qtx_reserve_txe()
316 static void qtx_pending_to_free(OSSL_QTX *qtx) in qtx_pending_to_free() argument
318 TXE *txe = ossl_list_txe_head(&qtx->pending); in qtx_pending_to_free()
321 ossl_list_txe_remove(&qtx->pending, txe); in qtx_pending_to_free()
322 --qtx->pending_count; in qtx_pending_to_free()
323 qtx->pending_bytes -= txe->data_len; in qtx_pending_to_free()
324 ossl_list_txe_insert_tail(&qtx->free, txe); in qtx_pending_to_free()
328 static void qtx_add_to_pending(OSSL_QTX *qtx, TXE *txe) in qtx_add_to_pending() argument
330 ossl_list_txe_insert_tail(&qtx->pending, txe); in qtx_add_to_pending()
331 ++qtx->pending_count; in qtx_add_to_pending()
332 qtx->pending_bytes += txe->data_len; in qtx_add_to_pending()
404 int ossl_qtx_calculate_ciphertext_payload_len(OSSL_QTX *qtx, uint32_t enc_level, in ossl_qtx_calculate_ciphertext_payload_len() argument
409 = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in ossl_qtx_calculate_ciphertext_payload_len()
428 int ossl_qtx_calculate_plaintext_payload_len(OSSL_QTX *qtx, uint32_t enc_level, in ossl_qtx_calculate_plaintext_payload_len() argument
433 = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in ossl_qtx_calculate_plaintext_payload_len()
461 static int qtx_write_hdr(OSSL_QTX *qtx, const QUIC_PKT_HDR *hdr, TXE *txe, in qtx_write_hdr() argument
479 if (qtx->msg_callback != NULL) in qtx_write_hdr()
480 qtx->msg_callback(1, OSSL_QUIC1_VERSION, SSL3_RT_QUIC_PACKET, data, l, in qtx_write_hdr()
481 qtx->msg_callback_ssl, qtx->msg_callback_arg); in qtx_write_hdr()
488 static int qtx_encrypt_into_txe(OSSL_QTX *qtx, struct iovec_cur *cur, TXE *txe, in qtx_encrypt_into_txe() argument
495 = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in qtx_encrypt_into_txe()
599 static int qtx_write(OSSL_QTX *qtx, const OSSL_QTX_PKT *pkt, TXE *txe, in qtx_write() argument
621 el = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in qtx_write()
649 ossl_qtx_calculate_ciphertext_payload_len(qtx, enc_level, in qtx_write()
684 if (!qtx_write_hdr(qtx, hdr, txe, &ptrs)) { in qtx_write()
708 if (!qtx_encrypt_into_txe(qtx, &cur, txe, enc_level, pkt->pn, in qtx_write()
728 static TXE *qtx_ensure_cons(OSSL_QTX *qtx) in qtx_ensure_cons() argument
730 TXE *txe = qtx->cons; in qtx_ensure_cons()
735 txe = qtx_ensure_free_txe(qtx, qtx->mdpl); in qtx_ensure_cons()
739 ossl_list_txe_remove(&qtx->free, txe); in qtx_ensure_cons()
740 qtx->cons = txe; in qtx_ensure_cons()
741 qtx->cons_count = 0; in qtx_ensure_cons()
746 static QLOG *qtx_get_qlog(OSSL_QTX *qtx) in qtx_get_qlog() argument
748 if (qtx->get_qlog_cb == NULL) in qtx_get_qlog()
751 return qtx->get_qlog_cb(qtx->get_qlog_cb_arg); in qtx_get_qlog()
754 static int qtx_mutate_write(OSSL_QTX *qtx, const OSSL_QTX_PKT *pkt, TXE *txe, in qtx_mutate_write() argument
763 if (qtx->mutatecb != NULL) { in qtx_mutate_write()
764 if (!qtx->mutatecb(pkt->hdr, pkt->iovec, pkt->num_iovec, &hdr, in qtx_mutate_write()
765 &iovec, &num_iovec, qtx->mutatearg)) in qtx_mutate_write()
773 ret = qtx_write(qtx, pkt, txe, enc_level, in qtx_mutate_write()
776 ossl_qlog_event_transport_packet_sent(qtx_get_qlog(qtx), hdr, pkt->pn, in qtx_mutate_write()
778 qtx->datagram_count); in qtx_mutate_write()
780 if (qtx->finishmutatecb != NULL) in qtx_mutate_write()
781 qtx->finishmutatecb(qtx->mutatearg); in qtx_mutate_write()
793 int ossl_qtx_write_pkt(OSSL_QTX *qtx, const OSSL_QTX_PKT *pkt) in ossl_qtx_write_pkt() argument
809 ossl_qtx_finish_dgram(qtx); in ossl_qtx_write_pkt()
811 || ossl_qrl_enc_level_set_have_el(&qtx->el_set, enc_level) != 1) { in ossl_qtx_write_pkt()
816 was_coalescing = (qtx->cons != NULL && qtx->cons->data_len > 0); in ossl_qtx_write_pkt()
818 if (!addr_eq(&qtx->cons->peer, pkt->peer) in ossl_qtx_write_pkt()
819 || !addr_eq(&qtx->cons->local, pkt->local)) { in ossl_qtx_write_pkt()
821 ossl_qtx_finish_dgram(qtx); in ossl_qtx_write_pkt()
832 txe = qtx_ensure_cons(qtx); in ossl_qtx_write_pkt()
840 if (!qtx_reserve_txe(qtx, NULL, txe, qtx->mdpl)) in ossl_qtx_write_pkt()
856 ret = qtx_mutate_write(qtx, pkt, txe, enc_level); in ossl_qtx_write_pkt()
865 ossl_qtx_finish_dgram(qtx); in ossl_qtx_write_pkt()
880 ++qtx->cons_count; in ossl_qtx_write_pkt()
889 ossl_qtx_finish_dgram(qtx); in ossl_qtx_write_pkt()
898 void ossl_qtx_finish_dgram(OSSL_QTX *qtx) in ossl_qtx_finish_dgram() argument
900 TXE *txe = qtx->cons; in ossl_qtx_finish_dgram()
910 ossl_list_txe_insert_tail(&qtx->free, txe); in ossl_qtx_finish_dgram()
912 qtx_add_to_pending(qtx, txe); in ossl_qtx_finish_dgram()
914 qtx->cons = NULL; in ossl_qtx_finish_dgram()
915 qtx->cons_count = 0; in ossl_qtx_finish_dgram()
916 ++qtx->datagram_count; in ossl_qtx_finish_dgram()
932 int ossl_qtx_flush_net(OSSL_QTX *qtx) in ossl_qtx_flush_net() argument
939 if (ossl_list_txe_head(&qtx->pending) == NULL) in ossl_qtx_flush_net()
942 if (qtx->bio == NULL) in ossl_qtx_flush_net()
946 for (txe = ossl_list_txe_head(&qtx->pending), i = 0; in ossl_qtx_flush_net()
956 res = BIO_sendmmsg(qtx->bio, msg, sizeof(BIO_MSG), i, 0, &wr); in ossl_qtx_flush_net()
985 if (qtx->msg_callback != NULL) in ossl_qtx_flush_net()
986 qtx->msg_callback(1, OSSL_QUIC1_VERSION, SSL3_RT_QUIC_DATAGRAM, in ossl_qtx_flush_net()
988 qtx->msg_callback_ssl, in ossl_qtx_flush_net()
989 qtx->msg_callback_arg); in ossl_qtx_flush_net()
990 qtx_pending_to_free(qtx); in ossl_qtx_flush_net()
1001 int ossl_qtx_pop_net(OSSL_QTX *qtx, BIO_MSG *msg) in ossl_qtx_pop_net() argument
1003 TXE *txe = ossl_list_txe_head(&qtx->pending); in ossl_qtx_pop_net()
1009 qtx_pending_to_free(qtx); in ossl_qtx_pop_net()
1013 void ossl_qtx_set_bio(OSSL_QTX *qtx, BIO *bio) in ossl_qtx_set_bio() argument
1015 qtx->bio = bio; in ossl_qtx_set_bio()
1018 int ossl_qtx_set_mdpl(OSSL_QTX *qtx, size_t mdpl) in ossl_qtx_set_mdpl() argument
1023 qtx->mdpl = mdpl; in ossl_qtx_set_mdpl()
1027 size_t ossl_qtx_get_mdpl(OSSL_QTX *qtx) in ossl_qtx_get_mdpl() argument
1029 return qtx->mdpl; in ossl_qtx_get_mdpl()
1032 size_t ossl_qtx_get_queue_len_datagrams(OSSL_QTX *qtx) in ossl_qtx_get_queue_len_datagrams() argument
1034 return qtx->pending_count; in ossl_qtx_get_queue_len_datagrams()
1037 size_t ossl_qtx_get_queue_len_bytes(OSSL_QTX *qtx) in ossl_qtx_get_queue_len_bytes() argument
1039 return qtx->pending_bytes; in ossl_qtx_get_queue_len_bytes()
1042 size_t ossl_qtx_get_cur_dgram_len_bytes(OSSL_QTX *qtx) in ossl_qtx_get_cur_dgram_len_bytes() argument
1044 return qtx->cons != NULL ? qtx->cons->data_len : 0; in ossl_qtx_get_cur_dgram_len_bytes()
1047 size_t ossl_qtx_get_unflushed_pkt_count(OSSL_QTX *qtx) in ossl_qtx_get_unflushed_pkt_count() argument
1049 return qtx->cons_count; in ossl_qtx_get_unflushed_pkt_count()
1052 int ossl_qtx_trigger_key_update(OSSL_QTX *qtx) in ossl_qtx_trigger_key_update() argument
1054 return ossl_qrl_enc_level_set_key_update(&qtx->el_set, in ossl_qtx_trigger_key_update()
1058 uint64_t ossl_qtx_get_cur_epoch_pkt_count(OSSL_QTX *qtx, uint32_t enc_level) in ossl_qtx_get_cur_epoch_pkt_count() argument
1062 el = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in ossl_qtx_get_cur_epoch_pkt_count()
1069 uint64_t ossl_qtx_get_max_epoch_pkt_count(OSSL_QTX *qtx, uint32_t enc_level) in ossl_qtx_get_max_epoch_pkt_count() argument
1073 el = ossl_qrl_enc_level_set_get(&qtx->el_set, enc_level, 1); in ossl_qtx_get_max_epoch_pkt_count()
1080 void ossl_qtx_set_msg_callback(OSSL_QTX *qtx, ossl_msg_cb msg_callback, in ossl_qtx_set_msg_callback() argument
1083 qtx->msg_callback = msg_callback; in ossl_qtx_set_msg_callback()
1084 qtx->msg_callback_ssl = msg_callback_ssl; in ossl_qtx_set_msg_callback()
1087 void ossl_qtx_set_msg_callback_arg(OSSL_QTX *qtx, void *msg_callback_arg) in ossl_qtx_set_msg_callback_arg() argument
1089 qtx->msg_callback_arg = msg_callback_arg; in ossl_qtx_set_msg_callback_arg()
1092 uint64_t ossl_qtx_get_key_epoch(OSSL_QTX *qtx) in ossl_qtx_get_key_epoch() argument
1096 el = ossl_qrl_enc_level_set_get(&qtx->el_set, QUIC_ENC_LEVEL_1RTT, 1); in ossl_qtx_get_key_epoch()