aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-02-01 12:37:11 -0500
committerJack Lloyd <[email protected]>2016-02-01 13:06:10 -0500
commit87a59dd0ea8a783540d30bb697b4c86d9b66f7ee (patch)
treebf2c62842fe9c945bbb6a2546340a51506170fce /src
parentfb22198b9add1f1d46d6b05cc8626b7a8d8ff9c6 (diff)
Fix two bugs in 1.11.27 which caused test failures.1.11.28
The check on each individual size in curve_mul is too strict since we rely on redc(x*1) during the on the curve computation. Fix an off by one in ressol which caused it to occasionally reject valid values. Updating version 1.11.28 since existing 1.11.27 tag already pushed :( Fix an off-by-one in ressol which would cause it to occasionly give up too early.
Diffstat (limited to 'src')
-rw-r--r--src/lib/math/ec_gfp/curve_gfp.cpp3
-rw-r--r--src/lib/math/numbertheory/ressol.cpp2
-rw-r--r--src/tests/data/bigint.vec5
3 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/math/ec_gfp/curve_gfp.cpp b/src/lib/math/ec_gfp/curve_gfp.cpp
index 52e5b0b56..9bf2191c6 100644
--- a/src/lib/math/ec_gfp/curve_gfp.cpp
+++ b/src/lib/math/ec_gfp/curve_gfp.cpp
@@ -83,9 +83,6 @@ void CurveGFp_Montgomery::curve_mul(BigInt& z, const BigInt& x, const BigInt& y,
const size_t x_sw = x.sig_words();
const size_t y_sw = y.sig_words();
- BOTAN_ASSERT(x_sw <= m_p_words, "Input in range");
- BOTAN_ASSERT(y_sw <= m_p_words, "Input in range");
-
const size_t output_size = 2*m_p_words + 1;
ws.resize(2*(m_p_words+2));
diff --git a/src/lib/math/numbertheory/ressol.cpp b/src/lib/math/numbertheory/ressol.cpp
index 875d054c3..127dc899e 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(s >= i)
+ if(i > s)
{
return -BigInt(1);
}
diff --git a/src/tests/data/bigint.vec b/src/tests/data/bigint.vec
index 2445c8de4..1ce284504 100644
--- a/src/tests/data/bigint.vec
+++ b/src/tests/data/bigint.vec
@@ -2593,3 +2593,8 @@ Output = 51280014837979468164589555486627418611564292169528438732746318972321369
Input = 4
Modulus = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057149
Output = -1
+
+Input = 20749193632488214633180774027217139706413443729200940480695355894185
+Modulus = 26959946667150639794667015087019630673557916260026308143510066298881
+Output = 1825097171398375765346899906888660610489759292065918530856859649959
+