summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-06-17 11:54:28 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2020-06-17 11:54:28 +0900
commitb1721f9b291a4c226caa2bfbe4fefe8fde5216e0 (patch)
treee435f0681193273feecb3d674b4003bd837acdbe /cipher
parent5585ee4947082f932ee01d93dfe295c769e96671 (diff)
downloadlibgcrypt-b1721f9b291a4c226caa2bfbe4fefe8fde5216e0.tar.gz
ecc: No (flags eddsa) required for Ed448.
* cipher/ecc.c (check_secret_key): Ed448 means EdDSA. (ecc_generate): Likewise. * tests/t-ed448.c (one_test): Remove the flag in key. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ecc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cipher/ecc.c b/cipher/ecc.c
index 3413ca17..c712ccd8 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -445,7 +445,8 @@ check_secret_key (mpi_ec_t ec, int flags)
goto leave;
}
- if ((flags & PUBKEY_FLAG_EDDSA))
+ if ((flags & PUBKEY_FLAG_EDDSA)
+ || (ec->model == MPI_EC_EDWARDS && ec->dialect == ECC_DIALECT_SAFECURVE))
; /* Fixme: EdDSA is special. */
else if (!mpi_cmp_ui (ec->Q->z, 1))
{
@@ -513,10 +514,11 @@ ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey)
if (rc)
goto leave;
- if (ec->model == MPI_EC_MONTGOMERY)
- rc = nist_generate_key (ec, flags, &Qx, NULL);
- else if ((flags & PUBKEY_FLAG_EDDSA))
+ if ((flags & PUBKEY_FLAG_EDDSA)
+ || (ec->model == MPI_EC_EDWARDS && ec->dialect == ECC_DIALECT_SAFECURVE))
rc = _gcry_ecc_eddsa_genkey (ec, flags);
+ else if (ec->model == MPI_EC_MONTGOMERY)
+ rc = nist_generate_key (ec, flags, &Qx, NULL);
else
rc = nist_generate_key (ec, flags, &Qx, &Qy);
if (rc)