int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
SSL_CTX *serverctx, char *certfile, char *keyfile,
int block, QUIC_TSERVER **qtserv, SSL **cssl,
- OSSL_QUIC_FAULT **fault);
+ OSSL_QUIC_FAULT **fault, BIO **tracebio);
/*
* Free up a Fault Injector instance
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, &fault)))
+ &qtserv, &cssl, &fault, NULL)))
goto err;
if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, &fault)))
+ &qtserv, &cssl, &fault, NULL)))
goto err;
if (!TEST_true(ossl_quic_fault_set_hand_enc_ext_listener(fault,
int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
SSL_CTX *serverctx, char *certfile, char *keyfile,
int flags, QUIC_TSERVER **qtserv, SSL **cssl,
- QTEST_FAULT **fault)
+ QTEST_FAULT **fault, BIO **tracebio)
{
/* ALPN value as recognised by QUIC_TSERVER */
unsigned char alpn[] = { 8, 'o', 's', 's', 'l', 't', 'e', 's', 't' };
BIO *cbio = NULL, *sbio = NULL, *fisbio = NULL;
BIO_ADDR *peeraddr = NULL;
struct in_addr ina = {0};
+ BIO *tmpbio = NULL;
*qtserv = NULL;
if (fault != NULL)
return 0;
}
+ if ((flags & QTEST_FLAG_CLIENT_TRACE) != 0) {
+ tmpbio = BIO_new_fp(stdout, BIO_NOCLOSE);
+ if (!TEST_ptr(tmpbio))
+ goto err;
+
+ SSL_set_msg_callback(*cssl, SSL_trace);
+ SSL_set_msg_callback_arg(*cssl, tmpbio);
+ }
+ if (tracebio != NULL)
+ *tracebio = tmpbio;
+
/* SSL_set_alpn_protos returns 0 for success! */
if (!TEST_false(SSL_set_alpn_protos(*cssl, alpn, sizeof(alpn))))
goto err;
ossl_quic_tserver_free(*qtserv);
if (fault != NULL)
OPENSSL_free(*fault);
+ BIO_free(tmpbio);
+ if (tracebio != NULL)
+ *tracebio = NULL;
return 0;
}
#define QTEST_FLAG_NOISE (1 << 2)
/* Split datagrams such that each datagram contains one packet */
#define QTEST_FLAG_PACKET_SPLIT (1 << 3)
-
+/* Turn on client side tracing */
+#define QTEST_FLAG_CLIENT_TRACE (1 << 4)
/*
* Given an SSL_CTX for the client and filenames for the server certificate and
* keyfile, create a server and client instances as well as a fault injector
int qtest_create_quic_objects(OSSL_LIB_CTX *libctx, SSL_CTX *clientctx,
SSL_CTX *serverctx, char *certfile, char *keyfile,
int flags, QUIC_TSERVER **qtserv, SSL **cssl,
- QTEST_FAULT **fault);
+ QTEST_FAULT **fault, BIO **tracebio);
/* Where QTEST_FLAG_FAKE_TIME is used, add millis to the current time */
void qtest_add_time(uint64_t millis);
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, &fault)))
+ &qtserv, &cssl, &fault, NULL)))
goto err;
if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
? QTEST_FLAG_BLOCK
: 0,
&qtserv, &clientquic,
- NULL))
+ NULL, NULL))
|| !TEST_true(SSL_set_tlsext_host_name(clientquic, "localhost")))
goto end;
cert, privkey,
QTEST_FLAG_BLOCK,
&qtserv, &clientquic,
- NULL))
+ NULL, NULL))
|| !TEST_true(SSL_set_tlsext_host_name(clientquic, "localhost")))
goto end;
if (!TEST_ptr(cctx)
|| !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert,
privkey, 0, &qtserv,
- &clientquic, NULL))
+ &clientquic, NULL, NULL))
|| !TEST_true(qtest_create_quic_connection(qtserv, clientquic)))
goto err;
privkey,
QTEST_FLAG_FAKE_TIME,
&qtserv,
- &clientquic, NULL)))
+ &clientquic, NULL, NULL)))
goto err;
SSL_set_msg_callback(clientquic, SSL_trace);
goto err;
if (!TEST_true(qtest_create_quic_objects(libctx, NULL, NULL, cert, privkey,
- 0, &qtserv, &clientquic, NULL)))
+ 0, &qtserv, &clientquic, NULL,
+ NULL)))
goto err;
msglen = strlen(msg);
if (!TEST_ptr(cctx)
|| !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert,
privkey, 0, &qtserv,
- &clientquic, NULL))
+ &clientquic, NULL, NULL))
|| !TEST_true(qtest_create_quic_connection(qtserv, clientquic)))
goto err;
|| !TEST_ptr(buf)
|| !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert,
privkey, 0, &qtserv,
- &clientquic, NULL))
+ &clientquic, NULL, NULL))
|| !TEST_true(qtest_create_quic_connection(qtserv, clientquic)))
goto err;
flags = (idx >= 1) ? QTEST_FLAG_BLOCK : 0;
if (!TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert, privkey,
- flags, &qtserv, &clientquic, NULL))
+ flags, &qtserv, &clientquic, NULL,
+ NULL))
|| !TEST_true(qtest_create_quic_connection_ex(qtserv, clientquic,
SSL_ERROR_WANT_RETRY_VERIFY))
|| !TEST_int_eq(SSL_want(clientquic), SSL_RETRY_VERIFY)
/* No cert or private key for the server, i.e. PSK only */
|| !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, NULL,
NULL, 0, &qtserv,
- &clientquic, NULL)))
+ &clientquic, NULL, NULL)))
goto end;
SSL_set_psk_use_session_callback(clientquic, use_session_cb);
privkey,
QTEST_FLAG_FAKE_TIME,
&qtserv,
- &clientquic, NULL)))
+ &clientquic, NULL, NULL)))
goto err;
if (idx == 0) {
|| !TEST_true(qtest_create_quic_objects(libctx, cctx, NULL, cert,
privkey, flags,
&qtserv,
- &clientquic, NULL)))
+ &clientquic, NULL, NULL)))
goto err;
if (!TEST_true(qtest_create_quic_connection(qtserv, clientquic)))
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, NULL)))
+ &qtserv, &cssl, NULL, NULL)))
goto err;
if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, &fault)))
+ &qtserv, &cssl, &fault, NULL)))
goto err;
if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
goto err;
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey, 0,
- &qtserv, &cssl, &fault)))
+ &qtserv, &cssl, &fault, NULL)))
goto err;
if (idx == 0) {
if (!TEST_true(qtest_create_quic_objects(NULL, cctx, NULL, cert, privkey,
QTEST_FLAG_FAKE_TIME, &qtserv,
- &cssl, &fault)))
+ &cssl, &fault, NULL)))
goto err;
if (idx == 0) {