summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpi/ec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mpi/ec.c b/mpi/ec.c
index 6f7df27f..21cf78b4 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -479,6 +479,11 @@ ec_mulm_25519 (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, mpi_ec_t ctx)
m[0] = (cy * 2 + msb) * 19;
_gcry_mpih_add_n (wp, wp, m, wsize);
wp[LIMB_SIZE_25519-1] &= ~(1UL << (255 % BITS_PER_MPI_LIMB));
+
+ m[0] = 0;
+ cy = _gcry_mpih_sub_n (wp, wp, ctx->p->d, wsize);
+ mpih_set_cond (m, ctx->p->d, wsize, (cy != 0UL));
+ _gcry_mpih_add_n (wp, wp, m, wsize);
}
static void