ecc: Positive values in computation.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 6 Apr 2016 09:05:38 +0000 (18:05 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 6 Apr 2016 09:05:38 +0000 (18:05 +0900)
commit6f386ceae86a058e26294f744750f1ed2a95e604
tree0be6b7efd2bc8532bc38356f5c5c142ea1886cbb
parent862cf19a119427dd7ee7959a36c72d905f5ea5ca
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>
cipher/ecc-curves.c
cipher/ecc-eddsa.c
cipher/ecc.c
mpi/ec.c
tests/t-mpi-point.c