From 1f114e4c42e7c6705af9c533f9a29e946180f435 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Thu, 29 Oct 2026 15:38:16 +0100 Subject: [PATCH] CLEANUP: quic: update the outdated comment of quic_tls_derive_keys() The comment still refers to a parameter which no longer exists and claims that the derived key, IV and header protection key have the same size, which the code below contradicts. Describe the actual derivation from RFC 9001 5.1 instead. --- src/quic_tls.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/quic_tls.c b/src/quic_tls.c index 2d2cca5c4..ac583d795 100644 --- a/src/quic_tls.c +++ b/src/quic_tls.c @@ -524,12 +524,18 @@ int quic_hkdf_expand_label(const EVP_MD *md, key, keylen, hdkf_label, pos - hdkf_label); } -/* - * This function derives two keys from is as TLS cryptographic context. - * ->key is the TLS key to be derived to encrypt/decrypt data at TLS level. - * ->iv is the initialization vector to be used with ->key. - * ->hp_key is the key to be derived for header protection. - * Obviouly these keys have the same size becaused derived with the same TLS cryptographic context. +/* Derive into , and the AEAD key, the AEAD IV and the + * header protection key from , using as hash function and the + * labels of . This follows the packet protection key derivation of + * RFC 9001 5.1: each value is the output of HKDF-Expand-Label applied to the + * encryption level secret, with the "quic key", "quic iv" and "quic hp" + * labels. + * + * The length of each derived value depends on the AEAD algorithm and on the + * header protection cipher, and is checked against the size of the + * corresponding output buffer. + * + * Return 1 if succeeded, 0 if not. */ int quic_tls_derive_keys(const QUIC_AEAD *aead, const EVP_CIPHER *hp, const EVP_MD *md, const struct quic_version *qv, -- 2.47.3