aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2014-04-08 02:59:39 +0000
committerNIIBE Yutaka <[email protected]>2014-04-08 02:59:39 +0000
commit40c3b0741e593d0658dda0c707c4f32e80648dd1 (patch)
treeb1e481f47635cce781d8531af56ef69d161b7d3f
parentagent: EdDSA support for SSH. (diff)
downloadgnupg-40c3b0741e593d0658dda0c707c4f32e80648dd1.tar.gz
gnupg-40c3b0741e593d0658dda0c707c4f32e80648dd1.zip
g10: EdDSA support.
* g10/keyid.c (keygrip_from_pk): Compute keygrip of EdDSA key. * g10/keygen.c (generate_subkeypair): Ed25519 is for EdDSA. * common/openpgp-oid.c (oid_ed25519): Update.
-rw-r--r--common/openpgp-oid.c2
-rw-r--r--g10/keygen.c6
-rw-r--r--g10/keyid.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/common/openpgp-oid.c b/common/openpgp-oid.c
index a2a3617b6..94a2296b6 100644
--- a/common/openpgp-oid.c
+++ b/common/openpgp-oid.c
@@ -39,7 +39,7 @@
/* The OID for Curve Ed25519 in OpenPGP format. */
static const char oid_ed25519[] =
- { 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x97, 0x55, 0x01, 0x05, 0x01 };
+ { 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01 };
/* Helper for openpgp_oid_from_str. */
diff --git a/g10/keygen.c b/g10/keygen.c
index 135699db3..f3052e492 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -4031,7 +4031,11 @@ generate_subkeypair (ctrl_t ctrl, kbnode_t keyblock)
else if (algo == PUBKEY_ALGO_ECDSA
|| algo == PUBKEY_ALGO_EDDSA
|| algo == PUBKEY_ALGO_ECDH)
- curve = ask_curve ();
+ {
+ curve = ask_curve ();
+ if (curve && !strcmp (curve, "Ed25519"))
+ algo = PUBKEY_ALGO_EDDSA;
+ }
else
nbits = ask_keysize (algo, 0);
diff --git a/g10/keyid.c b/g10/keyid.c
index 9ed64a4b5..2883af171 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -813,7 +813,9 @@ keygrip_from_pk (PKT_public_key *pk, unsigned char *array)
else
{
err = gcry_sexp_build (&s_pkey, NULL,
- "(public-key(ecc(curve%s)(q%m)))",
+ pk->pubkey_algo == PUBKEY_ALGO_EDDSA ?
+ "(public-key(ecc(curve%s)(flags eddsa)(q%m)))"
+ : "(public-key(ecc(curve%s)(q%m)))",
curve, pk->pkey[1]);
xfree (curve);
}