From d487778da95447156524b2b85642aedf9a81f9ef Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 20 Feb 2011 15:42:44 +0000 Subject: [PATCH] A few more modpow tests, exercising the fallback option. This is mostly so I can valgrind both and make sure they free all their workspace - a memory leak in this code would be not merely an inconvenience but a security hazard. git-svn-id: svn://svn.tartarus.org/sgt/putty@9101 cda61777-01e9-0310-a592-d414129be87e --- testdata/bignum.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testdata/bignum.py b/testdata/bignum.py index f781bea7..37341e68 100644 --- a/testdata/bignum.py +++ b/testdata/bignum.py @@ -87,3 +87,7 @@ for i in range(64, 4097, 63): base = mathlib.sqrt(3*modulus*modulus) % modulus expt = mathlib.sqrt(modulus*modulus*2/5) print "pow", hexstr(base), hexstr(expt), hexstr(modulus), hexstr(pow(base, expt, modulus)) + if i <= 1024: + # Test even moduli, which can't be done by Montgomery. + modulus = modulus - 1 + print "pow", hexstr(base), hexstr(expt), hexstr(modulus), hexstr(pow(base, expt, modulus)) -- 2.11.0