Allow all curves when the client doesn't send an supported elliptic curves extension
authorKurt Roeckx <kurt@roeckx.be>
Sat, 30 May 2015 17:20:12 +0000 (19:20 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Thu, 4 Jun 2015 19:12:33 +0000 (21:12 +0200)
At least in the case of SSLv3 we can't send an extention.

Reviewed-by: Matt Caswell <matt@openssl.org>
MR #811

(cherry picked from commit 3c06513f3833d4692f620e2c03d7a840871c08a7)

ssl/t1_lib.c

index bf11f93e62782f25a1f0219959dcb1b8bba3f3ec..a398501e24c2987363934925ee3da2338077c2d9 100644 (file)
@@ -593,6 +593,20 @@ int tls1_shared_curve(SSL *s, int nmatch)
         (s, !(s->options & SSL_OP_CIPHER_SERVER_PREFERENCE), &pref,
          &num_pref))
         return nmatch == -1 ? 0 : NID_undef;
+
+    /*
+     * If the client didn't send the elliptic_curves extension all of them
+     * are allowed.
+     */
+    if (num_supp == 0 && (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE) != 0) {
+        supp = eccurves_all;
+        num_supp = sizeof(eccurves_all) / 2;
+    } else if (num_pref == 0 &&
+        (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) {
+        pref = eccurves_all;
+        num_pref = sizeof(eccurves_all) / 2;
+    }
+
     k = 0;
     for (i = 0; i < num_pref; i++, pref += 2) {
         const unsigned char *tsupp = supp;