From: William Lallemand Date: Thu, 30 Jul 2026 15:56:37 +0000 (+0000) Subject: BUG/MINOR: ech: reject an ECH store with no usable private key X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ceb896ab307153e51531bbee8d8a85d7734bca5e;p=thirdparty%2Fhaproxy.git BUG/MINOR: ech: reject an ECH store with no usable private key 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. --- diff --git a/src/ech.c b/src/ech.c index c62ae1b6c..fdc14ccc6 100644 --- 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;