From 617cab094f0f0d4e71f8b9da5663be8ab06cba92 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 17 Aug 2023 16:23:36 +0200 Subject: qtest: Use fake time on both client and server And use QTEST_FLAG_FAKE_TIME with test_ssl_trace(). Reviewed-by: Matt Caswell Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21713) --- test/helpers/quictestlib.c | 4 ++++ test/quicapitest.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/helpers/quictestlib.c b/test/helpers/quictestlib.c index be98e205ff..1b204658bf 100644 --- a/test/helpers/quictestlib.c +++ b/test/helpers/quictestlib.c @@ -16,6 +16,7 @@ #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) # include "../threadstest.h" #endif +#include "internal/quic_ssl.h" #include "internal/quic_wire_pkt.h" #include "internal/quic_record_tx.h" #include "internal/quic_error.h" @@ -172,7 +173,10 @@ int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx, tserver_args.ctx = serverctx; if ((flags & QTEST_FLAG_FAKE_TIME) != 0) { fake_now = ossl_time_zero(); + /* zero time can have a special meaning, bump it */ + qtest_add_time(1); tserver_args.now_cb = fake_now_cb; + (void)ossl_quic_conn_set_override_now_cb(*cssl, fake_now_cb, NULL); } if (!TEST_ptr(*qtserv = ossl_quic_tserver_new(&tserver_args, certfile, diff --git a/test/quicapitest.c b/test/quicapitest.c index d17d704d29..91e63429a5 100644 --- a/test/quicapitest.c +++ b/test/quicapitest.c @@ -456,7 +456,9 @@ static int test_ssl_trace(void) if (!TEST_ptr(cctx) || !TEST_ptr(bio) || !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert, - privkey, 0, &qtserv, + privkey, + QTEST_FLAG_FAKE_TIME, + &qtserv, &clientquic, NULL))) goto err; -- cgit v1.2.3