Lines Matching refs:rxe
46 OSSL_LIST_MEMBER(rxe, RXE);
82 DEFINE_LIST_OF(rxe, RXE);
83 typedef OSSL_LIST(rxe) RXE_LIST;
319 RXE *rxe = ossl_list_rxe_head(&qrx->rx_pending); in qrx_pop_pending_rxe() local
321 if (rxe == NULL) in qrx_pop_pending_rxe()
324 ossl_list_rxe_remove(&qrx->rx_pending, rxe); in qrx_pop_pending_rxe()
325 return rxe; in qrx_pop_pending_rxe()
331 RXE *rxe; in qrx_alloc_rxe() local
336 rxe = OPENSSL_malloc(sizeof(RXE) + alloc_len); in qrx_alloc_rxe()
337 if (rxe == NULL) in qrx_alloc_rxe()
340 ossl_list_rxe_init_elem(rxe); in qrx_alloc_rxe()
341 rxe->alloc_len = alloc_len; in qrx_alloc_rxe()
342 rxe->data_len = 0; in qrx_alloc_rxe()
343 rxe->refcount = 0; in qrx_alloc_rxe()
344 return rxe; in qrx_alloc_rxe()
356 RXE *rxe; in qrx_ensure_free_rxe() local
361 rxe = qrx_alloc_rxe(alloc_len); in qrx_ensure_free_rxe()
362 if (rxe == NULL) in qrx_ensure_free_rxe()
365 ossl_list_rxe_insert_tail(&qrx->rx_free, rxe); in qrx_ensure_free_rxe()
366 return rxe; in qrx_ensure_free_rxe()
374 static RXE *qrx_resize_rxe(RXE_LIST *rxl, RXE *rxe, size_t n) in qrx_resize_rxe() argument
379 if (rxe == NULL) in qrx_resize_rxe()
386 p = ossl_list_rxe_prev(rxe); in qrx_resize_rxe()
387 ossl_list_rxe_remove(rxl, rxe); in qrx_resize_rxe()
390 if (!ossl_assert(rxe->refcount == 0)) in qrx_resize_rxe()
397 rxe2 = OPENSSL_realloc(rxe, sizeof(RXE) + n); in qrx_resize_rxe()
401 ossl_list_rxe_insert_head(rxl, rxe); in qrx_resize_rxe()
403 ossl_list_rxe_insert_after(rxl, p, rxe); in qrx_resize_rxe()
421 RXE *rxe, size_t n) in qrx_reserve_rxe() argument
423 if (rxe->alloc_len >= n) in qrx_reserve_rxe()
424 return rxe; in qrx_reserve_rxe()
426 return qrx_resize_rxe(rxl, rxe, n); in qrx_reserve_rxe()
430 static void qrx_recycle_rxe(OSSL_QRX *qrx, RXE *rxe) in qrx_recycle_rxe() argument
433 assert(ossl_list_rxe_prev(rxe) == NULL && ossl_list_rxe_next(rxe) == NULL); in qrx_recycle_rxe()
434 rxe->pkt.hdr = NULL; in qrx_recycle_rxe()
435 rxe->pkt.peer = NULL; in qrx_recycle_rxe()
436 rxe->pkt.local = NULL; in qrx_recycle_rxe()
437 ossl_list_rxe_insert_tail(&qrx->rx_free, rxe); in qrx_recycle_rxe()
450 RXE *rxe; in qrx_relocate_buffer() local
456 if ((rxe = qrx_reserve_rxe(&qrx->rx_free, *prxe, *pi + buf_len)) == NULL) in qrx_relocate_buffer()
459 *prxe = rxe; in qrx_relocate_buffer()
460 dst = (unsigned char *)rxe_data(rxe) + *pi; in qrx_relocate_buffer()
488 static uint32_t rxe_determine_pn_space(RXE *rxe) in rxe_determine_pn_space() argument
492 enc_level = qrx_determine_enc_level(&rxe->hdr); in rxe_determine_pn_space()
496 static int qrx_validate_hdr_early(OSSL_QRX *qrx, RXE *rxe, in qrx_validate_hdr_early() argument
500 if (rxe->hdr.version != QUIC_VERSION_1 in qrx_validate_hdr_early()
501 && rxe->hdr.version != QUIC_VERSION_NONE) in qrx_validate_hdr_early()
505 if (rxe->hdr.type == QUIC_PKT_TYPE_0RTT) in qrx_validate_hdr_early()
509 if (first_dcid != NULL && !ossl_quic_pkt_type_can_share_dgram(rxe->hdr.type)) in qrx_validate_hdr_early()
519 &rxe->hdr.dst_conn_id)) in qrx_validate_hdr_early()
527 static int qrx_validate_hdr(OSSL_QRX *qrx, RXE *rxe) in qrx_validate_hdr() argument
529 int pn_space = rxe_determine_pn_space(rxe); in qrx_validate_hdr()
531 if (!ossl_quic_wire_decode_pkt_hdr_pn(rxe->hdr.pn, rxe->hdr.pn_len, in qrx_validate_hdr()
533 &rxe->pn)) in qrx_validate_hdr()
540 static int qrx_validate_hdr_late(OSSL_QRX *qrx, RXE *rxe) in qrx_validate_hdr_late() argument
542 int pn_space = rxe_determine_pn_space(rxe); in qrx_validate_hdr_late()
549 && !qrx->validation_cb(rxe->pn, pn_space, qrx->validation_cb_arg)) in qrx_validate_hdr_late()
786 RXE *rxe; in qrx_process_pkt() local
802 rxe = qrx_ensure_free_rxe(qrx, PACKET_remaining(pkt)); in qrx_process_pkt()
803 if (rxe == NULL) in qrx_process_pkt()
818 need_second_decode, 0, &rxe->hdr, &ptrs)) in qrx_process_pkt()
832 *first_dcid = rxe->hdr.dst_conn_id; in qrx_process_pkt()
839 || !qrx_validate_hdr_early(qrx, rxe, pkt_idx == 0 ? NULL : first_dcid)) in qrx_process_pkt()
846 if (!ossl_quic_pkt_type_is_encrypted(rxe->hdr.type)) { in qrx_process_pkt()
854 if ((rxe = qrx_reserve_rxe(&qrx->rx_free, rxe, rxe->hdr.len)) == NULL) in qrx_process_pkt()
862 memcpy(rxe_data(rxe), rxe->hdr.data, rxe->hdr.len); in qrx_process_pkt()
865 rxe->hdr.data = rxe_data(rxe); in qrx_process_pkt()
866 rxe->pn = QUIC_PN_INVALID; in qrx_process_pkt()
868 rxe->data_len = rxe->hdr.len; in qrx_process_pkt()
869 rxe->datagram_len = datagram_len; in qrx_process_pkt()
870 rxe->key_epoch = 0; in qrx_process_pkt()
871 rxe->peer = urxe->peer; in qrx_process_pkt()
872 rxe->local = urxe->local; in qrx_process_pkt()
873 rxe->time = urxe->time; in qrx_process_pkt()
874 rxe->datagram_id = urxe->datagram_id; in qrx_process_pkt()
877 ossl_list_rxe_remove(&qrx->rx_free, rxe); in qrx_process_pkt()
878 ossl_list_rxe_insert_tail(&qrx->rx_pending, rxe); in qrx_process_pkt()
883 enc_level = qrx_determine_enc_level(&rxe->hdr); in qrx_process_pkt()
922 if (rxe->hdr.type == QUIC_PKT_TYPE_INITIAL) { in qrx_process_pkt()
923 const unsigned char *token = rxe->hdr.token; in qrx_process_pkt()
930 if (!qrx_relocate_buffer(qrx, &rxe, &i, &token, rxe->hdr.token_len)) in qrx_process_pkt()
933 rxe->hdr.token = token; in qrx_process_pkt()
954 0, 0, &rxe->hdr, NULL) != 1) in qrx_process_pkt()
959 if (!qrx_validate_hdr(qrx, rxe)) in qrx_process_pkt()
964 eop - sop - rxe->hdr.len, qrx->msg_callback_ssl, in qrx_process_pkt()
972 aad_len = rxe->hdr.data - sop; in qrx_process_pkt()
975 if ((rxe = qrx_reserve_rxe(&qrx->rx_free, rxe, rxe->hdr.len + i)) == NULL) { in qrx_process_pkt()
998 dst = (unsigned char *)rxe_data(rxe) + i; in qrx_process_pkt()
999 if (!qrx_decrypt_pkt_body(qrx, dst, rxe->hdr.data, rxe->hdr.len, in qrx_process_pkt()
1000 &dec_len, sop, aad_len, rxe->pn, enc_level, in qrx_process_pkt()
1001 rxe->hdr.key_phase, &rx_key_epoch)) in qrx_process_pkt()
1015 if (!qrx_validate_hdr_late(qrx, rxe)) in qrx_process_pkt()
1019 if (rxe->hdr.type == QUIC_PKT_TYPE_1RTT in qrx_process_pkt()
1020 && rxe->hdr.key_phase != (el->key_epoch & 1)) in qrx_process_pkt()
1021 qrx_key_update_initiated(qrx, rxe->pn); in qrx_process_pkt()
1044 rxe->hdr.data = dst; in qrx_process_pkt()
1045 rxe->hdr.len = dec_len; in qrx_process_pkt()
1046 rxe->data_len = dec_len; in qrx_process_pkt()
1047 rxe->datagram_len = datagram_len; in qrx_process_pkt()
1048 rxe->key_epoch = rx_key_epoch; in qrx_process_pkt()
1051 pn_space = rxe_determine_pn_space(rxe); in qrx_process_pkt()
1052 if (rxe->pn > qrx->largest_pn[pn_space]) in qrx_process_pkt()
1053 qrx->largest_pn[pn_space] = rxe->pn; in qrx_process_pkt()
1056 rxe->peer = urxe->peer; in qrx_process_pkt()
1057 rxe->local = urxe->local; in qrx_process_pkt()
1058 rxe->time = urxe->time; in qrx_process_pkt()
1059 rxe->datagram_id = urxe->datagram_id; in qrx_process_pkt()
1062 ossl_list_rxe_remove(&qrx->rx_free, rxe); in qrx_process_pkt()
1063 ossl_list_rxe_insert_tail(&qrx->rx_pending, rxe); in qrx_process_pkt()
1212 RXE *rxe; in ossl_qrx_read_pkt() local
1222 rxe = qrx_pop_pending_rxe(qrx); in ossl_qrx_read_pkt()
1223 if (!ossl_assert(rxe != NULL)) in ossl_qrx_read_pkt()
1226 assert(rxe->refcount == 0); in ossl_qrx_read_pkt()
1227 rxe->refcount = 1; in ossl_qrx_read_pkt()
1229 rxe->pkt.hdr = &rxe->hdr; in ossl_qrx_read_pkt()
1230 rxe->pkt.pn = rxe->pn; in ossl_qrx_read_pkt()
1231 rxe->pkt.time = rxe->time; in ossl_qrx_read_pkt()
1232 rxe->pkt.datagram_len = rxe->datagram_len; in ossl_qrx_read_pkt()
1233 rxe->pkt.peer in ossl_qrx_read_pkt()
1234 = BIO_ADDR_family(&rxe->peer) != AF_UNSPEC ? &rxe->peer : NULL; in ossl_qrx_read_pkt()
1235 rxe->pkt.local in ossl_qrx_read_pkt()
1236 = BIO_ADDR_family(&rxe->local) != AF_UNSPEC ? &rxe->local : NULL; in ossl_qrx_read_pkt()
1237 rxe->pkt.key_epoch = rxe->key_epoch; in ossl_qrx_read_pkt()
1238 rxe->pkt.datagram_id = rxe->datagram_id; in ossl_qrx_read_pkt()
1239 rxe->pkt.qrx = qrx; in ossl_qrx_read_pkt()
1240 *ppkt = &rxe->pkt; in ossl_qrx_read_pkt()
1247 RXE *rxe; in ossl_qrx_pkt_release() local
1252 rxe = (RXE *)pkt; in ossl_qrx_pkt_release()
1253 assert(rxe->refcount > 0); in ossl_qrx_pkt_release()
1254 if (--rxe->refcount == 0) in ossl_qrx_pkt_release()
1255 qrx_recycle_rxe(pkt->qrx, rxe); in ossl_qrx_pkt_release()
1260 RXE *rxe = (RXE *)pkt; in ossl_qrx_pkt_up_ref() local
1262 assert(rxe->refcount > 0); in ossl_qrx_pkt_up_ref()
1263 ++rxe->refcount; in ossl_qrx_pkt_up_ref()