summaryrefslogtreecommitdiffstats
path: root/test/helpers
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-06-06 17:25:12 +0200
committerPauli <pauli@openssl.org>2023-07-17 00:17:57 +0200
commite26dc8e3d54a414ba9dc85f54e13112617e32556 (patch)
tree49b3ec5dad53c98231bd7265ef528ab530f7b026 /test/helpers
parentQUIC CONFORMANCE: RFC 9000 s. 9.6 (diff)
downloadopenssl-e26dc8e3d54a414ba9dc85f54e13112617e32556.tar.xz
openssl-e26dc8e3d54a414ba9dc85f54e13112617e32556.zip
QUIC Conformance: Frame Handling Tests
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 'test/helpers')
-rw-r--r--test/helpers/quictestlib.c21
-rw-r--r--test/helpers/quictestlib.h6
2 files changed, 21 insertions, 6 deletions
diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c
index fcff11727a..0d99d4556c 100644
--- a/test/helpers/quictestlib.c
+++ b/test/helpers/quictestlib.c
@@ -64,8 +64,6 @@ struct qtest_fault {
static void packet_plain_finish(void *arg);
static void handshake_finish(void *arg);
-static BIO_METHOD *get_bio_method(void);
-
static OSSL_TIME fake_now;
static OSSL_TIME fake_now_cb(void *arg)
@@ -155,7 +153,7 @@ int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
goto err;
}
- fisbio = BIO_new(get_bio_method());
+ fisbio = BIO_new(qtest_get_bio_method());
if (!TEST_ptr(fisbio))
goto err;
@@ -206,6 +204,19 @@ void qtest_add_time(uint64_t millis)
fake_now = ossl_time_add(fake_now, ossl_ms2time(millis));
}
+QTEST_FAULT *qtest_create_injector(QUIC_TSERVER *ts)
+{
+ QTEST_FAULT *f;
+
+ f = OPENSSL_zalloc(sizeof(*f));
+ if (f == NULL)
+ return NULL;
+
+ f->qtserv = ts;
+ return f;
+
+}
+
int qtest_supports_blocking(void)
{
#if !defined(OPENSSL_NO_POSIX_IO) && defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
@@ -487,7 +498,7 @@ 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 qtest_fault_prepend_frame(QTEST_FAULT *fault, unsigned char *frame,
+int qtest_fault_prepend_frame(QTEST_FAULT *fault, const unsigned char *frame,
size_t frame_len)
{
unsigned char *buf;
@@ -819,7 +830,7 @@ static long pcipher_ctrl(BIO *b, int cmd, long larg, void *parg)
return BIO_ctrl(next, cmd, larg, parg);
}
-static BIO_METHOD *get_bio_method(void)
+BIO_METHOD *qtest_get_bio_method(void)
{
BIO_METHOD *tmp;
diff --git a/test/helpers/quictestlib.h b/test/helpers/quictestlib.h
index 8b24ab6009..ee047bde0b 100644
--- a/test/helpers/quictestlib.h
+++ b/test/helpers/quictestlib.h
@@ -44,6 +44,10 @@ int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
/* Where QTEST_FLAG_FAKE_TIME is used, add millis to the current time */
void qtest_add_time(uint64_t millis);
+QTEST_FAULT *qtest_create_injector(QUIC_TSERVER *ts);
+
+BIO_METHOD *qtest_get_bio_method(void);
+
/*
* Free up a Fault Injector instance
*/
@@ -108,7 +112,7 @@ 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 qtest_fault_prepend_frame(QTEST_FAULT *fault, unsigned char *frame,
+int qtest_fault_prepend_frame(QTEST_FAULT *fault, const unsigned char *frame,
size_t frame_len);
/*