summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-08-17 16:23:36 +0200
committerTomas Mraz <tomas@openssl.org>2023-08-22 12:31:46 +0200
commit617cab094f0f0d4e71f8b9da5663be8ab06cba92 (patch)
treeea26e6aadbab61404dbe8385f215339d5e8fdc2b
parent608a95f4969202083eccd4c1c7e91dec021ea79b (diff)
qtest: Use fake time on both client and server
And use QTEST_FLAG_FAKE_TIME with test_ssl_trace(). Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21713)
-rw-r--r--test/helpers/quictestlib.c4
-rw-r--r--test/quicapitest.c4
2 files changed, 7 insertions, 1 deletions
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;