aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-05-24 18:52:52 +0000
committerlloyd <[email protected]>2008-05-24 18:52:52 +0000
commitf8078f5904fce5cbfd69516b175872496bdc2267 (patch)
treef2fb2ef681947328a64a13feddc3c256da6c4305 /src
parentc4bad5476b30811ad51b1edd3bd873864d423c07 (diff)
Pass a RNG reference to load_check and gen_check functions
Diffstat (limited to 'src')
-rw-r--r--src/dh.cpp7
-rw-r--r--src/dsa.cpp6
-rw-r--r--src/elgamal.cpp6
-rw-r--r--src/if_algo.cpp7
-rw-r--r--src/nr.cpp6
-rw-r--r--src/pk_keys.cpp16
6 files changed, 23 insertions, 25 deletions
diff --git a/src/dh.cpp b/src/dh.cpp
index bf5ad5b11..08377f06d 100644
--- a/src/dh.cpp
+++ b/src/dh.cpp
@@ -5,6 +5,7 @@
#include <botan/dh.h>
#include <botan/numthry.h>
+#include <botan/libstate.h>
#include <botan/util.h>
namespace Botan {
@@ -24,7 +25,7 @@ DH_PublicKey::DH_PublicKey(const DL_Group& grp, const BigInt& y1)
*************************************************/
void DH_PublicKey::X509_load_hook()
{
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
@@ -80,9 +81,9 @@ void DH_PrivateKey::PKCS8_load_hook(bool generated)
core = DH_Core(group, x);
if(generated)
- gen_check();
+ gen_check(global_state().prng_reference());
else
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
diff --git a/src/dsa.cpp b/src/dsa.cpp
index e22d9bd88..1a61c0cd2 100644
--- a/src/dsa.cpp
+++ b/src/dsa.cpp
@@ -26,7 +26,7 @@ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1)
void DSA_PublicKey::X509_load_hook()
{
core = DSA_Core(group, y);
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
@@ -89,9 +89,9 @@ void DSA_PrivateKey::PKCS8_load_hook(bool generated)
core = DSA_Core(group, y, x);
if(generated)
- gen_check();
+ gen_check(global_state().prng_reference());
else
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
diff --git a/src/elgamal.cpp b/src/elgamal.cpp
index 95062cc53..133fdae68 100644
--- a/src/elgamal.cpp
+++ b/src/elgamal.cpp
@@ -27,7 +27,7 @@ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1)
void ElGamal_PublicKey::X509_load_hook()
{
core = ELG_Core(group, y);
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
@@ -87,9 +87,9 @@ void ElGamal_PrivateKey::PKCS8_load_hook(bool generated)
core = ELG_Core(group, y, x);
if(generated)
- gen_check();
+ gen_check(global_state().prng_reference());
else
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
diff --git a/src/if_algo.cpp b/src/if_algo.cpp
index dfb41f177..4e64e82ae 100644
--- a/src/if_algo.cpp
+++ b/src/if_algo.cpp
@@ -7,6 +7,7 @@
#include <botan/numthry.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
+#include <botan/libstate.h>
namespace Botan {
@@ -158,7 +159,7 @@ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder()
void IF_Scheme_PublicKey::X509_load_hook()
{
core = IF_Core(e, n);
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
@@ -174,9 +175,9 @@ void IF_Scheme_PrivateKey::PKCS8_load_hook(bool generated)
core = IF_Core(e, n, d, p, q, d1, d2, c);
if(generated)
- gen_check();
+ gen_check(global_state().prng_reference());
else
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
diff --git a/src/nr.cpp b/src/nr.cpp
index 53beb4056..7e76d67ad 100644
--- a/src/nr.cpp
+++ b/src/nr.cpp
@@ -26,7 +26,7 @@ NR_PublicKey::NR_PublicKey(const DL_Group& grp, const BigInt& y1)
void NR_PublicKey::X509_load_hook()
{
core = NR_Core(group, y);
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
@@ -88,9 +88,9 @@ void NR_PrivateKey::PKCS8_load_hook(bool generated)
core = NR_Core(group, y, x);
if(generated)
- gen_check();
+ gen_check(global_state().prng_reference());
else
- load_check();
+ load_check(global_state().prng_reference());
}
/*************************************************
diff --git a/src/pk_keys.cpp b/src/pk_keys.cpp
index 8ada71133..c442b7555 100644
--- a/src/pk_keys.cpp
+++ b/src/pk_keys.cpp
@@ -6,7 +6,6 @@
#include <botan/pk_keys.h>
#include <botan/config.h>
#include <botan/oids.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -42,30 +41,27 @@ OID Public_Key::get_oid() const
/*************************************************
* Run checks on a loaded public key *
*************************************************/
-void Public_Key::load_check() const
+void Public_Key::load_check(RandomNumberGenerator& rng) const
{
- if(!check_key(global_state().prng_reference(),
- key_check_level("public")))
+ if(!check_key(rng, key_check_level("public")))
throw Invalid_Argument(algo_name() + ": Invalid public key");
}
/*************************************************
* Run checks on a loaded private key *
*************************************************/
-void Private_Key::load_check() const
+void Private_Key::load_check(RandomNumberGenerator& rng) const
{
- if(!check_key(global_state().prng_reference(),
- key_check_level("private")))
+ if(!check_key(rng, key_check_level("private")))
throw Invalid_Argument(algo_name() + ": Invalid private key");
}
/*************************************************
* Run checks on a generated private key *
*************************************************/
-void Private_Key::gen_check() const
+void Private_Key::gen_check(RandomNumberGenerator& rng) const
{
- if(!check_key(global_state().prng_reference(),
- key_check_level("private_gen")))
+ if(!check_key(rng, key_check_level("private_gen")))
throw Self_Test_Failure(algo_name() + " private key generation failed");
}