aboutsummaryrefslogtreecommitdiffstats
path: root/src/elgamal.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-20 10:38:08 +0000
committerlloyd <[email protected]>2008-06-20 10:38:08 +0000
commit4331395edf8e68b46e61fc00ddb5518fef8b36b5 (patch)
tree9307d278abe6065720359df390faef327a9a3d4f /src/elgamal.cpp
parent3b28d92a8a90f27f3da55db7afb47ea23e02cfc4 (diff)
Pass a RandomNumberGenerator& to the PK_Core constructors and the various
public key object loading hooks.
Diffstat (limited to 'src/elgamal.cpp')
-rw-r--r--src/elgamal.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/elgamal.cpp b/src/elgamal.cpp
index 02257af03..fc5100d99 100644
--- a/src/elgamal.cpp
+++ b/src/elgamal.cpp
@@ -18,16 +18,16 @@ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook();
+ X509_load_hook(global_state().prng_reference());
}
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void ElGamal_PublicKey::X509_load_hook()
+void ElGamal_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
{
- core = ELG_Core(group, y);
- load_check(global_state().prng_reference());
+ core = ELG_Core(rng, group, y);
+ load_check(rng);
}
/*************************************************
@@ -58,7 +58,7 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(const DL_Group& grp,
group = grp;
x.randomize(rng, 2 * dl_work_factor(group_p().bits()));
- PKCS8_load_hook(true);
+ PKCS8_load_hook(rng, true);
}
/*************************************************
@@ -71,22 +71,23 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(const DL_Group& grp, const BigInt& x1,
y = y1;
x = x1;
- PKCS8_load_hook();
+ PKCS8_load_hook(global_state().prng_reference());
}
/*************************************************
* Algorithm Specific PKCS #8 Initialization Code *
*************************************************/
-void ElGamal_PrivateKey::PKCS8_load_hook(bool generated)
+void ElGamal_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng,
+ bool generated)
{
if(y == 0)
y = power_mod(group_g(), x, group_p());
- core = ELG_Core(group, y, x);
+ core = ELG_Core(rng, group, y, x);
if(generated)
- gen_check(global_state().prng_reference());
+ gen_check(rng);
else
- load_check(global_state().prng_reference());
+ load_check(rng);
}
/*************************************************