MEDIUM: ssl/quic: implement quic crypto with EVP_AEAD
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 10 Jul 2024 08:28:27 +0000 (10:28 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 5 Sep 2024 14:15:15 +0000 (16:15 +0200)
commit0c7265509c366b0d9f0ba39c7e36534f148b3c00
tree8104e360be3ea22b2959d63c86a8b50cf24271bd
parentd074491bd487afc6c1a07c7db5ec6cc300f9e5b5
MEDIUM: ssl/quic: implement quic crypto with EVP_AEAD

The QUIC crypto is using the EVP_CIPHER API in order to achieve
authenticated encryption, this was the API which was used with OpenSSL.
With libraries that inspires from BoringSSL (libreSSL and AWS-LC), the
AEAD algorithms are implemented using the EVP_AEAD API.

This patch converts the call to the EVP_CIPHER API when called in the
contex of AEAD cryptography for QUIC.

The patch defines some QUIC_AEAD macros that can be either EVP_CIPHER or
EVP_AEAD depending on the library.

This was mainly done for AWS-LC but this could be useful for other
libraries. This should finally allow to use CHACHA20_POLY1305 with
AWS-LC.

This patch allows to use the following ciphers with the EVP_AEAD API:
- TLS1_3_CK_AES_128_GCM_SHA256
- TLS1_3_CK_AES_256_GCM_SHA384

AWS-LC does not implement TLS1_3_CK_AES_128_CCM_SHA256 and
TLS1_3_CK_CHACHA20_POLY1305_SHA256 requires some hack for headers
protection which will come in another patch.

(cherry picked from commit 31c831e29b432f0a9958be63948e8f4cb278e9f8)
[fl: required to support NEW_TOKEN which depends on QUIC_AEAD_* definitions]
Signed-off-by: Frederic Lecaille <flecaille@haproxy.com>
include/haproxy/quic_tls-t.h
include/haproxy/quic_tls.h
src/quic_retry.c
src/quic_rx.c
src/quic_tls.c