summaryrefslogtreecommitdiff
path: root/src/ec-context.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-03-19 15:12:07 +0100
committerWerner Koch <wk@gnupg.org>2013-03-19 15:12:07 +0100
commit931e409e877d1e444edd53dead327ec8e64daf9a (patch)
tree841c4f30324273512effe06d32af6f36d8da26c8 /src/ec-context.h
parent229f3219f80c9369ed9624242c0436ae6d293201 (diff)
downloadlibgcrypt-931e409e877d1e444edd53dead327ec8e64daf9a.tar.gz
Extend the new EC interface and fix two bugs.
* src/ec-context.h (mpi_ec_ctx_s): Add field NEED_SYNC. * mpi/ec.c (ec_p_sync): New. (ec_p_init): Only set NEED_SYNC. (_gcry_mpi_ec_set_mpi): Set NEED_SYNC for 'p' and 'a'. (_gcry_mpi_ec_dup_point, _gcry_mpi_ec_add_points) (_gcry_mpi_ec_mul_point): Call ec_p_sync. (_gcry_mpi_ec_get_point): Recompute 'q' is needed. (_gcry_mpi_ec_get_mpi): Ditto. Also allow for names 'q', 'q.x', 'q.y', and 'g'. * cipher/ecc.c (_gcry_mpi_ec_ec2os): New. * cipher/ecc.c (_gcry_mpi_ec_new): Fix init from parameters 'Q'->'q', 'G'->'q'. -- Note that the parameter names are all lowercase. This patch fixes an inconsistency. The other bug was that changing the parameters D or A may have resulted in wrong computations because helper variables were not updated. Now we delay the computation of those helper variables until we need them.
Diffstat (limited to 'src/ec-context.h')
-rw-r--r--src/ec-context.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ec-context.h b/src/ec-context.h
index 88742bf2..6827e188 100644
--- a/src/ec-context.h
+++ b/src/ec-context.h
@@ -38,6 +38,8 @@ struct mpi_ec_ctx_s
/* This structure is private to mpi/ec.c! */
struct {
+ int need_sync; /* Helper for ec_p_sync. */
+
int a_is_pminus3; /* True if A = P - 3. */
gcry_mpi_t two_inv_p;