quiche
quiche copied to clipboard
C example client: SSL key log file is not working
The example C client implementation proposes to enable TLS key logging via an environmental variable SSLKEYLOGFILE
.
However, it does not seem to work. Checked both on MacOS, Ubuntu and Windows.
Looks like just calling quiche_config_log_keys(config)
is not enough, as there should be some keylog
file created by the app as well. Not sure how to pass it to quiche though.
In the RUST client it is done the following way:
if let Some(keylog) = &mut keylog {
if let Ok(keylog) = keylog.try_clone() {
conn.set_keylog(Box::new(keylog));
}
}
Proposed Fix
Seems to work when quiche_conn_set_keylog_path(..)
is used additionaly.
quiche_conn *conn = quiche_connect(host, (const uint8_t *) scid, sizeof(scid),
(struct sockaddr *) &conn_io->local_addr,
conn_io->local_addr_len,
peer->ai_addr, peer->ai_addrlen, config);
if (conn == NULL) {
fprintf(stderr, "failed to create connection\n");
return -1;
}
if (getenv("SSLKEYLOGFILE")) {
if (!quiche_conn_set_keylog_path(conn, getenv("SSLKEYLOGFILE")))
fprintf(stderr, "Failed to configure the TLS key log file.\n");
else {
fprintf(stderr, "TLS key logging enabled!\n");
quiche_config_log_keys(config);
}
}
ssl->ctx->keylog_callback
is NULL
, although config.log_keys()
was called. A different context? 🤔
bool ssl_log_secret(const SSL *ssl, const char *label,
Span<const uint8_t> secret) {
if (ssl->ctx->keylog_callback == NULL) {
return true;
}