summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:55 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:47:12 +0100
commit9caf981237c3e655c18ebef7193153238f2855db (patch)
tree4502fda47e81ca0f16691d393bde089ce3feb743
parent5d27e7e9ae7135f8ba92498e3c4e7f9b77f2f8e3 (diff)
downloadopenssl-new-9caf981237c3e655c18ebef7193153238f2855db.tar.gz
QUIC: Update faults test to use streams correctly
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
-rw-r--r--test/quicfaultstest.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/quicfaultstest.c b/test/quicfaultstest.c
index fbbbad4dd6..1a0f41af80 100644
--- a/test/quicfaultstest.c
+++ b/test/quicfaultstest.c
@@ -99,6 +99,7 @@ static int test_unknown_frame(void)
unsigned char buf[80];
size_t byteswritten;
QTEST_FAULT *fault = NULL;
+ uint64_t sid = UINT64_MAX;
if (!TEST_ptr(cctx))
goto err;
@@ -119,7 +120,11 @@ static int test_unknown_frame(void)
NULL)))
goto err;
- if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg, msglen,
+ if (!TEST_true(ossl_quic_tserver_stream_new(qtserv, /*is_uni=*/0, &sid))
+ || !TEST_uint64_t_eq(sid, 1))
+ goto err;
+
+ if (!TEST_true(ossl_quic_tserver_write(qtserv, sid, (unsigned char *)msg, msglen,
&byteswritten)))
goto err;
@@ -263,6 +268,7 @@ static int test_corrupted_data(int idx)
size_t msglen = strlen(msg);
unsigned char buf[80];
size_t bytesread, byteswritten;
+ uint64_t sid = UINT64_MAX;
if (!TEST_ptr(cctx))
goto err;
@@ -290,11 +296,15 @@ static int test_corrupted_data(int idx)
/* Corrupt the next server packet*/
docorrupt = 1;
+ if (!TEST_true(ossl_quic_tserver_stream_new(qtserv, /*is_uni=*/0, &sid))
+ || !TEST_uint64_t_eq(sid, 1))
+ goto err;
+
/*
* Send first 5 bytes of message. This will get corrupted and is treated as
* "lost"
*/
- if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg, 5,
+ if (!TEST_true(ossl_quic_tserver_write(qtserv, sid, (unsigned char *)msg, 5,
&byteswritten)))
goto err;
@@ -317,7 +327,7 @@ static int test_corrupted_data(int idx)
OSSL_sleep(100);
/* Send rest of message */
- if (!TEST_true(ossl_quic_tserver_write(qtserv, 0, (unsigned char *)msg + 5,
+ if (!TEST_true(ossl_quic_tserver_write(qtserv, sid, (unsigned char *)msg + 5,
msglen - 5, &byteswritten)))
goto err;