MINOR: quic: Token for future connections implementation.
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 30 Aug 2024 07:13:30 +0000 (09:13 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 5 Sep 2024 14:17:27 +0000 (16:17 +0200)
commit92b811d5202ec97e04274aef5d7e615da3b13fd3
treeac7874862ceb692e66118c05034b61871196fe3b
parent0c7265509c366b0d9f0ba39c7e36534f148b3c00
MINOR: quic: Token for future connections implementation.

There exist two sorts of token used by QUIC. They are both used to validate
the peer address (path validation). Retry are used for the current
connection the client want to open. This patch implement the other
sort of tokens which after having been received from a connection, may
be provided for the next connection from the same IP address to validate
it (or validate the network path between the client and the server).

The token generation is implemented by quic_generate_token(), and
the token validation by quic_token_chek(). The same method
is used as for Retry tokens to build such tokens to be reused for
future connections. The format is very simple: one byte for the format
identifier to distinguish these new tokens for the Retry token, followed
by a 32bits timestamps. As this part is ciphered with AEAD as cryptographic
algorithm, 16 bytes are needed for the AEAD tag. 16 more random bytes
are added to this token and a salt to derive the AEAD secret used
to cipher the token. In addition to this salt, this is the client IP address
which is used also as AAD to derive the AEAD secret. So, the length of
the token is fixed: 37 bytes.

(cherry picked from commit f5b09dc452f582eb876527fd28103bc29c51afad)
[fl: very minor Makefile modif to correctly add quic_token.o object to be compiled]
Signed-off-by: Frederic Lecaille <flecaille@haproxy.com>
Makefile
include/haproxy/quic_token.h [new file with mode: 0644]
src/quic_token.c [new file with mode: 0644]