aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_core.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-05-24 19:14:00 +0000
committerlloyd <[email protected]>2008-05-24 19:14:00 +0000
commitbe4c408997cf182d974c33b1c62d7f6605c55f3e (patch)
treeaad4126f540bdb24be1a20b765ca73dbacd2b38c /src/pk_core.cpp
parent117ee205ea987df26945e28373a66716fee06876 (diff)
Remove random_integer() and replace it with a BigInt constructor taking a
RandomNumberGenerator reference. Update all callers.
Diffstat (limited to 'src/pk_core.cpp')
-rw-r--r--src/pk_core.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/pk_core.cpp b/src/pk_core.cpp
index 6d02c1cd3..daee59273 100644
--- a/src/pk_core.cpp
+++ b/src/pk_core.cpp
@@ -31,7 +31,8 @@ IF_Core::IF_Core(RandomNumberGenerator& rng,
if(d != 0)
{
- BigInt k = random_integer(rng, std::min(n.bits()-1, BLINDING_BITS));
+ BigInt k(rng, std::min(n.bits()-1, BLINDING_BITS));
+
if(k != 0)
blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
}
@@ -182,8 +183,9 @@ ELG_Core::ELG_Core(const DL_Group& group, const BigInt& y, const BigInt& x)
const BigInt& p = group.get_p();
p_bytes = p.bytes();
- BigInt k = random_integer(global_state().prng_reference(),
- std::min(p.bits()-1, BLINDING_BITS));
+ BigInt k(global_state().prng_reference(),
+ std::min(p.bits()-1, BLINDING_BITS));
+
if(k != 0)
blinder = Blinder(k, power_mod(k, x, p), p);
}
@@ -245,8 +247,10 @@ DH_Core::DH_Core(const DL_Group& group, const BigInt& x)
op = Engine_Core::dh_op(group, x);
const BigInt& p = group.get_p();
- BigInt k = random_integer(global_state().prng_reference(),
- std::min(p.bits()-1, BLINDING_BITS));
+
+ BigInt k(global_state().prng_reference(),
+ std::min(p.bits()-1, BLINDING_BITS));
+
if(k != 0)
blinder = Blinder(k, power_mod(inverse_mod(k, p), x, p), p);
}