secp256k1

NIIBE Yutaka gniibe at fsij.org
Fri Jan 10 09:45:35 CET 2014


On 2014-01-10 at 09:42 +0900, NIIBE Yutaka wrote:
> At the start, I don't have an idea to implement this technique, but, I
> am going to just define the curve by adding its domain parameter.

I mean something like this.  I also would like to add a key in
tests/basic.c.

diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c
index ed629fc..822685d 100644
--- a/cipher/ecc-curves.c
+++ b/cipher/ecc-curves.c
@@ -73,6 +73,8 @@ static const struct
     { "brainpoolP384r1", "1.3.36.3.3.2.8.1.1.11"},
     { "brainpoolP512r1", "1.3.36.3.3.2.8.1.1.13"},
 
+    { "secp256k1", "1.3.132.0.10" },
+
     { NULL, NULL}
   };
 
@@ -297,6 +299,17 @@ static const ecc_domain_parms_t domain_parms[] =
       "c83ab156d77f1496bf7eb3351e1ee4e43dc1a18b91b24640b6dbb92cb1add371e",
     },
 
+    {
+      "secp256k1", 256, 0,
+      MPI_EC_WEIERSTRASS, ECC_DIALECT_STANDARD,
+      "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F",
+      "0x0000000000000000000000000000000000000000000000000000000000000000",
+      "0x0000000000000000000000000000000000000000000000000000000000000007",
+      "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",
+      "0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",
+      "0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8"
+    },
+
     { NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL }
   };
 
diff --git a/tests/curves.c b/tests/curves.c
index 198693e..04e6bc9 100644
--- a/tests/curves.c
+++ b/tests/curves.c
@@ -29,7 +29,7 @@
 #include "../src/gcrypt-int.h"
 
 /* Number of curves defined in ../cipger/ecc.c */
-#define N_CURVES 15
+#define N_CURVES 16
 
 /* A real world sample public key.  */
 static char const sample_key_1[] =
-- 





More information about the Gcrypt-devel mailing list