mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
CLEANUP: quic: Rename <buf> variable to <token> in quic_generate_retry_token()
Make quic_generate_retry_token() be more readable: there is no struct buffer variable used in this function. Should be backported to 2.7.
This commit is contained in:
parent
e66d67a1ae
commit
dad0ede28a
@ -6340,12 +6340,12 @@ static int quic_generate_retry_token_aad(unsigned char *aad,
|
|||||||
|
|
||||||
/* QUIC server only function.
|
/* QUIC server only function.
|
||||||
* Generate the token to be used in Retry packets. The token is written to
|
* Generate the token to be used in Retry packets. The token is written to
|
||||||
* <buf> with <len> as length. <odcid> is the original destination connection
|
* <token> with <len> as length. <odcid> is the original destination connection
|
||||||
* ID and <dcid> is our side destination connection ID (or client source
|
* ID and <dcid> is our side destination connection ID (or client source
|
||||||
* connection ID).
|
* connection ID).
|
||||||
* Returns the length of the encoded token or 0 on error.
|
* Returns the length of the encoded token or 0 on error.
|
||||||
*/
|
*/
|
||||||
static int quic_generate_retry_token(unsigned char *buf, size_t len,
|
static int quic_generate_retry_token(unsigned char *token, size_t len,
|
||||||
const uint32_t version,
|
const uint32_t version,
|
||||||
const struct quic_cid *odcid,
|
const struct quic_cid *odcid,
|
||||||
const struct quic_cid *dcid,
|
const struct quic_cid *dcid,
|
||||||
@ -6393,7 +6393,7 @@ static int quic_generate_retry_token(unsigned char *buf, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Token build */
|
/* Token build */
|
||||||
p = buf;
|
p = token;
|
||||||
*p++ = QUIC_TOKEN_FMT_RETRY,
|
*p++ = QUIC_TOKEN_FMT_RETRY,
|
||||||
*p++ = odcid->len;
|
*p++ = odcid->len;
|
||||||
memcpy(p, odcid->data, odcid->len);
|
memcpy(p, odcid->data, odcid->len);
|
||||||
@ -6402,7 +6402,7 @@ static int quic_generate_retry_token(unsigned char *buf, size_t len,
|
|||||||
p += sizeof timestamp;
|
p += sizeof timestamp;
|
||||||
|
|
||||||
/* Do not encrypt the QUIC_TOKEN_FMT_RETRY byte */
|
/* Do not encrypt the QUIC_TOKEN_FMT_RETRY byte */
|
||||||
if (!quic_tls_encrypt(buf + 1, p - buf - 1, aad, aadlen, ctx, aead, key, iv)) {
|
if (!quic_tls_encrypt(token + 1, p - token - 1, aad, aadlen, ctx, aead, key, iv)) {
|
||||||
TRACE_ERROR("quic_tls_encrypt() failed", QUIC_EV_CONN_TXPKT);
|
TRACE_ERROR("quic_tls_encrypt() failed", QUIC_EV_CONN_TXPKT);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -6412,7 +6412,7 @@ static int quic_generate_retry_token(unsigned char *buf, size_t len,
|
|||||||
p += sizeof salt;
|
p += sizeof salt;
|
||||||
EVP_CIPHER_CTX_free(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
|
|
||||||
ret = p - buf;
|
ret = p - token;
|
||||||
leave:
|
leave:
|
||||||
TRACE_LEAVE(QUIC_EV_CONN_TXPKT);
|
TRACE_LEAVE(QUIC_EV_CONN_TXPKT);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user