]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
qtest: Use fake time on both client and server
authorTomas Mraz <tomas@openssl.org>
Thu, 17 Aug 2023 14:23:36 +0000 (16:23 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 22 Aug 2023 10:31:46 +0000 (12:31 +0200)
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)

test/helpers/quictestlib.c
test/quicapitest.c

index be98e205ffc1d31ef74f6f2dd248957da6f11857..1b204658bfbf54fc1eec7d5cf4e6c6a7b638f492 100644 (file)
@@ -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,
index d17d704d29a82a07178d67af6ea743191dcf5694..91e63429a5290bfeb60a6acb8efae88a03cc1d9d 100644 (file)
@@ -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;