summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/internal/quic_channel.h10
-rw-r--r--include/internal/quic_tserver.h8
-rw-r--r--ssl/quic/quic_channel.c44
-rw-r--r--ssl/quic/quic_impl.c6
-rw-r--r--ssl/quic/quic_tserver.c15
-rw-r--r--test/helpers/quictestlib.c92
-rw-r--r--test/helpers/quictestlib.h108
-rw-r--r--test/quicfaultstest.c58
8 files changed, 168 insertions, 173 deletions
diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h
index d2503158e4..29682ff72f 100644
--- a/include/internal/quic_channel.h
+++ b/include/internal/quic_channel.h
@@ -186,12 +186,10 @@ QUIC_STREAM *ossl_quic_channel_get_stream_by_id(QUIC_CHANNEL *ch,
uint64_t stream_id);
/* Returns 1 if channel is terminating or terminated. */
-int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause);
-int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause);
-int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause);
+int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch);
+QUIC_TERMINATE_CAUSE ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch);
+int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch);
+int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch);
int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch);
int ossl_quic_channel_is_handshake_complete(const QUIC_CHANNEL *ch);
int ossl_quic_channel_is_handshake_confirmed(const QUIC_CHANNEL *ch);
diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h
index bfe5e32985..cf74d87569 100644
--- a/include/internal/quic_tserver.h
+++ b/include/internal/quic_tserver.h
@@ -63,12 +63,12 @@ int ossl_quic_tserver_tick(QUIC_TSERVER *srv);
int ossl_quic_tserver_is_handshake_confirmed(QUIC_TSERVER *srv);
/* Returns 1 if the server is in any terminating or terminated state */
-int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv,
- QUIC_TERMINATE_CAUSE *cause);
+int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv);
+
+QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(QUIC_TSERVER *srv);
/* Returns 1 if the server is in a terminated state */
-int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv,
- QUIC_TERMINATE_CAUSE *cause);
+int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv);
/*
* Attempts to read from stream 0. Writes the number of bytes read to
* *bytes_read and returns 1 on success. If no bytes are available, 0 is written
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c
index cb820fffc8..1a95c0e10d 100644
--- a/ssl/quic/quic_channel.c
+++ b/ssl/quic/quic_channel.c
@@ -398,34 +398,32 @@ int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch)
return ch != NULL && ch->state == QUIC_CHANNEL_STATE_ACTIVE;
}
-int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause)
+int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch)
{
if (ch->state == QUIC_CHANNEL_STATE_TERMINATING_CLOSING
- || ch->state == QUIC_CHANNEL_STATE_TERMINATING_DRAINING) {
- if (cause != NULL)
- *cause = ch->terminate_cause;
+ || ch->state == QUIC_CHANNEL_STATE_TERMINATING_DRAINING)
return 1;
- }
+
return 0;
}
-int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause)
+int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch)
{
- if (ch->state == QUIC_CHANNEL_STATE_TERMINATED) {
- if (cause != NULL)
- *cause = ch->terminate_cause;
+ if (ch->state == QUIC_CHANNEL_STATE_TERMINATED)
return 1;
- }
+
return 0;
}
-int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch,
- QUIC_TERMINATE_CAUSE *cause)
+int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch)
+{
+ return ossl_quic_channel_is_terminating(ch)
+ || ossl_quic_channel_is_terminated(ch);
+}
+
+QUIC_TERMINATE_CAUSE ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch)
{
- return ossl_quic_channel_is_terminating(ch, cause)
- || ossl_quic_channel_is_terminated(ch, cause);
+ return ch->terminate_cause;
}
int ossl_quic_channel_is_handshake_complete(const QUIC_CHANNEL *ch)
@@ -1213,7 +1211,7 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
*/
/* If we are in the TERMINATED state, there is nothing to do. */
- if (ossl_quic_channel_is_terminated(ch, NULL)) {
+ if (ossl_quic_channel_is_terminated(ch)) {
res->net_read_desired = 0;
res->net_write_desired = 0;
res->tick_deadline = ossl_time_infinite();
@@ -1224,7 +1222,7 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
* If we are in the TERMINATING state, check if the terminating timer has
* expired.
*/
- if (ossl_quic_channel_is_terminating(ch, NULL)) {
+ if (ossl_quic_channel_is_terminating(ch)) {
now = ossl_time_now();
if (ossl_time_compare(now, ch->terminate_deadline) >= 0) {
@@ -1295,11 +1293,11 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
* errors in ch_rx_pre() or ch_tx() may have caused us to transition to the
* Terminated state.
*/
- res->net_read_desired = !ossl_quic_channel_is_terminated(ch, NULL);
+ res->net_read_desired = !ossl_quic_channel_is_terminated(ch);
/* We want to write to the network if we have any in our queue. */
res->net_write_desired
- = (!ossl_quic_channel_is_terminated(ch, NULL)
+ = (!ossl_quic_channel_is_terminated(ch)
&& ossl_qtx_get_queue_len_datagrams(ch->qtx) > 0);
}
@@ -1603,7 +1601,7 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch)
OSSL_TIME deadline;
uint32_t pn_space;
- if (ossl_quic_channel_is_terminated(ch, NULL))
+ if (ossl_quic_channel_is_terminated(ch))
return ossl_time_infinite();
deadline = ossl_ackm_get_loss_detection_deadline(ch->ackm);
@@ -1621,7 +1619,7 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch)
ch->cc_method->get_next_credit_time(ch->cc_data));
/* Is the terminating timer armed? */
- if (ossl_quic_channel_is_terminating(ch, NULL))
+ if (ossl_quic_channel_is_terminating(ch))
deadline = ossl_time_min(deadline,
ch->terminate_deadline);
else if (!ossl_time_is_infinite(ch->idle_deadline))
@@ -1751,7 +1749,7 @@ void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code)
{
QUIC_TERMINATE_CAUSE tcause = {0};
- if (ossl_quic_channel_is_term_any(ch, NULL))
+ if (ossl_quic_channel_is_term_any(ch))
return;
tcause.app = 1;
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index bb9132eb75..5448e32e73 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -646,7 +646,7 @@ int ossl_quic_do_handshake(QUIC_CONNECTION *qc)
/* Handshake already completed. */
return 1;
- if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL))
+ if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch))
return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL);
if (BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) {
@@ -1012,7 +1012,7 @@ int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written)
if (!expect_quic_conn(qc))
return 0;
- if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL))
+ if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch))
return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL);
/*
@@ -1133,7 +1133,7 @@ static int quic_read(SSL *s, void *buf, size_t len, size_t *bytes_read, int peek
if (!expect_quic_conn(qc))
return 0;
- if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL))
+ if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch))
return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL);
/* If we haven't finished the handshake, try to advance it. */
diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c
index 4c120d0d58..566d2c37ac 100644
--- a/ssl/quic/quic_tserver.c
+++ b/ssl/quic/quic_tserver.c
@@ -154,17 +154,20 @@ int ossl_quic_tserver_tick(QUIC_TSERVER *srv)
}
/* Returns 1 if the server is in any terminating or terminated state */
-int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv,
- QUIC_TERMINATE_CAUSE *cause)
+int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv)
{
- return ossl_quic_channel_is_term_any(srv->ch, cause);
+ return ossl_quic_channel_is_term_any(srv->ch);
+}
+
+QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(QUIC_TSERVER *srv)
+{
+ return ossl_quic_channel_get_terminate_cause(srv->ch);
}
/* Returns 1 if the server is in a terminated state */
-int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv,
- QUIC_TERMINATE_CAUSE *cause)
+int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv)
{
- return ossl_quic_channel_is_terminated(srv->ch, cause);
+ return ossl_quic_channel_is_terminated(srv->ch);
}
int ossl_quic_tserver_is_handshake_confirmed(QUIC_TSERVER *srv)
diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c
index 7fdd9cab31..657fcd257c 100644
--- a/test/helpers/quictestlib.c
+++ b/test/helpers/quictestlib.c
@@ -18,7 +18,7 @@
#define GROWTH_ALLOWANCE 1024
-struct ossl_quic_fault {
+struct qtest_fault {
QUIC_TSERVER *qtserv;
/* Plain packet mutations */
@@ -28,7 +28,7 @@ struct ossl_quic_fault {
OSSL_QTX_IOVEC pplainio;
/* Allocted size of the plaintext packet data buffer */
size_t pplainbuf_alloc;
- ossl_quic_fault_on_packet_plain_cb pplaincb;
+ qtest_fault_on_packet_plain_cb pplaincb;
void *pplaincbarg;
/* Handshake message mutations */
@@ -38,17 +38,17 @@ struct ossl_quic_fault {
size_t handbufalloc;
/* Actual length of the handshake message */
size_t handbuflen;
- ossl_quic_fault_on_handshake_cb handshakecb;
+ qtest_fault_on_handshake_cb handshakecb;
void *handshakecbarg;
- ossl_quic_fault_on_enc_ext_cb encextcb;
+ qtest_fault_on_enc_ext_cb encextcb;
void *encextcbarg;
/* Cipher packet mutations */
- ossl_quic_fault_on_packet_cipher_cb pciphercb;
+ qtest_fault_on_packet_cipher_cb pciphercb;
void *pciphercbarg;
/* Datagram mutations */
- ossl_quic_fault_on_datagram_cb datagramcb;
+ qtest_fault_on_datagram_cb datagramcb;
void *datagramcbarg;
/* The currently processed message */
BIO_MSG msg;
@@ -63,7 +63,7 @@ static BIO_METHOD *get_bio_method(void);
int qtest_create_quic_objects(SSL_CTX *clientctx, char *certfile, char *keyfile,
QUIC_TSERVER **qtserv, SSL **cssl,
- OSSL_QUIC_FAULT **fault)
+ QTEST_FAULT **fault)
{
/* ALPN value as recognised by QUIC_TSERVER */
unsigned char alpn[] = { 8, 'o', 's', 's', 'l', 't', 'e', 's', 't' };
@@ -183,7 +183,7 @@ int qtest_create_quic_connection(QUIC_TSERVER *qtserv, SSL *clientssl)
SSL_tick(clientssl);
if (!servererr && rets <= 0) {
ossl_quic_tserver_tick(qtserv);
- servererr = ossl_quic_tserver_is_term_any(qtserv, NULL);
+ servererr = ossl_quic_tserver_is_term_any(qtserv);
if (!servererr)
rets = ossl_quic_tserver_is_handshake_confirmed(qtserv);
}
@@ -228,7 +228,7 @@ int qtest_check_server_protocol_err(QUIC_TSERVER *qtserv)
return qtest_check_server_transport_err(qtserv, QUIC_ERR_PROTOCOL_VIOLATION);
}
-void ossl_quic_fault_free(OSSL_QUIC_FAULT *fault)
+void qtest_fault_free(QTEST_FAULT *fault)
{
if (fault == NULL)
return;
@@ -246,7 +246,7 @@ static int packet_plain_mutate(const QUIC_PKT_HDR *hdrin,
size_t *numout,
void *arg)
{
- OSSL_QUIC_FAULT *fault = arg;
+ QTEST_FAULT *fault = arg;
size_t i, bufsz = 0;
unsigned char *cur;
@@ -293,7 +293,7 @@ static int packet_plain_mutate(const QUIC_PKT_HDR *hdrin,
static void packet_plain_finish(void *arg)
{
- OSSL_QUIC_FAULT *fault = arg;
+ QTEST_FAULT *fault = arg;
/* Cast below is safe because we allocated the buffer */
OPENSSL_free((unsigned char *)fault->pplainio.buf);
@@ -302,9 +302,9 @@ static void packet_plain_finish(void *arg)
fault->pplainio.buf = NULL;
}
-int ossl_quic_fault_set_packet_plain_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_packet_plain_cb pplaincb,
- void *pplaincbarg)
+int qtest_fault_set_packet_plain_listener(QTEST_FAULT *fault,
+ qtest_fault_on_packet_plain_cb pplaincb,
+ void *pplaincbarg)
{
fault->pplaincb = pplaincb;
fault->pplaincbarg = pplaincbarg;
@@ -316,7 +316,7 @@ int ossl_quic_fault_set_packet_plain_listener(OSSL_QUIC_FAULT *fault,
}
/* To be called from a packet_plain_listener callback */
-int ossl_quic_fault_resize_plain_packet(OSSL_QUIC_FAULT *fault, size_t newlen)
+int qtest_fault_resize_plain_packet(QTEST_FAULT *fault, size_t newlen)
{
unsigned char *buf;
size_t oldlen = fault->pplainio.buf_len;
@@ -351,8 +351,8 @@ int ossl_quic_fault_resize_plain_packet(OSSL_QUIC_FAULT *fault, size_t newlen)
* Prepend frame data into a packet. To be called from a packet_plain_listener
* callback
*/
-int ossl_quic_fault_prepend_frame(OSSL_QUIC_FAULT *fault, unsigned char *frame,
- size_t frame_len)
+int qtest_fault_prepend_frame(QTEST_FAULT *fault, unsigned char *frame,
+ size_t frame_len)
{
unsigned char *buf;
size_t old_len;
@@ -369,8 +369,8 @@ int ossl_quic_fault_prepend_frame(OSSL_QUIC_FAULT *fault, unsigned char *frame,
old_len = fault->pplainio.buf_len;
/* Extend the size of the packet by the size of the new frame */
- if (!TEST_true(ossl_quic_fault_resize_plain_packet(fault,
- old_len + frame_len)))
+ if (!TEST_true(qtest_fault_resize_plain_packet(fault,
+ old_len + frame_len)))
return 0;
memmove(buf + frame_len, buf, old_len);
@@ -383,7 +383,7 @@ static int handshake_mutate(const unsigned char *msgin, size_t msginlen,
unsigned char **msgout, size_t *msgoutlen,
void *arg)
{
- OSSL_QUIC_FAULT *fault = arg;
+ QTEST_FAULT *fault = arg;
unsigned char *buf;
unsigned long payloadlen;
unsigned int msgtype;
@@ -408,7 +408,7 @@ static int handshake_mutate(const unsigned char *msgin, size_t msginlen,
switch (msgtype) {
case SSL3_MT_ENCRYPTED_EXTENSIONS:
{
- OSSL_QF_ENCRYPTED_EXTENSIONS ee;
+ QTEST_ENCRYPTED_EXTENSIONS ee;
if (fault->encextcb == NULL)
break;
@@ -441,15 +441,15 @@ static int handshake_mutate(const unsigned char *msgin, size_t msginlen,
static void handshake_finish(void *arg)
{
- OSSL_QUIC_FAULT *fault = arg;
+ QTEST_FAULT *fault = arg;
OPENSSL_free(fault->handbuf);
fault->handbuf = NULL;
}
-int ossl_quic_fault_set_handshake_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_handshake_cb handshakecb,
- void *handshakecbarg)
+int qtest_fault_set_handshake_listener(QTEST_FAULT *fault,
+ qtest_fault_on_handshake_cb handshakecb,
+ void *handshakecbarg)
{
fault->handshakecb = handshakecb;
fault->handshakecbarg = handshakecbarg;
@@ -460,9 +460,9 @@ int ossl_quic_fault_set_handshake_listener(OSSL_QUIC_FAULT *fault,
fault);
}
-int ossl_quic_fault_set_hand_enc_ext_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_enc_ext_cb encextcb,
- void *encextcbarg)
+int qtest_fault_set_hand_enc_ext_listener(QTEST_FAULT *fault,
+ qtest_fault_on_enc_ext_cb encextcb,
+ void *encextcbarg)
{
fault->encextcb = encextcb;
fault->encextcbarg = encextcbarg;
@@ -474,7 +474,7 @@ int ossl_quic_fault_set_hand_enc_ext_listener(OSSL_QUIC_FAULT *fault,
}
/* To be called from a handshake_listener callback */
-int ossl_quic_fault_resize_handshake(OSSL_QUIC_FAULT *fault, size_t newlen)
+int qtest_fault_resize_handshake(QTEST_FAULT *fault, size_t newlen)
{
unsigned char *buf;
size_t oldlen = fault->handbuflen;
@@ -503,10 +503,10 @@ int ossl_quic_fault_resize_handshake(OSSL_QUIC_FAULT *fault, size_t newlen)
}
/* To be called from message specific listener callbacks */
-int ossl_quic_fault_resize_message(OSSL_QUIC_FAULT *fault, size_t newlen)
+int qtest_fault_resize_message(QTEST_FAULT *fault, size_t newlen)
{
/* First resize the underlying message */
- if (!ossl_quic_fault_resize_handshake(fault, newlen + SSL3_HM_HEADER_LENGTH))
+ if (!qtest_fault_resize_handshake(fault, newlen + SSL3_HM_HEADER_LENGTH))
return 0;
/* Fixup the handshake message header */
@@ -517,9 +517,9 @@ int ossl_quic_fault_resize_message(OSSL_QUIC_FAULT *fault, size_t newlen)
return 1;
}
-int ossl_quic_fault_delete_extension(OSSL_QUIC_FAULT *fault,
- unsigned int exttype, unsigned char *ext,
- size_t *extlen)
+int qtest_fault_delete_extension(QTEST_FAULT *fault,
+ unsigned int exttype, unsigned char *ext,
+ size_t *extlen)
{
PACKET pkt, sub, subext;
unsigned int type;
@@ -574,7 +574,7 @@ int ossl_quic_fault_delete_extension(OSSL_QUIC_FAULT *fault,
if ((size_t)(end - start) + SSL3_HM_HEADER_LENGTH > msglen)
return 0; /* Should not happen */
msglen -= (end - start) + SSL3_HM_HEADER_LENGTH;
- if (!ossl_quic_fault_resize_message(fault, msglen))
+ if (!qtest_fault_resize_message(fault, msglen))
return 0;
return 1;
@@ -590,7 +590,7 @@ static int pcipher_sendmmsg(BIO *b, BIO_MSG *msg, size_t stride,
size_t num_msg, uint64_t flags,
size_t *num_processed)
{
- OSSL_QUIC_FAULT *fault;
+ QTEST_FAULT *fault;
BIO *next = BIO_next(b);
ossl_ssize_t ret = 0;
size_t i = 0, tmpnump;
@@ -666,12 +666,8 @@ static int pcipher_sendmmsg(BIO *b, BIO_MSG *msg, size_t stride,
}
*num_processed = i;
- ret = 1;
out:
- if (i > 0)
- ret = 1;
- else
- ret = 0;
+ ret = i > 0;
OPENSSL_free(fault->msg.data);
fault->msg.data = NULL;
return ret;
@@ -710,9 +706,9 @@ static BIO_METHOD *get_bio_method(void)
return pcipherbiometh;
}
-int ossl_quic_fault_set_packet_cipher_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_packet_cipher_cb pciphercb,
- void *pciphercbarg)
+int qtest_fault_set_packet_cipher_listener(QTEST_FAULT *fault,
+ qtest_fault_on_packet_cipher_cb pciphercb,
+ void *pciphercbarg)
{
fault->pciphercb = pciphercb;
fault->pciphercbarg = pciphercbarg;
@@ -720,9 +716,9 @@ int ossl_quic_fault_set_packet_cipher_listener(OSSL_QUIC_FAULT *fault,
return 1;
}
-int ossl_quic_fault_set_datagram_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_datagram_cb datagramcb,
- void *datagramcbarg)
+int qtest_fault_set_datagram_listener(QTEST_FAULT *fault,
+ qtest_fault_on_datagram_cb datagramcb,
+ void *datagramcbarg)
{
fault->datagramcb = datagramcb;
fault->datagramcbarg = datagramcbarg;
@@ -731,7 +727,7 @@ int ossl_quic_fault_set_datagram_listener(OSSL_QUIC_FAULT *fault,
}
/* To be called from a datagram_listener callback */
-int ossl_quic_fault_resize_datagram(OSSL_QUIC_FAULT *fault, size_t newlen)
+int qtest_fault_resize_datagram(QTEST_FAULT *fault, size_t newlen)
{
if (newlen > fault->msgalloc)
return 0;
diff --git a/test/helpers/quictestlib.h b/test/helpers/quictestlib.h
index 165b3af79d..165551aa6a 100644
--- a/test/helpers/quictestlib.h
+++ b/test/helpers/quictestlib.h
@@ -11,18 +11,18 @@
#include <internal/quic_tserver.h>
/* Type to represent the Fault Injector */
-typedef struct ossl_quic_fault OSSL_QUIC_FAULT;
+typedef struct qtest_fault QTEST_FAULT;
/*
* Structure representing a parsed EncryptedExtension message. Listeners can
* make changes to the contents of structure objects as required and the fault
* injector will reconstruct the message to be sent on
*/
-typedef struct ossl_qf_encrypted_extensions {
+typedef struct qtest_fault_encrypted_extensions {
/* EncryptedExtension messages just have an extensions block */
unsigned char *extensions;
size_t extensionslen;
-} OSSL_QF_ENCRYPTED_EXTENSIONS;
+} QTEST_ENCRYPTED_EXTENSIONS;
/*
* Given an SSL_CTX for the client and filenames for the server certificate and
@@ -31,12 +31,12 @@ typedef struct ossl_qf_encrypted_extensions {
*/
int qtest_create_quic_objects(SSL_CTX *clientctx, char *certfile, char *keyfile,
QUIC_TSERVER **qtserv, SSL **cssl,
- OSSL_QUIC_FAULT **fault);
+ QTEST_FAULT **fault);
/*
* Free up a Fault Injector instance
*/
-void ossl_quic_fault_free(OSSL_QUIC_FAULT *fault);
+void qtest_fault_free(QTEST_FAULT *fault);
/*
* Run the TLS handshake to create a QUIC connection between the client and
@@ -58,15 +58,15 @@ int qtest_check_server_protocol_err(QUIC_TSERVER *qtserv);
/*
* Enable tests to listen for pre-encryption QUIC packets being sent
*/
-typedef int (*ossl_quic_fault_on_packet_plain_cb)(OSSL_QUIC_FAULT *fault,
- QUIC_PKT_HDR *hdr,
- unsigned char *buf,
- size_t len,
- void *cbarg);
+typedef int (*qtest_fault_on_packet_plain_cb)(QTEST_FAULT *fault,
+ QUIC_PKT_HDR *hdr,
+ unsigned char *buf,
+ size_t len,
+ void *cbarg);
-int ossl_quic_fault_set_packet_plain_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_packet_plain_cb pplaincb,
- void *pplaincbarg);
+int qtest_fault_set_packet_plain_listener(QTEST_FAULT *fault,
+ qtest_fault_on_packet_plain_cb pplaincb,
+ void *pplaincbarg);
/*
@@ -77,28 +77,28 @@ int ossl_quic_fault_set_packet_plain_listener(OSSL_QUIC_FAULT *fault,
* This will fail if a large resize is attempted that exceeds the over
* allocation.
*/
-int ossl_quic_fault_resize_plain_packet(OSSL_QUIC_FAULT *fault, size_t newlen);
+int qtest_fault_resize_plain_packet(QTEST_FAULT *fault, size_t newlen);
/*
* Prepend frame data into a packet. To be called from a packet_plain_listener
* callback
*/
-int ossl_quic_fault_prepend_frame(OSSL_QUIC_FAULT *fault, unsigned char *frame,
- size_t frame_len);
+int qtest_fault_prepend_frame(QTEST_FAULT *fault, unsigned char *frame,
+ size_t frame_len);
/*
* The general handshake message listener is sent the entire handshake message
* data block, including the handshake header itself
*/
-typedef int (*ossl_quic_fault_on_handshake_cb)(OSSL_QUIC_FAULT *fault,
- unsigned char *msg,
- size_t msglen,
- void *handshakecbarg);
-
-int ossl_quic_fault_set_handshake_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_handshake_cb handshakecb,
+typedef int (*qtest_fault_on_handshake_cb)(QTEST_FAULT *fault,
+ unsigned char *msg,
+ size_t msglen,
void *handshakecbarg);
+int qtest_fault_set_handshake_listener(QTEST_FAULT *fault,
+ qtest_fault_on_handshake_cb handshakecb,
+ void *handshakecbarg);
+
/*
* Helper function to be called from a handshake_listener callback if it wants
* to resize the handshake message (either to add new data to it, or to truncate
@@ -108,7 +108,7 @@ int ossl_quic_fault_set_handshake_listener(OSSL_QUIC_FAULT *fault,
* This will fail if a large resize is attempted that exceeds the over
* allocation.
*/
-int ossl_quic_fault_resize_handshake(OSSL_QUIC_FAULT *fault, size_t newlen);
+int qtest_fault_resize_handshake(QTEST_FAULT *fault, size_t newlen);
/*
* TODO(QUIC): Add listeners for specifc types of frame here. E.g. we might
@@ -121,14 +121,14 @@ int ossl_quic_fault_resize_handshake(OSSL_QUIC_FAULT *fault, size_t newlen);
* listener these messages are pre-parsed and supplied with message specific
* data and exclude the handshake header
*/
-typedef int (*ossl_quic_fault_on_enc_ext_cb)(OSSL_QUIC_FAULT *fault,
- OSSL_QF_ENCRYPTED_EXTENSIONS *ee,
- size_t eelen,
- void *encextcbarg);
+typedef int (*qtest_fault_on_enc_ext_cb)(QTEST_FAULT *fault,
+ QTEST_ENCRYPTED_EXTENSIONS *ee,
+ size_t eelen,
+ void *encextcbarg);
-int ossl_quic_fault_set_hand_enc_ext_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_enc_ext_cb encextcb,
- void *encextcbarg);
+int qtest_fault_set_hand_enc_ext_listener(QTEST_FAULT *fault,
+ qtest_fault_on_enc_ext_cb encextcb,
+ void *encextcbarg);
/* TODO(QUIC): Add listeners for other types of handshake message here */
@@ -141,7 +141,7 @@ int ossl_quic_fault_set_hand_enc_ext_listener(OSSL_QUIC_FAULT *fault,
* address of the buffer. This will fail if a large resize is attempted that
* exceeds the over allocation.
*/
-int ossl_quic_fault_resize_message(OSSL_QUIC_FAULT *fault, size_t newlen);
+int qtest_fault_resize_message(QTEST_FAULT *fault, size_t newlen);
/*
* Helper function to delete an extension from an extension block. |exttype| is
@@ -149,9 +149,9 @@ int ossl_quic_fault_resize_message(OSSL_QUIC_FAULT *fault, size_t newlen);
* On entry |*extlen| contains the length of the extension block. It is updated
* with the new length on exit.
*/
-int ossl_quic_fault_delete_extension(OSSL_QUIC_FAULT *fault,
- unsigned int exttype, unsigned char *ext,
- size_t *extlen);
+int qtest_fault_delete_extension(QTEST_FAULT *fault,
+ unsigned int exttype, unsigned char *ext,
+ size_t *extlen);
/*
* TODO(QUIC): Add additional helper functions for querying extensions here (e.g.
@@ -162,30 +162,30 @@ int ossl_quic_fault_delete_extension(OSSL_QUIC_FAULT *fault,
/*
* Enable tests to listen for post-encryption QUIC packets being sent
*/
-typedef int (*ossl_quic_fault_on_packet_cipher_cb)(OSSL_QUIC_FAULT *fault,
- /* The parsed packet header */
- QUIC_PKT_HDR *hdr,
- /* The packet payload data */
- unsigned char *buf,
- /* Length of the payload */
- size_t len,
- void *cbarg);
+typedef int (*qtest_fault_on_packet_cipher_cb)(QTEST_FAULT *fault,
+ /* The parsed packet header */
+ QUIC_PKT_HDR *hdr,
+ /* The packet payload data */
+ unsigned char *buf,
+ /* Length of the payload */
+ size_t len,
+ void *cbarg);
-int ossl_quic_fault_set_packet_cipher_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_packet_cipher_cb pciphercb,
- void *picphercbarg);
+int qtest_fault_set_packet_cipher_listener(QTEST_FAULT *fault,
+ qtest_fault_on_packet_cipher_cb pciphercb,
+ void *picphercbarg);
/*
* Enable tests to listen for datagrams being sent
*/
-typedef int (*ossl_quic_fault_on_datagram_cb)(OSSL_QUIC_FAULT *fault,
- BIO_MSG *m,
- size_t stride,
- void *cbarg);
+typedef int (*qtest_fault_on_datagram_cb)(QTEST_FAULT *fault,
+ BIO_MSG *m,
+ size_t stride,
+ void *cbarg);
-int ossl_quic_fault_set_datagram_listener(OSSL_QUIC_FAULT *fault,
- ossl_quic_fault_on_datagram_cb datagramcb,
- void *datagramcbarg);
+int qtest_fault_set_datagram_listener(QTEST_FAULT *fault,
+ qtest_fault_on_datagram_cb datagramcb,
+ void *datagramcbarg);
/*
* To be called from a datagram_listener callback. The datagram buffer is over
@@ -193,4 +193,4 @@ int ossl_quic_fault_set_datagram_listener(OSSL_QUIC_FAULT *fault,
* address of the buffer. This will fail if a large resize is attempted that
* exceeds the over allocation.
*/
-int ossl_quic_fault_resize_datagram(OSSL_QUIC_FAULT *fault, size_t newlen);
+int qtest_fault_resize_datagram(QTEST_FAULT *fault, size_t newlen);
diff --git a/test/quicfaultstest.c b/test/quicfaultstest.c
index 1bfc921256..23ccc1e122 100644
--- a/test/quicfaultstest.c
+++ b/test/quicfaultstest.c
@@ -67,7 +67,7 @@ static int test_basic(void)
/*
* Test that adding an unknown frame type is handled correctly
*/
-static int add_unknown_frame_cb(OSSL_QUIC_FAULT *fault, QUIC_PKT_HDR *hdr,
+static int add_unknown_frame_cb(QTEST_FAULT *fault, QUIC_PKT_HDR *hdr,
unsigned char *buf, size_t len, void *cbarg)
{
static size_t done = 0;
@@ -84,8 +84,8 @@ static int add_unknown_frame_cb(OSSL_QUIC_FAULT *fault, QUIC_PKT_HDR *hdr,
if (done++)
return 1;
- return ossl_quic_fault_prepend_frame(fault, unknown_frame,
- sizeof(unknown_frame));
+ return qtest_fault_prepend_frame(fault, unknown_frame,
+ sizeof(unknown_frame));
}
static int test_unknown_frame(void)
@@ -98,7 +98,7 @@ static int test_unknown_frame(void)
size_t msglen = strlen(msg);
unsigned char buf[80];
size_t byteswritten;
- OSSL_QUIC_FAULT *fault = NULL;
+ QTEST_FAULT *fault = NULL;
if (!TEST_ptr(cctx))
goto err;
@@ -114,9 +114,9 @@ static int test_unknown_frame(void)
* Write a message from the server to the client and add an unknown frame
* type
*/
- if (!TEST_true(ossl_quic_fault_set_packet_plain_listener(fault,
- add_unknown_frame_cb,
- NULL)))
+ if (!TEST_true(qtest_fault_set_packet_plain_listener(fault,
+ add_unknown_frame_cb,
+ NULL)))
goto err;
if (!TEST_true(ossl_quic_tserver_write(qtserv, (unsigned char *)msg, msglen,
@@ -155,7 +155,7 @@ static int test_unknown_frame(void)
testresult = 1;
err:
- ossl_quic_fault_free(fault);
+ qtest_fault_free(fault);
SSL_free(cssl);
ossl_quic_tserver_free(qtserv);
SSL_CTX_free(cctx);
@@ -166,13 +166,13 @@ static int test_unknown_frame(void)
* Test that a server that fails to provide transport params cannot be
* connected to.
*/
-static int drop_transport_params_cb(OSSL_QUIC_FAULT *fault,
- OSSL_QF_ENCRYPTED_EXTENSIONS *ee,
+static int drop_transport_params_cb(QTEST_FAULT *fault,
+ QTEST_ENCRYPTED_EXTENSIONS *ee,
size_t eelen, void *encextcbarg)
{
- if (!ossl_quic_fault_delete_extension(fault,
- TLSEXT_TYPE_quic_transport_parameters,
- ee->extensions, &ee->extensionslen))
+ if (!qtest_fault_delete_extension(fault,
+ TLSEXT_TYPE_quic_transport_parameters,
+ ee->extensions, &ee->extensionslen))
return 0;
return 1;
@@ -184,7 +184,7 @@ static int test_no_transport_params(void)
SSL_CTX *cctx = SSL_CTX_new(OSSL_QUIC_client_method());
QUIC_TSERVER *qtserv = NULL;
SSL *cssl = NULL;
- OSSL_QUIC_FAULT *fault = NULL;
+ QTEST_FAULT *fault = NULL;
if (!TEST_ptr(cctx))
goto err;
@@ -193,9 +193,9 @@ static int test_no_transport_params(void)
&cssl, &fault)))
goto err;
- if (!TEST_true(ossl_quic_fault_set_hand_enc_ext_listener(fault,
- drop_transport_params_cb,
- NULL)))
+ if (!TEST_true(qtest_fault_set_hand_enc_ext_listener(fault,
+ drop_transport_params_cb,
+ NULL)))
goto err;
/*
@@ -210,7 +210,7 @@ static int test_no_transport_params(void)
testresult = 1;
err:
- ossl_quic_fault_free(fault);
+ qtest_fault_free(fault);
SSL_free(cssl);
ossl_quic_tserver_free(qtserv);
SSL_CTX_free(cctx);
@@ -222,7 +222,7 @@ static int test_no_transport_params(void)
*/
static int docorrupt = 0;
-static int on_packet_cipher_cb(OSSL_QUIC_FAULT *fault, QUIC_PKT_HDR *hdr,
+static int on_packet_cipher_cb(QTEST_FAULT *fault, QUIC_PKT_HDR *hdr,
unsigned char *buf, size_t len, void *cbarg)
{