*
* Other packets in the same datagram will still be processed where possible.
*
- * The intended use for this function is to allow validation of whether a PN is
- * a potential duplicate before spending CPU time decrypting the packet payload.
- *
* The callback is optional and can be unset by passing NULL for cb.
* cb_arg is an opaque value passed to cb.
*/
*/
void ossl_quic_stream_map_set_rr_stepping(QUIC_STREAM_MAP *qsm, size_t stepping);
-
/*
* Stream Send Part
* ================
* STREAM_DATA_BLOCKED) frame transmission for locally-initiated streams.
*
* Our implementation does not currently do this and we allocate stream IDs up
- * front, however we may revisit this in the future. Calling this ensures
- * represents a demand for a stream ID by the caller and ensures one has been
- * allocated to the stream, and causes us to transition to SEND if we are still
- * in the READY state.
+ * front, however we may revisit this in the future. Calling this represents a
+ * demand for a stream ID by the caller and ensures one has been allocated to
+ * the stream, and causes us to transition to SEND if we are still in the READY
+ * state.
*
* Returns 0 if there is no send part (caller error) and 1 otherwise.
*/
/*
* Marks the stream as wanting a STOP_SENDING frame transmitted. It is not valid
- * to vall this if ossl_quic_stream_map_stop_sending_recv_part() has not been
+ * to call this if ossl_quic_stream_map_stop_sending_recv_part() has not been
* called. For TXP use.
*/
int ossl_quic_stream_map_schedule_stop_sending(QUIC_STREAM_MAP *qsm,
# define QUIC_STATELESS_RESET_TOKEN_LEN 16
/*
- * An encoded preferred_addr transport parameter cannot be longer than this
- * number of bytes.
+ * An encoded preferred_addr transport parameter cannot be shorter or longer
+ * than these lengths in bytes.
*/
# define QUIC_MIN_ENCODED_PREFERRED_ADDR_LEN 41
# define QUIC_MAX_ENCODED_PREFERRED_ADDR_LEN 61
*
* 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;
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;
}
}
-/* Stream Receive Part State Management
+/*
+ * Stream Receive Part State Management
* ====================================
*/
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;
}
}
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)
* 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);
&& !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,
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}
ok = 1;
err:
- WPACKET_finish(&wpkt);
+ if (ok)
+ WPACKET_finish(&wpkt);
+ else
+ WPACKET_cleanup(&wpkt);
return ok;
}