mirror of https://github.com/openssl/openssl
QUIC Test Server: Minor fixups
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19734)
This commit is contained in:
parent
64222fc027
commit
091f532e0e
|
@ -60,9 +60,9 @@ int ossl_quic_tserver_read(QUIC_TSERVER *srv,
|
|||
|
||||
/*
|
||||
* Attempts to write to stream 0. Writes the number of bytes consumed to
|
||||
* *consumed and returns 1 on success. If there is no space currently available
|
||||
* to write any bytes, 0 is written to *consumed and 1 is returned (this is
|
||||
* considered a success case).
|
||||
* *bytes_written and returns 1 on success. If there is no space currently
|
||||
* available to write any bytes, 0 is written to *consumed and 1 is returned
|
||||
* (this is considered a success case).
|
||||
*
|
||||
* Note that unlike libssl public APIs, this API always works in a 'partial
|
||||
* write' mode.
|
||||
|
|
|
@ -1454,7 +1454,7 @@ static void ch_default_packet_handler(QUIC_URXE *e, void *arg)
|
|||
goto undesirable;
|
||||
|
||||
if (!PACKET_buf_init(&pkt, ossl_quic_urxe_data(e), e->data_len))
|
||||
goto undesirable;
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* We set short_conn_id_len to SIZE_MAX here which will cause the decode
|
||||
|
@ -1495,11 +1495,14 @@ static void ch_default_packet_handler(QUIC_URXE *e, void *arg)
|
|||
if (!ch_server_on_new_conn(ch, &e->peer,
|
||||
&hdr.src_conn_id,
|
||||
&hdr.dst_conn_id))
|
||||
goto undesirable;
|
||||
goto err;
|
||||
|
||||
ossl_qrx_inject_urxe(ch->qrx, e);
|
||||
return;
|
||||
|
||||
err:
|
||||
ossl_quic_channel_raise_protocol_error(ch, QUIC_ERR_INTERNAL_ERROR, 0,
|
||||
"internal error");
|
||||
undesirable:
|
||||
ossl_quic_demux_release_urxe(ch->demux, e);
|
||||
}
|
||||
|
@ -1690,7 +1693,7 @@ int ossl_quic_channel_start(QUIC_CHANNEL *ch)
|
|||
if (!ossl_quic_provide_initial_secret(ch->libctx,
|
||||
ch->propq,
|
||||
&ch->init_dcid,
|
||||
/*is_server=*/ch->is_server,
|
||||
ch->is_server,
|
||||
ch->qrx, ch->qtx))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ int ossl_quic_tserver_read(QUIC_TSERVER *srv,
|
|||
* the peer).
|
||||
*/
|
||||
OSSL_RTT_INFO rtt_info;
|
||||
|
||||
ossl_statm_get_rtt_info(ossl_quic_channel_get_statm(srv->ch), &rtt_info);
|
||||
|
||||
if (!ossl_quic_rxfc_on_retire(&srv->stream0->rxfc, *bytes_read,
|
||||
|
|
|
@ -316,9 +316,9 @@ static int txp_el_pending(OSSL_QUIC_TX_PACKETISER *txp, uint32_t enc_level,
|
|||
uint32_t *conn_close_enc_level);
|
||||
static int txp_generate_for_el(OSSL_QUIC_TX_PACKETISER *txp, uint32_t enc_level,
|
||||
uint32_t archetype,
|
||||
char is_last_in_dgram,
|
||||
char dgram_contains_initial,
|
||||
char chosen_for_conn_close);
|
||||
int is_last_in_dgram,
|
||||
int dgram_contains_initial,
|
||||
int chosen_for_conn_close);
|
||||
static size_t txp_determine_pn_len(OSSL_QUIC_TX_PACKETISER *txp);
|
||||
static int txp_determine_ppl_from_pl(OSSL_QUIC_TX_PACKETISER *txp,
|
||||
size_t pl,
|
||||
|
@ -333,7 +333,7 @@ static int txp_generate_for_el_actual(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
size_t max_ppl,
|
||||
size_t pkt_overhead,
|
||||
QUIC_PKT_HDR *phdr,
|
||||
char chosen_for_conn_close);
|
||||
int chosen_for_conn_close);
|
||||
|
||||
OSSL_QUIC_TX_PACKETISER *ossl_quic_tx_packetiser_new(const OSSL_QUIC_TX_PACKETISER_ARGS *args)
|
||||
{
|
||||
|
@ -498,7 +498,7 @@ int ossl_quic_tx_packetiser_generate(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
uint32_t archetype)
|
||||
{
|
||||
uint32_t enc_level, conn_close_enc_level = QUIC_ENC_LEVEL_NUM;
|
||||
char have_pkt_for_el[QUIC_ENC_LEVEL_NUM], is_last_in_dgram;
|
||||
int have_pkt_for_el[QUIC_ENC_LEVEL_NUM], is_last_in_dgram;
|
||||
size_t num_el_in_dgram = 0, pkts_done = 0;
|
||||
int rc;
|
||||
|
||||
|
@ -859,11 +859,11 @@ static int sstream_is_pending(QUIC_SSTREAM *sstream)
|
|||
*/
|
||||
static int txp_generate_for_el(OSSL_QUIC_TX_PACKETISER *txp, uint32_t enc_level,
|
||||
uint32_t archetype,
|
||||
char is_last_in_dgram,
|
||||
char dgram_contains_initial,
|
||||
char chosen_for_conn_close)
|
||||
int is_last_in_dgram,
|
||||
int dgram_contains_initial,
|
||||
int chosen_for_conn_close)
|
||||
{
|
||||
char must_pad = dgram_contains_initial && is_last_in_dgram;
|
||||
int must_pad = dgram_contains_initial && is_last_in_dgram;
|
||||
size_t min_dpl, min_pl, min_ppl, cmpl, cmppl, running_total;
|
||||
size_t mdpl, hdr_len, pkt_overhead, cc_limit;
|
||||
uint64_t cc_limit_;
|
||||
|
@ -1092,7 +1092,7 @@ static int txp_generate_pre_token(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
QUIC_TXPIM_PKT *tpkt,
|
||||
uint32_t pn_space,
|
||||
struct archetype_data *a,
|
||||
char chosen_for_conn_close)
|
||||
int chosen_for_conn_close)
|
||||
{
|
||||
const OSSL_QUIC_FRAME_ACK *ack;
|
||||
OSSL_QUIC_FRAME_ACK ack2;
|
||||
|
@ -1264,7 +1264,7 @@ static int txp_generate_crypto_frames(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
struct tx_helper *h,
|
||||
uint32_t pn_space,
|
||||
QUIC_TXPIM_PKT *tpkt,
|
||||
char *have_ack_eliciting)
|
||||
int *have_ack_eliciting)
|
||||
{
|
||||
size_t num_stream_iovec;
|
||||
OSSL_QUIC_FRAME_STREAM shdr = {0};
|
||||
|
@ -1351,7 +1351,7 @@ struct chunk_info {
|
|||
OSSL_QUIC_FRAME_STREAM shdr;
|
||||
OSSL_QTX_IOVEC iov[2];
|
||||
size_t num_stream_iovec;
|
||||
char valid;
|
||||
int valid;
|
||||
};
|
||||
|
||||
static int txp_plan_stream_chunk(OSSL_QUIC_TX_PACKETISER *txp,
|
||||
|
@ -1414,9 +1414,9 @@ static int txp_generate_stream_frames(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
QUIC_TXFC *stream_txfc,
|
||||
QUIC_STREAM *next_stream,
|
||||
size_t min_ppl,
|
||||
char *have_ack_eliciting,
|
||||
char *packet_full,
|
||||
char *stream_drained,
|
||||
int *have_ack_eliciting,
|
||||
int *packet_full,
|
||||
int *stream_drained,
|
||||
uint64_t *new_credit_consumed)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -1626,7 +1626,7 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
uint32_t pn_space,
|
||||
QUIC_TXPIM_PKT *tpkt,
|
||||
size_t min_ppl,
|
||||
char *have_ack_eliciting,
|
||||
int *have_ack_eliciting,
|
||||
QUIC_STREAM **tmp_head)
|
||||
{
|
||||
QUIC_STREAM_ITER it;
|
||||
|
@ -1727,7 +1727,7 @@ static int txp_generate_stream_related(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
|
||||
/* Stream Data Frames (STREAM) */
|
||||
if (stream->sstream != NULL) {
|
||||
char packet_full = 0, stream_drained = 0;
|
||||
int packet_full = 0, stream_drained = 0;
|
||||
|
||||
if (!txp_generate_stream_frames(txp, h, pn_space, tpkt,
|
||||
stream->id, stream->sstream,
|
||||
|
@ -1768,14 +1768,14 @@ static int txp_generate_for_el_actual(OSSL_QUIC_TX_PACKETISER *txp,
|
|||
size_t max_ppl,
|
||||
size_t pkt_overhead,
|
||||
QUIC_PKT_HDR *phdr,
|
||||
char chosen_for_conn_close)
|
||||
int chosen_for_conn_close)
|
||||
{
|
||||
int rc = TXP_ERR_SUCCESS;
|
||||
struct archetype_data a;
|
||||
uint32_t pn_space = ossl_quic_enc_level_to_pn_space(enc_level);
|
||||
struct tx_helper h;
|
||||
char have_helper = 0, have_ack_eliciting = 0, done_pre_token = 0;
|
||||
char require_ack_eliciting;
|
||||
int have_helper = 0, have_ack_eliciting = 0, done_pre_token = 0;
|
||||
int require_ack_eliciting;
|
||||
QUIC_CFQ_ITEM *cfq_item;
|
||||
QUIC_TXPIM_PKT *tpkt = NULL;
|
||||
OSSL_QTX_PKT pkt;
|
||||
|
|
|
@ -1057,7 +1057,9 @@ ENDIF
|
|||
ENDIF
|
||||
|
||||
IF[{- !$disabled{'quic'} -}]
|
||||
PROGRAMS{noinst}=quicapitest quic_wire_test quic_ackm_test quic_record_test quic_fc_test quic_stream_test quic_cfq_test quic_txpim_test quic_fifd_test quic_txp_test quic_tserver_test
|
||||
PROGRAMS{noinst}=quicapitest quic_wire_test quic_ackm_test quic_record_test
|
||||
PROGRAMS{noinst}=quic_fc_test quic_stream_test quic_cfq_test quic_txpim_test
|
||||
PROGRAMS{noinst}=quic_fifd_test quic_txp_test quic_tserver_test
|
||||
ENDIF
|
||||
|
||||
SOURCE[quicapitest]=quicapitest.c helpers/ssltestlib.c
|
||||
|
|
|
@ -21,6 +21,7 @@ static char msg2[1024], msg3[1024];
|
|||
static int is_want(SSL *s, int ret)
|
||||
{
|
||||
int ec = SSL_get_error(s, ret);
|
||||
|
||||
return ec == SSL_ERROR_WANT_READ || ec == SSL_ERROR_WANT_WRITE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue