This is an automated email from the ASF dual-hosted git repository.

sandreoli pushed a commit to branch review-mike
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-c.git

commit b4ddc1497cba42fe7a262016794194f75569d10c
Author: Samuele Andreoli <[email protected]>
AuthorDate: Tue Apr 14 16:44:11 2020 +0100

    Perform initial reduction in invmodp
---
 src/big.c.in | 3 ++-
 src/ff.c.in  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/big.c.in b/src/big.c.in
index cbeb524..d671f19 100644
--- a/src/big.c.in
+++ b/src/big.c.in
@@ -1519,7 +1519,8 @@ void BIG_XXX_invmodp(BIG_XXX r,BIG_XXX a,BIG_XXX p)
     BIG_XXX u, v, s, w;
 
     BIG_XXX_copy(u, p);
-    BIG_XXX_copy(v,a);
+    BIG_XXX_copy(v, a);
+    BIG_XXX_mod(v, p);
     BIG_XXX_zero(r);
     BIG_XXX_one(s);
 
diff --git a/src/ff.c.in b/src/ff.c.in
index a5d9867..53f1ecb 100644
--- a/src/ff.c.in
+++ b/src/ff.c.in
@@ -568,6 +568,7 @@ void FF_WWW_invmodp(BIG_XXX r[],BIG_XXX a[],BIG_XXX p[],int 
n)
 
     FF_WWW_copy(u, p, n);
     FF_WWW_copy(v, a, n);
+    FF_WWW_mod(v, p, n);
     FF_WWW_zero(r, n);
     FF_WWW_one(s, n);
 

Reply via email to