aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/math/numbertheory/ressol.cpp2
-rw-r--r--src/tests/data/bn/ressol.vec43
2 files changed, 44 insertions, 1 deletions
diff --git a/src/lib/math/numbertheory/ressol.cpp b/src/lib/math/numbertheory/ressol.cpp
index 127dc899e..2c83cb0e0 100644
--- a/src/lib/math/numbertheory/ressol.cpp
+++ b/src/lib/math/numbertheory/ressol.cpp
@@ -66,7 +66,7 @@ BigInt ressol(const BigInt& a, const BigInt& p)
q = mod_p.square(q);
++i;
- if(i > s)
+ if(i >= s)
{
return -BigInt(1);
}
diff --git a/src/tests/data/bn/ressol.vec b/src/tests/data/bn/ressol.vec
index a16f08c42..c21c337af 100644
--- a/src/tests/data/bn/ressol.vec
+++ b/src/tests/data/bn/ressol.vec
@@ -16,3 +16,46 @@ Input = 20749193632488214633180774027217139706413443729200940480695355894185
Modulus = 26959946667150639794667015087019630673557916260026308143510066298881
Output = 1825097171398375765346899906888660610489759292065918530856859649959
+Input = 64
+Modulus = 85
+Output = -1
+
+Input = 206
+Modulus = 153
+Output = -1
+
+Input = 181
+Modulus = 217
+Output = -1
+
+Input = 166
+Modulus = 85
+Output = -1
+
+Input = 4225
+Modulus = 33153
+Output = -1
+
+Input = 57700
+Modulus = 153
+Output = -1
+
+Input = 2048
+Modulus = 31417
+Output = -1
+
+Input = 65151
+Modulus = 2405
+Output = -1
+
+Input = 2
+Modulus = 4369
+Output = -1
+
+Input = 61508
+Modulus = 4141
+Output = -1
+
+Input = 6553700
+Modulus = 33153
+Output = -1