Add ecp_supported_curves and simplify some code
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index bb8d3e9..88afc84 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -517,41 +517,12 @@
     while( list_size > 0 )
     {
         grp_id = ecp_grp_id_from_named_curve( ( p[0] << 8 ) | p[1] );
-#if defined(POLARSSL_ECP_DP_SECP192R1_ENABLED)
-        if( grp_id == POLARSSL_ECP_DP_SECP192R1 )
+
+        if( grp_id != POLARSSL_ECP_DP_NONE )
         {
             ssl->handshake->ec_curve = grp_id;
             return( 0 );
         }
-#endif
-#if defined(POLARSSL_ECP_DP_SECP224R1_ENABLED)
-        if( grp_id == POLARSSL_ECP_DP_SECP224R1 )
-        {
-            ssl->handshake->ec_curve = grp_id;
-            return( 0 );
-        }
-#endif
-#if defined(POLARSSL_ECP_DP_SECP256R1_ENABLED)
-        if( grp_id == POLARSSL_ECP_DP_SECP256R1 )
-        {
-            ssl->handshake->ec_curve = grp_id;
-            return( 0 );
-        }
-#endif
-#if defined(POLARSSL_ECP_DP_SECP384R1_ENABLED)
-        if( grp_id == POLARSSL_ECP_DP_SECP384R1 )
-        {
-            ssl->handshake->ec_curve = grp_id;
-            return( 0 );
-        }
-#endif
-#if defined(POLARSSL_ECP_DP_SECP521R1_ENABLED)
-        if( grp_id == POLARSSL_ECP_DP_SECP521R1 )
-        {
-            ssl->handshake->ec_curve = grp_id;
-            return( 0 );
-        }
-#endif
 
         list_size -= 2;
         p += 2;
@@ -1939,6 +1910,9 @@
             return( ret );
         }
 
+        SSL_DEBUG_MSG( 2, ( "ECDH curve size: %d",
+                            (int) ssl->handshake->ecdh_ctx.grp.nbits ) );
+
         if( ( ret = ecdh_make_params( &ssl->handshake->ecdh_ctx,
                                       &len,
                                       p,