1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-03 22:48:03 +02:00

ecc: Support Ed448/X448 key generation.

* g10/keygen.c (ask_curve): Support Ed448/X448 keys.
(generate_keypair): Support switch to X448 key.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-06-30 14:20:31 +09:00
parent 9b6f574928
commit 45398518fb

View File

@ -2612,7 +2612,7 @@ ask_curve (int *algo, int *subkey_algo, const char *current)
# define MY_USE_ECDSADH 0 # define MY_USE_ECDSADH 0
#endif #endif
{ "Curve25519", "Ed25519", "Curve 25519", !!GPG_USE_EDDSA, 0, 0, 0 }, { "Curve25519", "Ed25519", "Curve 25519", !!GPG_USE_EDDSA, 0, 0, 0 },
{ "Curve448", "Ed448", "Curve 448", 0/*reserved*/ , 0, 1, 0 }, { "X448", "Ed448", "Curve 448", !!GPG_USE_EDDSA, 0, 1, 0 },
{ "NIST P-256", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 }, { "NIST P-256", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 },
{ "NIST P-384", NULL, NULL, MY_USE_ECDSADH, 0, 0, 0 }, { "NIST P-384", NULL, NULL, MY_USE_ECDSADH, 0, 0, 0 },
{ "NIST P-521", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 }, { "NIST P-521", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 },
@ -4972,7 +4972,10 @@ generate_keypair (ctrl_t ctrl, int full, const char *fname,
{ {
/* Need to switch to a different curve for the /* Need to switch to a different curve for the
encryption key. */ encryption key. */
curve = "Curve25519"; if (!strcmp (curve, "Ed25519"))
curve = "Curve25519";
else
curve = "X448";
} }
r = xmalloc_clear (sizeof *r + strlen (curve)); r = xmalloc_clear (sizeof *r + strlen (curve));
r->key = pSUBKEYCURVE; r->key = pSUBKEYCURVE;