summaryrefslogtreecommitdiffstats
path: root/ssl/quic
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-07-03 14:15:12 +0200
committerPauli <pauli@openssl.org>2023-07-17 00:18:05 +0200
commit96b7df60b3e54641c6046fea31c7a5cb535c2eeb (patch)
treeae5627bb8fc84e2291acb5c08c083d98b46cc9ab /ssl/quic
parentQUIC: Multistream test fixes (diff)
downloadopenssl-96b7df60b3e54641c6046fea31c7a5cb535c2eeb.tar.xz
openssl-96b7df60b3e54641c6046fea31c7a5cb535c2eeb.zip
Minor updates
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21135)
Diffstat (limited to 'ssl/quic')
-rw-r--r--ssl/quic/quic_channel.c8
-rw-r--r--ssl/quic/quic_stream_map.c5
-rw-r--r--ssl/quic/quic_txp.c9
3 files changed, 13 insertions, 9 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index d24e6e182d..cb644179d7 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -1854,12 +1854,13 @@ static void ch_rx_handle_packet(QUIC_CHANNEL *ch)
*
* We need to be a bit careful here as due to the BIO abstraction layer an
* application is liable to be weird and lie to us about peer addresses.
- * Only apply this check if we actually are using a real address and haven't
- * been given AF_UNSPEC by the application.
+ * Only apply this check if we actually are using a real AF_INET or AF_INET6
+ * address.
*/
if (!ch->is_server
&& ch->qrx_pkt->peer != NULL
- && BIO_ADDR_family(&ch->cur_peer_addr) != AF_UNSPEC
+ && (BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET
+ || BIO_ADDR_family(&ch->cur_peer_addr) == AF_INET6)
&& !bio_addr_eq(ch->qrx_pkt->peer, &ch->cur_peer_addr))
return;
@@ -2984,7 +2985,6 @@ QUIC_STREAM *ossl_quic_channel_new_stream_local(QUIC_CHANNEL *ch, int is_uni)
if ((qs = ossl_quic_stream_map_alloc(&ch->qsm, stream_id, type)) == NULL)
return NULL;
-
/* Locally-initiated stream, so we always want a send buffer. */
if (!ch_init_new_stream(ch, qs, /*can_send=*/1, /*can_recv=*/!is_uni))
goto err;
diff --git a/ssl/quic/quic_stream_map.c b/ssl/quic/quic_stream_map.c
index 11278e9cc3..1f8fff03be 100644
--- a/ssl/quic/quic_stream_map.c
+++ b/ssl/quic/quic_stream_map.c
@@ -495,7 +495,8 @@ int ossl_quic_stream_map_notify_reset_stream_acked(QUIC_STREAM_MAP *qsm,
}
}
-/* Stream Receive Part State Management
+/*
+ * Stream Receive Part State Management
* ====================================
*/
@@ -511,7 +512,7 @@ int ossl_quic_stream_map_notify_size_known_recv_part(QUIC_STREAM_MAP *qsm,
return 0;
case QUIC_RSTREAM_STATE_RECV:
- qs->recv_state = QUIC_RSTREAM_STATE_SIZE_KNOWN;
+ qs->recv_state = QUIC_RSTREAM_STATE_SIZE_KNOWN;
return 1;
}
}
diff --git a/ssl/quic/quic_txp.c b/ssl/quic/quic_txp.c
index 313c2fef36..a4957c7c39 100644
--- a/ssl/quic/quic_txp.c
+++ b/ssl/quic/quic_txp.c
@@ -1888,7 +1888,8 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
if (stream->want_reset_stream) {
OSSL_QUIC_FRAME_RESET_STREAM f;
- assert(stream->send_state == QUIC_SSTREAM_STATE_RESET_SENT);
+ if (!ossl_assert(stream->send_state == QUIC_SSTREAM_STATE_RESET_SENT))
+ return 0;
wpkt = tx_helper_begin(h);
if (wpkt == NULL)
@@ -1918,7 +1919,8 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
* parties; if we happen to send a RESET_STREAM that consumes more
* flow control credit, make sure we account for that.
*/
- assert(f.final_size <= ossl_quic_txfc_get_swm(&stream->txfc));
+ if (!ossl_assert(f.final_size <= ossl_quic_txfc_get_swm(&stream->txfc)))
+ return 0;
stream->txp_txfc_new_credit_consumed
= f.final_size - ossl_quic_txfc_get_swm(&stream->txfc);
@@ -1971,7 +1973,8 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
&& !ossl_quic_stream_send_is_reset(stream)) {
int packet_full = 0, stream_drained = 0;
- assert(!stream->want_reset_stream);
+ if (!ossl_assert(!stream->want_reset_stream))
+ return 0;
if (!txp_generate_stream_frames(txp, h, pn_space, tpkt,
stream->id, stream->sstream,