Use tls1_group_id_lookup in tls1_curve_allowed
authorDr. Stephen Henson <steve@openssl.org>
Sun, 24 Sep 2017 20:58:58 +0000 (21:58 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 26 Sep 2017 12:00:26 +0000 (13:00 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/=4412)

ssl/t1_lib.c

index 78e42fe2395e1d51f8c5ad5c8cca69d221596d6c..196466bd983f640b57a44a35a48971fdcd5f8b1d 100644 (file)
@@ -254,13 +254,11 @@ void tls1_get_grouplist(SSL *s, int sess, const uint16_t **pcurves,
 /* See if curve is allowed by security callback */
 int tls_curve_allowed(SSL *s, uint16_t curve, int op)
 {
-    const TLS_GROUP_INFO *cinfo;
+    const TLS_GROUP_INFO *cinfo = tls1_group_id_lookup(curve);
     unsigned char ctmp[2];
-    if (curve > 0xff)
-        return 1;
-    if (curve < 1 || curve > OSSL_NELEM(nid_list))
+
+    if (cinfo == NULL)
         return 0;
-    cinfo = &nid_list[curve - 1];
 # ifdef OPENSSL_NO_EC2M
     if (cinfo->flags & TLS_CURVE_CHAR2)
         return 0;