]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ech: reject an ECH store with no usable private key
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 30 Jul 2026 15:56:37 +0000 (15:56 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 30 Jul 2026 16:13:27 +0000 (18:13 +0200)
OSSL_ECHSTORE_read_pem() accepts a PEM file containing only an
ECHConfig with no private key. OSSL_ECHSTORE_num_keys() returns 1
on success regardless of the count it writes back, so the existing
"!= 1" check only ever caught the call itself failing, never a
resulting count of zero: a directory containing only such
config-only ".ech" files loaded "successfully" and got installed via
SSL_CTX_set1_echstore(), while unable to decrypt a single
ECH-protected ClientHello, with nothing pointing at the cause.

This should be backported to 3.3 and 3.4.

src/ech.c

index c62ae1b6ce3e6f9ab0ec72f94698e6a87bab8cc0..fdc14ccc6c353de803a4c70f9a28aa54621fd46f 100644 (file)
--- a/src/ech.c
+++ b/src/ech.c
@@ -103,6 +103,11 @@ ignore_entry:
        }
        if (OSSL_ECHSTORE_num_keys(es, loaded) != 1)
                goto end;
+       if (*loaded == 0) {
+               memprintf(err, "%sno ECH key file in '%s' contains a usable private key",
+                         err && *err ? *err : "", dirname);
+               goto end;
+       }
        if (1 != SSL_CTX_set1_echstore(ctx, es))
                goto end;
        rv = 1;