aboutsummaryrefslogtreecommitdiffstats
path: root/src/elgamal.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/elgamal.cpp
parent117ee205ea987df26945e28373a66716fee06876 (diff)
Remove random_integer() and replace it with a BigInt constructor taking a
RandomNumberGenerator reference. Update all callers.
Diffstat (limited to 'src/elgamal.cpp')
-rw-r--r--src/elgamal.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/elgamal.cpp b/src/elgamal.cpp
index b815dd396..99cb7ff83 100644
--- a/src/elgamal.cpp
+++ b/src/elgamal.cpp
@@ -36,9 +36,8 @@ void ElGamal_PublicKey::X509_load_hook()
SecureVector<byte> ElGamal_PublicKey::encrypt(const byte in[],
u32bit length) const
{
- BigInt k = random_integer(
- global_state().prng_reference(),
- 2 * dl_work_factor(group_p().bits()));
+ BigInt k(global_state().prng_reference(),
+ 2 * dl_work_factor(group_p().bits()));
return core.encrypt(in, length, k);
}
@@ -58,8 +57,7 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(const DL_Group& grp,
RandomNumberGenerator& rng)
{
group = grp;
-
- x = random_integer(rng, 2 * dl_work_factor(group_p().bits()));
+ x.randomize(rng, 2 * dl_work_factor(group_p().bits()));
PKCS8_load_hook(true);
}