Hello,

When X25519MLKEM768 comes first in "curves", a client which supports it
but only sends a key_share for X25519 gets a HelloRetryRequest with
AWS-LC, so its handshake takes one more round trip. I wanted to log how
many clients are in this case and found no way to do it, so this series
adds two sample fetches for that.

  1/4 initializes the flags of the QUIC ssl_sock_ctx
  2/4 sets a flag from a message callback when a HelloRetryRequest is
      sent or received
  3/4 adds ssl_fc_has_hrr and ssl_bc_has_hrr
  4/4 adds a reg-test, over TCP and QUIC

Some choices I am not sure about:

- AWS-LC has SSL_used_hello_retry_request() but OpenSSL has no
  equivalent, so I used the message callback to have a single code path.
  I can call the AWS-LC function instead where it exists if you prefer.
- The callback is always registered, like the KeyUpdate one is by
  default.
- The names. They follow ssl_fc_has_crt and ssl_fc_has_sni, but "hrr"
  may not be obvious.

Tested with OpenSSL 1.1.1w and each branch from 3.0 to 4.1, AWS-LC
1.22.0 and 5.14.0, and LibreSSL 4.4.1. With wolfSSL 5.9.4 the message
callback is never set since SSL_CTRL_SET_MSG_CALLBACK is not defined, so
the fetches are not registered there. I have a prototype which makes
them work, but it has to enable this callback for wolfSSL and to deal
with what wolfSSL passes to it (only the messages it sends, with their
record header), so I left it out of this series. I can send it if you
are interested.

The reg-test only runs with OpenSSL and AWS-LC, like the curves ones: a
LibreSSL client sends two key_shares, so these curves do not make it
receive a HelloRetryRequest. It also has their version conditions, so
for OpenSSL 1.1.1w and AWS-LC 1.22.0 I ran a copy without them.

The Compatibility line of the doc is the one of "ciphersuites". Two
things I noticed with AWS-LC 1.22.0 while checking it: it defines
AWSLC_API_VERSION as 28, not 22, and master does not build with it
because it has no SSL_CIPHER_find(), which src/ssl_trace.c calls, so I
stubbed this function for the test.

Thanks,
Dongwon Jang

Dongwon Jang (4):
  MINOR: quic: initialize the flags of the QUIC ssl_sock_ctx
  MINOR: ssl: record HelloRetryRequest in the ssl_sock_ctx flags
  MINOR: ssl: add the ssl_fc_has_hrr and ssl_bc_has_hrr sample fetches
  REGTESTS: ssl: test the ssl_fc_has_hrr and ssl_bc_has_hrr fetches

 doc/configuration.txt        | 22 ++++++++++++
 include/haproxy/ssl_sock-t.h |  1 +
 reg-tests/quic/ssl_hrr.vtc   | 19 ++++++++++
 reg-tests/ssl/ssl_hrr.vtc    | 17 +++++++++
 reg-tests/ssl/ssl_hrr.vtci   | 67 ++++++++++++++++++++++++++++++++++++
 src/quic_ssl.c               |  1 +
 src/ssl_sample.c             | 33 ++++++++++++++++++
 src/ssl_sock.c               | 44 +++++++++++++++++++++++
 8 files changed, 204 insertions(+)
 create mode 100644 reg-tests/quic/ssl_hrr.vtc
 create mode 100644 reg-tests/ssl/ssl_hrr.vtc
 create mode 100644 reg-tests/ssl/ssl_hrr.vtci

-- 
2.50.1 (Apple Git-155)



Reply via email to