From: Frédéric Lécaille Date: Mon, 24 Apr 2023 12:35:18 +0000 (+0200) Subject: CLEANUP: quic: Rename variable to in quic_generate_retry_token() X-Git-Tag: v2.8-dev9~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dad0ede28aa6a653cf2257ef2f218013100ee9b8;p=thirdparty%2Fhaproxy.git CLEANUP: quic: Rename variable to 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. --- diff --git a/src/quic_conn.c b/src/quic_conn.c index d89dae1395..399f22f349 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -6340,12 +6340,12 @@ static int quic_generate_retry_token_aad(unsigned char *aad, /* QUIC server only function. * Generate the token to be used in Retry packets. The token is written to - * with as length. is the original destination connection + * with as length. is the original destination connection * ID and is our side destination connection ID (or client source * connection ID). * 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 struct quic_cid *odcid, const struct quic_cid *dcid, @@ -6393,7 +6393,7 @@ static int quic_generate_retry_token(unsigned char *buf, size_t len, } /* Token build */ - p = buf; + p = token; *p++ = QUIC_TOKEN_FMT_RETRY, *p++ = 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; /* 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); goto err; } @@ -6412,7 +6412,7 @@ static int quic_generate_retry_token(unsigned char *buf, size_t len, p += sizeof salt; EVP_CIPHER_CTX_free(ctx); - ret = p - buf; + ret = p - token; leave: TRACE_LEAVE(QUIC_EV_CONN_TXPKT); return ret;