BUG/MEDIUM: ssl: crt-list ciphers ignored with AWS-LC
AWS-LC's SSL_new() copies the cipher lists of the SSL_CTX into the SSL
object, and SSL_set_SSL_CTX() does not update this copy while the server
handshake uses it. The "ciphers" and "ciphersuites" options of a
crt-list line were thus silently ignored: a client could negotiate a cipher
excluded by the certificate as long as the bind line allowed it. The same
configuration built against OpenSSL rejects such a connection.
The SNI callback now sets both lists again on the SSL object after the
context switch when built with AWS-LC API versions greater than 30.
API version 30 (AWS-LC 3.x) uses the selected SSL_CTX cipher lists
directly and does not need this workaround.
These setters are inefficient here: they parse the cipher configuration
strings for each connection.
This adds the ssl_crt-list_ciphers reg-test for TLSv1.2 and the
ssl_crt-list_ciphersuites ones for TLSv1.3, over TCP and QUIC.
Tested with AWS-LC LTS versions 3.6.0 and 4.2.0.
Thank you to @ygkat for having reported this issue in GH #3500
This should be backported as far as 3.0. Note the code is in ssl_sock.c
before 3.1.
Co-authored-by: William Lallemand <wlallemand@haproxy.com>