From e26dc8e3d54a414ba9dc85f54e13112617e32556 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Tue, 6 Jun 2023 16:25:12 +0100 Subject: QUIC Conformance: Frame Handling Tests Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21135) --- test/helpers/quictestlib.c | 21 ++++++++++++++++----- test/helpers/quictestlib.h | 6 +++++- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'test/helpers') 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); /* -- cgit v1.2.3