Hello,
attached patch fixes the issue with dropped support for EC cipher
suites in software that uses SSL_OP_SINGLE_ECDH_USE after upgrading to
OpenSSL-1.0.2+.

As far as I can tell, the public key isn't necessary to set TLS EC
curve_id and removing this requirement is safe.

Best regards,
Piotr Sikora


Set TLS EC curve_id from EC group alone.

Strict EC parameter checking code runs before ephemeral EC key
is generated and existing code didn't account for that.

This resulted in dropped support for EC cipher suites in software
that uses SSL_OP_SINGLE_ECDH_USE, i.e.:

    SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE);
    SSL_CTX_set_tmp_ecdh(ctx, ecdh);

The solution is to use only EC group and don't require EC key
to be already generated.

Signed-off-by: Piotr Sikora <pi...@cloudflare.com>
---
 ssl/t1_lib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index ee376de..e24627f 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -578,14 +578,12 @@ static int tls1_set_ec_id(unsigned char
*curve_id, unsigned char *comp_id,
        {
        int is_prime, id;
        const EC_GROUP *grp;
-       const EC_POINT *pt;
        const EC_METHOD *meth;
        if (!ec)
                return 0;
        /* Determine if it is a prime field */
        grp = EC_KEY_get0_group(ec);
-        pt = EC_KEY_get0_public_key(ec);
-       if (!grp || !pt)
+       if (!grp)
                return 0;
         meth = EC_GROUP_method_of(grp);
        if (!meth)

Attachment: Set-TLS-EC-curve_id-from-EC-group-alone.patch
Description: Binary data

Reply via email to