Add OIDs and TLS IDs for prime Koblitz curves
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 1bc989e..d98146c 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -78,7 +78,7 @@
*
* (Montgomery curves excluded for now.)
*/
-#define POLARSSL_ECP_DP_MAX 9
+#define POLARSSL_ECP_DP_MAX 12
/**
* Curve information for use by other modules
diff --git a/include/polarssl/oid.h b/include/polarssl/oid.h
index 93ef8a6..f000b8e 100644
--- a/include/polarssl/oid.h
+++ b/include/polarssl/oid.h
@@ -263,7 +263,7 @@
#define OID_EC_ALG_ECDH OID_CERTICOM "\x01\x0c"
/*
- * ECParameters namedCurve identifiers, from RFC 5480 and RFC 5639
+ * ECParameters namedCurve identifiers, from RFC 5480, RFC 5639, and SEC2
*/
/* secp192r1 OBJECT IDENTIFIER ::= {
@@ -286,6 +286,18 @@
* iso(1) identified-organization(3) certicom(132) curve(0) 35 } */
#define OID_EC_GRP_SECP521R1 OID_CERTICOM "\x00\x23"
+/* secp192k1 OBJECT IDENTIFIER ::= {
+ * iso(1) identified-organization(3) certicom(132) curve(0) 31 } */
+#define OID_EC_GRP_SECP192K1 OID_CERTICOM "\x00\x1f"
+
+/* secp224k1 OBJECT IDENTIFIER ::= {
+ * iso(1) identified-organization(3) certicom(132) curve(0) 32 } */
+#define OID_EC_GRP_SECP224K1 OID_CERTICOM "\x00\x20"
+
+/* secp256k1 OBJECT IDENTIFIER ::= {
+ * iso(1) identified-organization(3) certicom(132) curve(0) 10 } */
+#define OID_EC_GRP_SECP256K1 OID_CERTICOM "\x00\x0a"
+
/* RFC 5639 4.1
* ecStdCurvesAndGeneration OBJECT IDENTIFIER::= {iso(1)
* identified-organization(3) teletrust(36) algorithm(3) signature-
diff --git a/library/ecp.c b/library/ecp.c
index 8b34bf3..0bef955 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -141,6 +141,15 @@
#if defined(POLARSSL_ECP_DP_SECP192R1_ENABLED)
{ POLARSSL_ECP_DP_SECP192R1, 19, 192, "secp192r1" },
#endif
+#if defined(POLARSSL_ECP_DP_SECP256K1_ENABLED)
+ { POLARSSL_ECP_DP_SECP256K1, 22, 256, "secp256k1" },
+#endif
+#if defined(POLARSSL_ECP_DP_SECP224K1_ENABLED)
+ { POLARSSL_ECP_DP_SECP224K1, 20, 224, "secp224k1" },
+#endif
+#if defined(POLARSSL_ECP_DP_SECP192K1_ENABLED)
+ { POLARSSL_ECP_DP_SECP192K1, 18, 192, "secp192k1" },
+#endif
{ POLARSSL_ECP_DP_NONE, 0, 0, NULL },
};
diff --git a/library/oid.c b/library/oid.c
index b0b551d..f943c6d 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -403,6 +403,18 @@
POLARSSL_ECP_DP_SECP521R1,
},
{
+ { ADD_LEN( OID_EC_GRP_SECP192K1 ), "secp192k1", "secp192k1" },
+ POLARSSL_ECP_DP_SECP192K1,
+ },
+ {
+ { ADD_LEN( OID_EC_GRP_SECP224K1 ), "secp224k1", "secp224k1" },
+ POLARSSL_ECP_DP_SECP224K1,
+ },
+ {
+ { ADD_LEN( OID_EC_GRP_SECP256K1 ), "secp256k1", "secp256k1" },
+ POLARSSL_ECP_DP_SECP256K1,
+ },
+ {
{ ADD_LEN( OID_EC_GRP_BP256R1 ), "brainpoolP256r1","brainpool256r1" },
POLARSSL_ECP_DP_BP256R1,
},