Prepare support for non-Weierstrass EC equations.
authorWerner Koch <wk@gnupg.org>
Tue, 3 Sep 2013 10:01:15 +0000 (12:01 +0200)
committerWerner Koch <wk@gnupg.org>
Wed, 4 Sep 2013 09:25:06 +0000 (11:25 +0200)
commitc26be7a337d0bf98193bc58e043209e46d0769bb
tree71f15800908d68666f80fee8c42a7b344f5be178
parent8698530b2f9ef95542f1dd550961de7af86cc256
Prepare support for non-Weierstrass EC equations.

* src/mpi.h (gcry_mpi_ec_models): New.
* src/ec-context.h (mpi_ec_ctx_s): Add MODEL.
* cipher/ecc-common.h (elliptic_curve_t): Ditto.
* cipher/ecc-curves.c (ecc_domain_parms_t): Ditto.
(domain_parms): Mark als as Weierstrass.
(_gcry_ecc_fill_in_curve): Check model.
(_gcry_ecc_get_curve): Set model to Weierstrass.
* cipher/ecc-misc.c (_gcry_ecc_model2str): New.
* cipher/ecc.c (generate_key, ecc_generate_ext): Print model in the
debug output.

* mpi/ec.c (_gcry_mpi_ec_dup_point): Switch depending on model.
Factor code out to ...
(dup_point_weierstrass): new.
(dup_point_montgomery, dup_point_twistededwards): New stub functions.
(_gcry_mpi_ec_add_points): Switch depending on model.  Factor code out
to ...
(add_points_weierstrass): new.
(add_points_montgomery, add_points_twistededwards): New stub
functions.

* tests/Makefile.am (TESTS): Reorder tests.

Signed-off-by: Werner Koch <wk@gnupg.org>
cipher/ecc-common.h
cipher/ecc-curves.c
cipher/ecc-misc.c
cipher/ecc.c
mpi/ec.c
src/ec-context.h
src/mpi.h
tests/Makefile.am