diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2016-04-06 18:05:38 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2016-04-06 18:05:38 +0900 |
commit | 6f386ceae86a058e26294f744750f1ed2a95e604 (patch) | |
tree | 0be6b7efd2bc8532bc38356f5c5c142ea1886cbb /cipher/ecc.c | |
parent | 862cf19a119427dd7ee7959a36c72d905f5ea5ca (diff) | |
download | libgcrypt-6f386ceae86a058e26294f744750f1ed2a95e604.tar.gz |
ecc: Positive values in computation.
* cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Make sure
coefficients A and B are positive.
* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_recover_x): For negation, do
"P - T" instead of "-T", so that the result will be positive.
(_gcry_ecc_eddsa_verify): Likewise.
* cipher/ecc.c (ecc_check_secret_key): Use _gcry_ecc_fill_in_curve
instead of _gcry_ecc_update_curve_param.
* mpi/ec.c (ec_subm): Make sure the result will be positive.
(dup_point_edwards, sub_points_edwards, _gcry_mpi_ec_curve_point): Use
mpi_sub instead of mpi_neg.
(add_points_edwards): Simply use ec_addm.
* tests/t-mpi-point.c (test_curve): Define curves with positive
coefficients.
--
We keep the coefficients of domain_parms in ecc-curves.c, so that
keygrip computations won't change.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'cipher/ecc.c')
-rw-r--r-- | cipher/ecc.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/cipher/ecc.c b/cipher/ecc.c index 8dbf5bd0..759ca426 100644 --- a/cipher/ecc.c +++ b/cipher/ecc.c @@ -783,10 +783,7 @@ ecc_check_secret_key (gcry_sexp_t keyparms) curvename = sexp_nth_string (l1, 1); if (curvename) { - rc = _gcry_ecc_update_curve_param (curvename, - &sk.E.model, &sk.E.dialect, - &sk.E.p, &sk.E.a, &sk.E.b, - &mpi_g, &sk.E.n, &sk.E.h); + rc = _gcry_ecc_fill_in_curve (0, curvename, &sk.E, NULL); if (rc) goto leave; } |