Adding the secp256k1 curve for ECDSA
NIIBE Yutaka
gniibe at fsij.org
Wed Jan 15 07:05:27 CET 2014
On 2014-01-14 at 21:54 +0900, NIIBE Yutaka wrote:
> I added support of the secp256k1 curve in libgcrypt. Next, I'd like
> to add a feature of ECDSA with secp256k1 to GnuPG.
As a start, I add OID of secp256k1 and add an entry for --gen-key.
Here it is. OK to push to master?
diff --git a/common/openpgp-oid.c b/common/openpgp-oid.c
index 05b1a40..28567b7 100644
--- a/common/openpgp-oid.c
+++ b/common/openpgp-oid.c
@@ -310,6 +310,11 @@ openpgp_curve_to_oid (const char *name, unsigned int *r_nbits)
oidstr = "1.3.36.3.3.2.8.1.1.13";
nbits = 512;
}
+ else if (!strcmp (name, "secp256k1"))
+ {
+ oidstr = "1.3.132.0.10";
+ nbits = 256;
+ }
else
oidstr = NULL;
@@ -333,6 +338,8 @@ openpgp_oid_to_curve (const char *oid)
name = "Ed25519";
else if (!strcmp (oid, "1.2.840.10045.3.1.7"))
name = "nistp256";
+ else if (!strcmp (oid, "1.3.132.0.10"))
+ name = "secp256k1";
else if (!strcmp (oid, "1.3.132.0.34"))
name = "nistp384";
else if (!strcmp (oid, "1.3.132.0.35"))
diff --git a/g10/keygen.c b/g10/keygen.c
index 4bb8bba..7582b0b 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2062,6 +2062,7 @@ ask_curve (void)
{ "brainpoolP256r1", 0, 1, "Brainpool P-256" },
{ "brainpoolP384r1", 0, 1, "Brainpool P-384" },
{ "brainpoolP512r1", 0, 1, "Brainpool P-512" },
+ { "secp256k1", 0, 1 },
};
int idx;
char *answer;
--
More information about the Gnupg-devel
mailing list