diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-03-30 10:42:03 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-03-30 10:42:03 +0900 |
commit | 45e88b8ec6dfbd8f981ca89ded80ef48eca6f0e9 (patch) | |
tree | 8eccdaf9957c4c605e03ca927ce565f075ee9c87 /mpi/ec.c | |
parent | 68bb0ddc5504c9c0f3f52259a4085bb2fc1a02ad (diff) | |
download | libgcrypt-45e88b8ec6dfbd8f981ca89ded80ef48eca6f0e9.tar.gz |
ecc: Fix the regression of gcry_mpi_ec_add.
* mpi/ec.c (_gcry_mpi_ec_point_resize): Export the routine
for internal use.
(add_points_edwards, _gcry_mpi_ec_mul_point): Use mpi_point_resize.
* src/gcrypt-int.h (_gcry_mpi_ec_point_resize): Declare.
* src/visibility.c (gcry_mpi_ec_dup, gcry_mpi_ec_add): Make sure for
the size of limb before calling the internal functions.
(gcry_mpi_ec_sub): Likewise.
--
GnuPG-bug-id: 5372
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'mpi/ec.c')
-rw-r--r-- | mpi/ec.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -154,8 +154,8 @@ _gcry_mpi_point_copy (gcry_mpi_point_t point) } -static void -point_resize (mpi_point_t p, mpi_ec_t ctx) +void +_gcry_mpi_ec_point_resize (mpi_point_t p, mpi_ec_t ctx) { size_t nlimbs = ctx->p->nlimbs; @@ -1483,7 +1483,7 @@ add_points_edwards (mpi_point_t result, #define G (ctx->t.scratch[6]) #define tmp (ctx->t.scratch[7]) - point_resize (result, ctx); + mpi_point_resize (result, ctx); /* Compute: (X_3 : Y_3 : Z_3) = (X_1 : Y_1 : Z_1) + (X_2 : Y_2 : Z_3) */ @@ -1711,7 +1711,7 @@ _gcry_mpi_ec_mul_point (mpi_point_t result, mpi_set_ui (result->x, 0); mpi_set_ui (result->y, 1); mpi_set_ui (result->z, 1); - point_resize (point, ctx); + mpi_point_resize (point, ctx); } if (mpi_is_secure (scalar)) @@ -1721,8 +1721,8 @@ _gcry_mpi_ec_mul_point (mpi_point_t result, mpi_point_struct tmppnt; point_init (&tmppnt); - point_resize (result, ctx); - point_resize (&tmppnt, ctx); + mpi_point_resize (result, ctx); + mpi_point_resize (&tmppnt, ctx); for (j=nbits-1; j >= 0; j--) { _gcry_mpi_ec_dup_point (result, result, ctx); @@ -1735,8 +1735,8 @@ _gcry_mpi_ec_mul_point (mpi_point_t result, { if (ctx->model == MPI_EC_EDWARDS) { - point_resize (result, ctx); - point_resize (point, ctx); + mpi_point_resize (result, ctx); + mpi_point_resize (point, ctx); } for (j=nbits-1; j >= 0; j--) @@ -1798,10 +1798,10 @@ _gcry_mpi_ec_mul_point (mpi_point_t result, scalar = a; } - point_resize (&p1, ctx); - point_resize (&p2, ctx); - point_resize (&p1_, ctx); - point_resize (&p2_, ctx); + mpi_point_resize (&p1, ctx); + mpi_point_resize (&p2, ctx); + mpi_point_resize (&p1_, ctx); + mpi_point_resize (&p2_, ctx); mpi_resize (point->x, ctx->p->nlimbs); point->x->nlimbs = ctx->p->nlimbs; |