Commit 65237bc2bb33802fb2b24c1fb70d7bff16a58de1

Steffen Jaeckel 2019-09-10T09:35:15

fix s_mp_montgomery_reduce_fast as proposed by @dmitry-lipetsk This fixes #62

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/bn_s_mp_montgomery_reduce_fast.c b/bn_s_mp_montgomery_reduce_fast.c
index 843ad12..3f0c672 100644
--- a/bn_s_mp_montgomery_reduce_fast.c
+++ b/bn_s_mp_montgomery_reduce_fast.c
@@ -119,7 +119,7 @@ mp_err s_mp_montgomery_reduce_fast(mp_int *x, const mp_int *n, mp_digit rho)
       /* alias for next word, where the carry goes */
       _W = W + ++ix;
 
-      for (; ix <= ((n->used * 2) + 1); ix++) {
+      for (; ix < ((n->used * 2) + 1); ix++) {
          *_W++ += *_W1++ >> (mp_word)MP_DIGIT_BIT;
       }