Add ecp_curve_info_from_name()
diff --git a/library/ecp.c b/library/ecp.c
index 80a10ba..ef38d19 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -58,6 +58,11 @@
#include <limits.h>
#include <stdlib.h>
+#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
+ !defined(EFI32)
+#define strcasecmp _stricmp
+#endif
+
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline
#else
@@ -84,13 +89,13 @@
const ecp_curve_info ecp_supported_curves[] =
{
#if defined(POLARSSL_ECP_DP_BP512R1_ENABLED)
- { POLARSSL_ECP_DP_BP512R1, 28, 512, "brainpool512r1" },
+ { POLARSSL_ECP_DP_BP512R1, 28, 512, "brainpoolP512r1" },
#endif
#if defined(POLARSSL_ECP_DP_BP384R1_ENABLED)
- { POLARSSL_ECP_DP_BP384R1, 27, 384, "brainpool384r1" },
+ { POLARSSL_ECP_DP_BP384R1, 27, 384, "brainpoolP384r1" },
#endif
#if defined(POLARSSL_ECP_DP_BP256R1_ENABLED)
- { POLARSSL_ECP_DP_BP256R1, 26, 256, "brainpool256r1" },
+ { POLARSSL_ECP_DP_BP256R1, 26, 256, "brainpoolP256r1" },
#endif
#if defined(POLARSSL_ECP_DP_SECP521R1_ENABLED)
{ POLARSSL_ECP_DP_SECP521R1, 25, 521, "secp521r1" },
@@ -155,6 +160,24 @@
}
/*
+ * Get the curve info from the name
+ */
+const ecp_curve_info *ecp_curve_info_from_name( const char *name )
+{
+ const ecp_curve_info *curve_info;
+
+ for( curve_info = ecp_curve_list();
+ curve_info->grp_id != POLARSSL_ECP_DP_NONE;
+ curve_info++ )
+ {
+ if( strcasecmp( curve_info->name, name ) == 0 )
+ return( curve_info );
+ }
+
+ return( NULL );
+}
+
+/*
* Initialize (the components of) a point
*/
void ecp_point_init( ecp_point *pt )