aboutsummaryrefslogtreecommitdiffstats
path: root/src/rw.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-20 10:49:31 +0000
committerlloyd <[email protected]>2008-06-20 10:49:31 +0000
commit850af952f95a3115e509ebd0aa6689a1d2e9c810 (patch)
treef8933b074f00ddd1fdba746e9cc1d3ad5d96e9c8 /src/rw.cpp
parenta2700f470482680d4f99b3b519af0a1ccfd53bfd (diff)
Pass RNG& to IF (RSA/RW) load hooks
Diffstat (limited to 'src/rw.cpp')
-rw-r--r--src/rw.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rw.cpp b/src/rw.cpp
index 2574df442..cf0ca72ba 100644
--- a/src/rw.cpp
+++ b/src/rw.cpp
@@ -7,6 +7,7 @@
#include <botan/numthry.h>
#include <botan/keypair.h>
#include <botan/parsing.h>
+#include <botan/libstate.h>
#include <algorithm>
namespace Botan {
@@ -18,7 +19,7 @@ RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp)
{
n = mod;
e = exp;
- X509_load_hook();
+ X509_load_hook(global_state().prng_reference());
}
/*************************************************
@@ -52,8 +53,7 @@ SecureVector<byte> RW_PublicKey::verify(const byte in[], u32bit len) const
/*************************************************
* Create a Rabin-Williams private key *
*************************************************/
-RW_PrivateKey::RW_PrivateKey(u32bit bits,
- RandomNumberGenerator& rng,
+RW_PrivateKey::RW_PrivateKey(u32bit bits, RandomNumberGenerator& rng,
u32bit exp)
{
if(bits < 1024)
@@ -67,7 +67,7 @@ RW_PrivateKey::RW_PrivateKey(u32bit bits,
q = random_prime(rng, bits - p.bits(), e / 2, ((p % 8 == 3) ? 7 : 3), 8);
d = inverse_mod(e, lcm(p - 1, q - 1) >> 1);
- PKCS8_load_hook(true);
+ PKCS8_load_hook(rng, true);
if(n.bits() != bits)
throw Self_Test_Failure(algo_name() + " private key generation failed");
@@ -89,7 +89,7 @@ RW_PrivateKey::RW_PrivateKey(const BigInt& prime1, const BigInt& prime2,
if(d == 0)
d = inverse_mod(e, lcm(p - 1, q - 1) >> 1);
- PKCS8_load_hook();
+ PKCS8_load_hook(global_state().prng_reference());
}
/*************************************************