Added ecp_use_known_dp()
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 2bede2c..8763fc1 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -32,9 +32,9 @@
/*
* ECP error codes
*
- * (The functions written up to now return MPI error codes only.)
+ * (Only one error code available...)
*/
-
+#define POLARSSL_ERR_ECP_GENERIC -0x007E /**< Generic ECP error */
/**
* \brief ECP point structure (affine coordinates)
@@ -75,6 +75,12 @@
* parameters. Therefore, only well-known domain parameters from trusted
* sources (such as the ones below) should be used.
*/
+#define POLARSSL_ECP_DP_SECP192R1 0
+#define POLARSSL_ECP_DP_SECP224R1 1
+#define POLARSSL_ECP_DP_SECP256R1 2
+#define POLARSSL_ECP_DP_SECP384R1 3
+#define POLARSSL_ECP_DP_SECP521R1 4
+
#define POLARSSL_ECP_SECP192R1_P \
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"
#define POLARSSL_ECP_SECP192R1_B \
@@ -216,6 +222,20 @@
const char *gx, const char *gy, const char *n);
/**
+ * \brief Set a group using well-known domain parameters
+ *
+ * \param grp Destination group
+ * \param index Index in the list of well-known domain parameters
+ *
+ * \return O if successul,
+ * POLARSSL_ERR_MPI_XXX if initialization failed
+ * POLARSSL_ERR_ECP_GENERIC if index is out of range
+ *
+ * \note Index should be a POLARSSL_ECP_DP_XXX macro.
+ */
+int ecp_use_known_dp( ecp_group *grp, size_t index );
+
+/**
* \brief Addition: R = P + Q
*
* \param grp ECP group
diff --git a/include/polarssl/error.h b/include/polarssl/error.h
index 96815a7..736e8a7 100644
--- a/include/polarssl/error.h
+++ b/include/polarssl/error.h
@@ -68,6 +68,7 @@
* SHA2 1 0x0078-0x0078
* SHA4 1 0x007A-0x007A
* PBKDF2 1 0x007C-0x007C
+ * ECP 1 0x007E-0x007E
*
* High-level module nr (3 bits - 0x1...-0x8...)
* Name ID Nr of Errors