Skip to content

Commit

Permalink
qtest: Use fake time on both client and server
Browse files Browse the repository at this point in the history
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 openssl#21713)
  • Loading branch information
t8m committed Aug 22, 2023
1 parent 608a95f commit 617cab0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/helpers/quictestlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion test/quicapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 617cab0

Please sign in to comment.