summaryrefslogtreecommitdiff
path: root/mpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpi/ec.c')
-rw-r--r--mpi/ec.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mpi/ec.c b/mpi/ec.c
index 889df8ec..39ab5ebe 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -1216,8 +1216,23 @@ _gcry_mpi_ec_curve_point (gcry_mpi_point_t point, mpi_ec_t ctx)
switch (ctx->model)
{
case MPI_EC_WEIERSTRASS:
- log_fatal ("%s: %s not yet supported\n",
- "_gcry_mpi_ec_curve_point", "Weierstrass");
+ {
+ gcry_mpi_t xx = mpi_new (0);
+
+ /* y^2 == x^3 + a·x^2 + b */
+ ec_pow2 (y, y, ctx);
+
+ ec_pow2 (xx, x, ctx);
+ ec_mulm (w, ctx->a, xx, ctx);
+ ec_addm (w, w, ctx->b, ctx);
+ ec_mulm (xx, xx, x, ctx);
+ ec_addm (w, w, xx, ctx);
+
+ if (!mpi_cmp (y, w))
+ res = 1;
+
+ gcry_mpi_release (xx);
+ }
break;
case MPI_EC_MONTGOMERY:
log_fatal ("%s: %s not yet supported\n",