BUG/MEDIUM: ssl: crt-list ciphers ignored with AWS-LC
Since AWS-LC 1.47.0, 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.
ssl_sock_switchctx_set_ciphers() now sets both lists again on the SSL
object after the context switch.
Below AWS-LC 1.46 both lists of an SSL object share the same field, so
setting the ciphersuites would erase the ciphers. AWSLC_API_VERSION cannot
tell these versions apart, it stays at 32 from 1.44 to 1.49.
ssl_sock_check_awslc_cipher_lists() therefore checks the behaviour once at
startup, and the ciphersuites are only set when the two lists are separate.
Those older versions do not need the fix anyway, their handshake reads the
lists of the SSL_CTX, which the switch already updated.
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.
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.