Add ecp_curve_list(), hide ecp_supported_curves
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index cd1568c..353dd8b 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -64,7 +64,7 @@
 } ecp_group_id;
 
 /**
- * Curve information for use by the SSL module
+ * Curve information for use by other modules
  */
 typedef struct
 {
@@ -75,11 +75,6 @@
 } ecp_curve_info;
 
 /**
- * List of supported curves
- */
-extern const ecp_curve_info ecp_supported_curves[];
-
-/**
  * \brief           ECP point structure (jacobian coordinates)
  *
  * \note            All functions expect and return points satisfying
@@ -181,6 +176,13 @@
 #endif
 
 /**
+ * \brief           Return the list of supported curves with associated info
+ *
+ * \return          A statically allocated array, the last entry is 0.
+ */
+const ecp_curve_info *ecp_curve_list( void );
+
+/**
  * \brief           Initialize a point (as zero)
  */
 void ecp_point_init( ecp_point *pt );
diff --git a/library/ecp.c b/library/ecp.c
index 0b6650d..9ab3763 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -95,6 +95,14 @@
 };
 
 /*
+ * List of supported curves and associated info
+ */
+const ecp_curve_info *ecp_curve_list( void )
+{
+    return ecp_supported_curves;
+}
+
+/*
  * Initialize (the components of) a point
  */
 void ecp_point_init( ecp_point *pt )
@@ -755,7 +763,7 @@
 {
     const ecp_curve_info *curve_info;
 
-    for( curve_info = ecp_supported_curves;
+    for( curve_info = ecp_curve_list();
          curve_info->grp_id != POLARSSL_ECP_DP_NONE;
          curve_info++ )
     {
@@ -773,7 +781,7 @@
 {
     const ecp_curve_info *curve_info;
 
-    for( curve_info = ecp_supported_curves;
+    for( curve_info = ecp_curve_list();
          curve_info->grp_id != POLARSSL_ECP_DP_NONE;
          curve_info++ )
     {
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index bfdd7e4..b134b92 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -240,7 +240,7 @@
 
     SSL_DEBUG_MSG( 3, ( "client hello, adding supported_elliptic_curves extension" ) );
 
-    for( curve = ecp_supported_curves;
+    for( curve = ecp_curve_list();
          curve->grp_id != POLARSSL_ECP_DP_NONE;
          curve++ )
     {
diff --git a/programs/pkey/ecdsa.c b/programs/pkey/ecdsa.c
index d6200f1..ac3bdee 100644
--- a/programs/pkey/ecdsa.c
+++ b/programs/pkey/ecdsa.c
@@ -38,7 +38,7 @@
  */
 
 #if !defined(ECPARAMS)
-#define ECPARAMS    ecp_supported_curves[0].grp_id
+#define ECPARAMS    ecp_curve_list()->grp_id
 #endif
 
 #if !defined(POLARSSL_ECDSA_C) || \
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 3f6c72f..b35d4c6 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -447,7 +447,7 @@
 
         memset( buf, 0x2A, sizeof( buf ) );
 
-        for( curve_info = ecp_supported_curves;
+        for( curve_info = ecp_curve_list();
              curve_info->grp_id != POLARSSL_ECP_DP_NONE;
              curve_info++ )
         {
@@ -478,7 +478,7 @@
         const ecp_curve_info *curve_info;
         size_t olen;
 
-        for( curve_info = ecp_supported_curves;
+        for( curve_info = ecp_curve_list();
              curve_info->grp_id != POLARSSL_ECP_DP_NONE;
              curve_info++ )
         {