CLEANUP: quic: remove unused qc param on stateless reset token
Remove quic_conn instance as first parameter of
quic_stateless_reset_token_init() and quic_stateless_reset_token_cpy()
functions. It was only used for trace purpose.
The main advantage is that it will be possible to allocate a QUIC CID
without a quic_conn instance using new_quic_cid() which is requires to
first check if a CID is existing before allocating a connection.
This should be backported up to 2.7.
diff --git a/src/quic_conn.c b/src/quic_conn.c
index e5d6c25..0290889 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -3860,8 +3860,7 @@
* as HKDF input secret to generate this token.
* Return 1 if succeeded, 0 if not.
*/
-static int quic_stateless_reset_token_cpy(struct quic_conn *qc,
- unsigned char *buf, size_t len,
+static int quic_stateless_reset_token_cpy(unsigned char *buf, size_t len,
const unsigned char *salt, size_t saltlen)
{
/* Input secret */
@@ -3872,24 +3871,18 @@
size_t labellen = sizeof label - 1;
int ret;
- TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc);
-
ret = quic_hkdf_extract_and_expand(EVP_sha256(), buf, len,
key, keylen, salt, saltlen, label, labellen);
- TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);
return ret;
}
/* Initialize the stateless reset token attached to <cid> connection ID.
* Returns 1 if succeeded, 0 if not.
*/
-static int quic_stateless_reset_token_init(struct quic_conn *qc,
- struct quic_connection_id *quic_cid)
+static int quic_stateless_reset_token_init(struct quic_connection_id *quic_cid)
{
int ret;
- TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc);
-
if (global.cluster_secret) {
/* Output secret */
unsigned char *token = quic_cid->stateless_reset_token;
@@ -3898,7 +3891,7 @@
const unsigned char *cid = quic_cid->cid.data;
size_t cidlen = quic_cid->cid.len;
- ret = quic_stateless_reset_token_cpy(qc, token, tokenlen, cid, cidlen);
+ ret = quic_stateless_reset_token_cpy(token, tokenlen, cid, cidlen);
}
else {
/* TODO: RAND_bytes() should be replaced */
@@ -3906,7 +3899,6 @@
sizeof quic_cid->stateless_reset_token) == 1;
}
- TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);
return ret;
}
@@ -4009,7 +4001,7 @@
memcpy(cid->cid.data, &hash, sizeof(hash));
}
- if (quic_stateless_reset_token_init(qc, cid) != 1) {
+ if (quic_stateless_reset_token_init(cid) != 1) {
TRACE_ERROR("quic_stateless_reset_token_init() failed", QUIC_EV_CONN_TXPKT, qc);
goto err;
}
@@ -6200,7 +6192,7 @@
/* Clear the most significant bit, and set the second one */
*pkt = (*pkt & ~0x80) | 0x40;
- if (!quic_stateless_reset_token_cpy(NULL, pkt + rndlen, QUIC_STATELESS_RESET_TOKEN_LEN,
+ if (!quic_stateless_reset_token_cpy(pkt + rndlen, QUIC_STATELESS_RESET_TOKEN_LEN,
rxpkt->dcid.data, rxpkt->dcid.len))
goto leave;