summaryrefslogtreecommitdiff
path: root/validat0.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-03-25 02:47:38 -0400
committerJeffrey Walton <noloader@gmail.com>2018-03-25 02:47:38 -0400
commit34be01231c3d234de3fb5d77e9941faf842cd257 (patch)
tree2edcc4c56b77cbe8fde138ecaf957f6a5e8627ac /validat0.cpp
parenta8d40ee07faa39c8c1c43cc645d9c04a5be02f32 (diff)
downloadcryptopp-git-34be01231c3d234de3fb5d77e9941faf842cd257.tar.gz
Fix conversion warnings under MSC
Diffstat (limited to 'validat0.cpp')
-rw-r--r--validat0.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/validat0.cpp b/validat0.cpp
index 32d72bc8..e91044fb 100644
--- a/validat0.cpp
+++ b/validat0.cpp
@@ -3307,21 +3307,22 @@ bool TestIntegerOps()
for (unsigned int i=0; i<128; ++i)
{
- Integer a(prng, 4096);
- word32 m = prng.GenerateWord32();
+ Integer a(prng, 4096); word m;
+ prng.GenerateBlock((byte*)&m, sizeof(m));
a++; // make non-0
if (m == 0) m++;
// Avoid the conversion from word to long
- Integer am = a % Integer(Integer::POSITIVE, m);
+ Integer mi = Integer(Integer::POSITIVE, 0, m);
+ Integer ri = a % Integer(Integer::POSITIVE, 0, m);
- Integer x = Integer(Integer::POSITIVE, a.InverseMod(m));
- Integer y = Integer(Integer::POSITIVE, am.InverseMod(m));
- Integer z = Integer(Integer::POSITIVE, (a * y).Modulo(m));
+ Integer x = Integer(Integer::POSITIVE, 0, a.InverseMod(m));
+ Integer y = Integer(Integer::POSITIVE, 0, ri.InverseMod(m));
+ Integer z = Integer(Integer::POSITIVE, 0, (a * y).Modulo(m));
- if (GCD(a,m) == 1) // coprime?
- result = (x == y) && (z == 1) && (a_times_b_mod_c(a, x, m) == 1);
+ if (GCD(a,mi) == 1) // coprime?
+ result = (x == y) && (z == 1);
else
result = (x == y);