BUG/MEDIUM: ssl: crt-list curves ignored with AWS-LC
SSL_new() copies the curves of the SSL_CTX into the SSL object, and
SSL_set_SSL_CTX() does not update this copy while the handshake uses it.
The "curves" and "ecdhe" options of a crt-list line were thus silently
ignored: a client could negotiate a curve excluded by the certificate as
long as the bind line allowed it.
The ClientHello callback used by AWS-LC now sets them again on the SSL
object after the context switch. The value is picked in the same order
as when the SSL_CTX is prepared, so the curves of the bind line still
win over the <ecdhe> of the crt-list line.
The curves setter is inefficient here: it parses the configuration
string for each connection.
This adds the ssl_crt-list_curves reg-tests for TCP and QUIC.
Tested with AWS-LC 3.6.0 (LTS) and 4.2.0. The curves regression tests
pass over TCP and QUIC with both versions.
The TLSv1.2, TLSv1.3 and QUIC cipher regression tests also pass.
Thank you to @ygkat for having reported this issue in GH #3500
This should be backported to all stable versions. Note the code is in
ssl_sock.c before 3.1.
Co-authored-by: William Lallemand <wlallemand@haproxy.com>