aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checks/pk.cpp54
-rw-r--r--checks/x509.cpp4
-rw-r--r--include/dh.h2
-rw-r--r--include/dl_algo.h4
-rw-r--r--include/dsa.h2
-rw-r--r--include/elgamal.h2
-rw-r--r--include/if_algo.h4
-rw-r--r--include/nr.h2
-rw-r--r--include/pk_core.h4
-rw-r--r--include/pk_keys.h6
-rw-r--r--include/rsa.h11
-rw-r--r--include/rw.h7
-rw-r--r--src/dh.cpp6
-rw-r--r--src/dl_algo.cpp12
-rw-r--r--src/dsa.cpp6
-rw-r--r--src/elgamal.cpp8
-rw-r--r--src/if_algo.cpp14
-rw-r--r--src/nr.cpp6
-rw-r--r--src/pk_core.cpp22
-rw-r--r--src/rsa.cpp13
-rw-r--r--src/rw.cpp14
-rw-r--r--src/x509_key.cpp4
22 files changed, 106 insertions, 101 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 2dad1b966..f7199c86d 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -178,8 +178,12 @@ u32bit validate_rsa_enc(const std::string& algo,
if(str.size() != 6)
throw Exception("Invalid input from pk_valid.dat");
- RSA_PrivateKey privkey(to_bigint(str[1]), to_bigint(str[2]),
+ RandomNumberGenerator& rng = global_state().prng_reference();
+
+ RSA_PrivateKey privkey(rng,
+ to_bigint(str[1]), to_bigint(str[2]),
to_bigint(str[0]));
+
RSA_PublicKey pubkey = privkey;
std::string eme = algo.substr(6, std::string::npos);
@@ -227,8 +231,12 @@ u32bit validate_rsa_sig(const std::string& algo,
if(str.size() != 6)
throw Exception("Invalid input from pk_valid.dat");
- RSA_PrivateKey privkey(to_bigint(str[1]), to_bigint(str[2]),
+ RandomNumberGenerator& rng = global_state().prng_reference();
+
+ RSA_PrivateKey privkey(rng,
+ to_bigint(str[1]), to_bigint(str[2]),
to_bigint(str[0]));
+
RSA_PublicKey pubkey = privkey;
std::string emsa = algo.substr(7, std::string::npos);
@@ -322,7 +330,9 @@ u32bit validate_rw_sig(const std::string& algo,
if(str.size() != 6)
throw Exception("Invalid input from pk_valid.dat");
- RW_PrivateKey privkey(to_bigint(str[1]), to_bigint(str[2]),
+ RandomNumberGenerator& rng = global_state().prng_reference();
+
+ RW_PrivateKey privkey(rng, to_bigint(str[1]), to_bigint(str[2]),
to_bigint(str[0]));
RW_PublicKey pubkey = privkey;
@@ -491,32 +501,32 @@ void do_pk_keygen_tests()
std::cout << "Testing PK key generation: " << std::flush;
/* Putting each key in a block reduces memory pressure, speeds it up */
-#define IF_SIG_KEY(TYPE, BITS) \
- { \
- TYPE key(BITS, rng); \
- key.check_key(rng, true); \
- std::cout << '.' << std::flush; \
+#define IF_SIG_KEY(TYPE, BITS) \
+ { \
+ TYPE key(rng, BITS); \
+ key.check_key(rng, true); \
+ std::cout << '.' << std::flush; \
}
-#define DL_SIG_KEY(TYPE, GROUP) \
- { \
- TYPE key(rng, DL_Group(GROUP)); \
- key.check_key(rng, true); \
- std::cout << '.' << std::flush; \
+#define DL_SIG_KEY(TYPE, GROUP) \
+ { \
+ TYPE key(rng, DL_Group(GROUP)); \
+ key.check_key(rng, true); \
+ std::cout << '.' << std::flush; \
}
-#define DL_ENC_KEY(TYPE, GROUP) \
- { \
- TYPE key(rng, DL_Group(GROUP)); \
- key.check_key(rng, true); \
- std::cout << '.' << std::flush; \
+#define DL_ENC_KEY(TYPE, GROUP) \
+ { \
+ TYPE key(rng, DL_Group(GROUP)); \
+ key.check_key(rng, true); \
+ std::cout << '.' << std::flush; \
}
-#define DL_KEY(TYPE, GROUP) \
- { \
+#define DL_KEY(TYPE, GROUP) \
+ { \
TYPE key(rng, DL_Group(GROUP)); \
- key.check_key(rng, true); \
- std::cout << '.' << std::flush; \
+ key.check_key(rng, true); \
+ std::cout << '.' << std::flush; \
}
RandomNumberGenerator& rng = global_state().prng_reference();
diff --git a/checks/x509.cpp b/checks/x509.cpp
index 92d9d43ed..015b050f6 100644
--- a/checks/x509.cpp
+++ b/checks/x509.cpp
@@ -84,7 +84,7 @@ void do_x509_tests()
/* Create the CA's key and self-signed cert */
std::cout << '.' << std::flush;
- RSA_PrivateKey ca_key(1024, rng);
+ RSA_PrivateKey ca_key(rng, 1024);
std::cout << '.' << std::flush;
X509_Certificate ca_cert = X509::create_self_signed_cert(ca_opts(),
@@ -103,7 +103,7 @@ void do_x509_tests()
/* Create user #2's key and cert request */
std::cout << '.' << std::flush;
- RSA_PrivateKey user2_key(1024, rng);
+ RSA_PrivateKey user2_key(rng, 1024);
std::cout << '.' << std::flush;
PKCS10_Request user2_req = X509::create_cert_req(req_opts2(),
user2_key,
diff --git a/include/dh.h b/include/dh.h
index 0e28bf73e..17a3fcae1 100644
--- a/include/dh.h
+++ b/include/dh.h
@@ -27,7 +27,7 @@ class BOTAN_DLL DH_PublicKey : public virtual DL_Scheme_PublicKey
DH_PublicKey() {}
DH_PublicKey(const DL_Group&, const BigInt&);
private:
- void X509_load_hook(RandomNumberGenerator&);
+ void X509_load_hook();
};
/*************************************************
diff --git a/include/dl_algo.h b/include/dl_algo.h
index f74deb34f..a8d8d1d51 100644
--- a/include/dl_algo.h
+++ b/include/dl_algo.h
@@ -29,12 +29,12 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
virtual DL_Group::Format group_format() const = 0;
X509_Encoder* x509_encoder() const;
- X509_Decoder* x509_decoder(RandomNumberGenerator&);
+ X509_Decoder* x509_decoder();
protected:
BigInt y;
DL_Group group;
private:
- virtual void X509_load_hook(RandomNumberGenerator&) {}
+ virtual void X509_load_hook() {}
};
/*************************************************
diff --git a/include/dsa.h b/include/dsa.h
index 429d55b7c..59776147b 100644
--- a/include/dsa.h
+++ b/include/dsa.h
@@ -32,7 +32,7 @@ class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key,
protected:
DSA_Core core;
private:
- void X509_load_hook(RandomNumberGenerator&);
+ void X509_load_hook();
};
/*************************************************
diff --git a/include/elgamal.h b/include/elgamal.h
index c85f6986e..feeeb3953 100644
--- a/include/elgamal.h
+++ b/include/elgamal.h
@@ -30,7 +30,7 @@ class BOTAN_DLL ElGamal_PublicKey : public PK_Encrypting_Key,
protected:
ELG_Core core;
private:
- void X509_load_hook(RandomNumberGenerator&);
+ void X509_load_hook();
};
/*************************************************
diff --git a/include/if_algo.h b/include/if_algo.h
index eb94c7dfe..c5da4073e 100644
--- a/include/if_algo.h
+++ b/include/if_algo.h
@@ -26,9 +26,9 @@ class BOTAN_DLL IF_Scheme_PublicKey : public virtual Public_Key
u32bit max_input_bits() const { return (n.bits() - 1); }
X509_Encoder* x509_encoder() const;
- X509_Decoder* x509_decoder(RandomNumberGenerator&);
+ X509_Decoder* x509_decoder();
protected:
- virtual void X509_load_hook(RandomNumberGenerator&);
+ virtual void X509_load_hook();
BigInt n, e;
IF_Core core;
};
diff --git a/include/nr.h b/include/nr.h
index 2dcbccd20..0b68340d6 100644
--- a/include/nr.h
+++ b/include/nr.h
@@ -32,7 +32,7 @@ class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key,
protected:
NR_Core core;
private:
- void X509_load_hook(RandomNumberGenerator&);
+ void X509_load_hook();
};
/*************************************************
diff --git a/include/pk_core.h b/include/pk_core.h
index d28e2315e..585c12ee4 100644
--- a/include/pk_core.h
+++ b/include/pk_core.h
@@ -91,8 +91,10 @@ class BOTAN_DLL ELG_Core
ELG_Core() { op = 0; }
ELG_Core(const ELG_Core&);
+
+ ELG_Core(const DL_Group&, const BigInt&);
ELG_Core(RandomNumberGenerator&, const DL_Group&,
- const BigInt&, const BigInt& = 0);
+ const BigInt&, const BigInt&);
~ELG_Core() { delete op; }
private:
diff --git a/include/pk_keys.h b/include/pk_keys.h
index 3c0951a1a..16109c634 100644
--- a/include/pk_keys.h
+++ b/include/pk_keys.h
@@ -28,10 +28,8 @@ class BOTAN_DLL Public_Key
virtual u32bit message_part_size() const { return 0; }
virtual u32bit max_input_bits() const = 0;
- virtual class X509_Encoder* x509_encoder() const
- { return 0; }
- virtual class X509_Decoder* x509_decoder(RandomNumberGenerator&)
- { return 0; }
+ virtual class X509_Encoder* x509_encoder() const = 0;
+ virtual class X509_Decoder* x509_decoder() = 0;
virtual ~Public_Key() {}
protected:
diff --git a/include/rsa.h b/include/rsa.h
index 7ca8068f9..445902a6f 100644
--- a/include/rsa.h
+++ b/include/rsa.h
@@ -1,6 +1,6 @@
/*************************************************
* RSA Header File *
-* (C) 1999-2007 Jack Lloyd *
+* (C) 1999-2008 Jack Lloyd *
*************************************************/
#ifndef BOTAN_RSA_H__
@@ -48,9 +48,12 @@ class BOTAN_DLL RSA_PrivateKey : public RSA_PublicKey,
bool check_key(RandomNumberGenerator& rng, bool) const;
RSA_PrivateKey() {}
- RSA_PrivateKey(const BigInt&, const BigInt&, const BigInt&,
- const BigInt& = 0, const BigInt& = 0);
- RSA_PrivateKey(u32bit, RandomNumberGenerator&, u32bit = 65537);
+
+ RSA_PrivateKey(RandomNumberGenerator&,
+ const BigInt& p, const BigInt& q, const BigInt& e,
+ const BigInt& d = 0, const BigInt& n = 0);
+
+ RSA_PrivateKey(RandomNumberGenerator&, u32bit bits, u32bit = 65537);
private:
BigInt private_op(const byte[], u32bit) const;
};
diff --git a/include/rw.h b/include/rw.h
index 2cc2fb6a4..d9f95eaa9 100644
--- a/include/rw.h
+++ b/include/rw.h
@@ -41,9 +41,12 @@ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
bool check_key(RandomNumberGenerator& rng, bool) const;
RW_PrivateKey() {}
- RW_PrivateKey(const BigInt&, const BigInt&, const BigInt&,
+
+ RW_PrivateKey(RandomNumberGenerator&,
+ const BigInt&, const BigInt&, const BigInt&,
const BigInt& = 0, const BigInt& = 0);
- RW_PrivateKey(u32bit, RandomNumberGenerator& rng, u32bit = 2);
+
+ RW_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit = 2);
};
}
diff --git a/src/dh.cpp b/src/dh.cpp
index 159eb0629..8d2059936 100644
--- a/src/dh.cpp
+++ b/src/dh.cpp
@@ -5,7 +5,6 @@
#include <botan/dh.h>
#include <botan/numthry.h>
-#include <botan/libstate.h>
#include <botan/util.h>
namespace Botan {
@@ -17,15 +16,14 @@ DH_PublicKey::DH_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void DH_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
+void DH_PublicKey::X509_load_hook()
{
- load_check(rng);
}
/*************************************************
diff --git a/src/dl_algo.cpp b/src/dl_algo.cpp
index 7fc364389..2b59a334e 100644
--- a/src/dl_algo.cpp
+++ b/src/dl_algo.cpp
@@ -7,7 +7,6 @@
#include <botan/numthry.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -43,7 +42,7 @@ X509_Encoder* DL_Scheme_PublicKey::x509_encoder() const
/*************************************************
* Return the X.509 public key decoder *
*************************************************/
-X509_Decoder* DL_Scheme_PublicKey::x509_decoder(RandomNumberGenerator& rng)
+X509_Decoder* DL_Scheme_PublicKey::x509_decoder()
{
class DL_Scheme_Decoder : public X509_Decoder
{
@@ -57,18 +56,15 @@ X509_Decoder* DL_Scheme_PublicKey::x509_decoder(RandomNumberGenerator& rng)
void key_bits(const MemoryRegion<byte>& bits)
{
BER_Decoder(bits).decode(key->y);
- key->X509_load_hook(rng);
+ key->X509_load_hook();
}
- DL_Scheme_Decoder(DL_Scheme_PublicKey* k,
- RandomNumberGenerator& r) :
- key(k), rng(r) {}
+ DL_Scheme_Decoder(DL_Scheme_PublicKey* k) : key(k) {}
private:
DL_Scheme_PublicKey* key;
- RandomNumberGenerator& rng;
};
- return new DL_Scheme_Decoder(this, rng);
+ return new DL_Scheme_Decoder(this);
}
/*************************************************
diff --git a/src/dsa.cpp b/src/dsa.cpp
index 8ca2f7db5..a7eb8e789 100644
--- a/src/dsa.cpp
+++ b/src/dsa.cpp
@@ -6,7 +6,6 @@
#include <botan/dsa.h>
#include <botan/numthry.h>
#include <botan/keypair.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -17,16 +16,15 @@ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void DSA_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
+void DSA_PublicKey::X509_load_hook()
{
core = DSA_Core(group, y);
- load_check(rng);
}
/*************************************************
diff --git a/src/elgamal.cpp b/src/elgamal.cpp
index d97a365e7..ea0d581b0 100644
--- a/src/elgamal.cpp
+++ b/src/elgamal.cpp
@@ -7,7 +7,6 @@
#include <botan/numthry.h>
#include <botan/keypair.h>
#include <botan/util.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -18,16 +17,15 @@ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void ElGamal_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
+void ElGamal_PublicKey::X509_load_hook()
{
- core = ELG_Core(rng, group, y);
- load_check(rng);
+ core = ELG_Core(group, y);
}
/*************************************************
diff --git a/src/if_algo.cpp b/src/if_algo.cpp
index 072822f2a..929f488fd 100644
--- a/src/if_algo.cpp
+++ b/src/if_algo.cpp
@@ -7,7 +7,6 @@
#include <botan/numthry.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -46,7 +45,7 @@ X509_Encoder* IF_Scheme_PublicKey::x509_encoder() const
/*************************************************
* Return the X.509 public key decoder *
*************************************************/
-X509_Decoder* IF_Scheme_PublicKey::x509_decoder(RandomNumberGenerator& rng)
+X509_Decoder* IF_Scheme_PublicKey::x509_decoder()
{
class IF_Scheme_Decoder : public X509_Decoder
{
@@ -62,17 +61,15 @@ X509_Decoder* IF_Scheme_PublicKey::x509_decoder(RandomNumberGenerator& rng)
.verify_end()
.end_cons();
- key->X509_load_hook(rng);
+ key->X509_load_hook();
}
- IF_Scheme_Decoder(IF_Scheme_PublicKey* k, RandomNumberGenerator& r) :
- key(k), rng(r) {}
+ IF_Scheme_Decoder(IF_Scheme_PublicKey* k) : key(k) {}
private:
IF_Scheme_PublicKey* key;
- RandomNumberGenerator& rng;
};
- return new IF_Scheme_Decoder(this, rng);
+ return new IF_Scheme_Decoder(this);
}
/*************************************************
@@ -160,10 +157,9 @@ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng)
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void IF_Scheme_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
+void IF_Scheme_PublicKey::X509_load_hook()
{
core = IF_Core(e, n);
- load_check(rng);
}
/*************************************************
diff --git a/src/nr.cpp b/src/nr.cpp
index de46abd80..02919d52e 100644
--- a/src/nr.cpp
+++ b/src/nr.cpp
@@ -6,7 +6,6 @@
#include <botan/nr.h>
#include <botan/numthry.h>
#include <botan/keypair.h>
-#include <botan/libstate.h>
namespace Botan {
@@ -17,16 +16,15 @@ NR_PublicKey::NR_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
* Algorithm Specific X.509 Initialization Code *
*************************************************/
-void NR_PublicKey::X509_load_hook(RandomNumberGenerator& rng)
+void NR_PublicKey::X509_load_hook()
{
core = NR_Core(group, y);
- load_check(rng);
}
/*************************************************
diff --git a/src/pk_core.cpp b/src/pk_core.cpp
index 200e5c964..939ad1c1f 100644
--- a/src/pk_core.cpp
+++ b/src/pk_core.cpp
@@ -179,21 +179,27 @@ SecureVector<byte> NR_Core::sign(const byte in[], u32bit length,
/*************************************************
* ELG_Core Constructor *
*************************************************/
+ELG_Core::ELG_Core(const DL_Group& group, const BigInt& y)
+ {
+ op = Engine_Core::elg_op(group, y, 0);
+ p_bytes = 0;
+ }
+
+/*************************************************
+* ELG_Core Constructor *
+*************************************************/
ELG_Core::ELG_Core(RandomNumberGenerator& rng,
const DL_Group& group, const BigInt& y, const BigInt& x)
{
op = Engine_Core::elg_op(group, y, x);
- p_bytes = 0;
- if(x != 0)
- {
- const BigInt& p = group.get_p();
- p_bytes = p.bytes();
+ const BigInt& p = group.get_p();
+ p_bytes = p.bytes();
+ if(BLINDING_BITS)
+ {
BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
-
- if(k != 0)
- blinder = Blinder(k, power_mod(k, x, p), p);
+ blinder = Blinder(k, power_mod(k, x, p), p);
}
}
diff --git a/src/rsa.cpp b/src/rsa.cpp
index 07b2e4da9..65eb0af1f 100644
--- a/src/rsa.cpp
+++ b/src/rsa.cpp
@@ -1,6 +1,6 @@
/*************************************************
* RSA Source File *
-* (C) 1999-2007 Jack Lloyd *
+* (C) 1999-2008 Jack Lloyd *
*************************************************/
#include <botan/rsa.h>
@@ -18,7 +18,7 @@ RSA_PublicKey::RSA_PublicKey(const BigInt& mod, const BigInt& exp)
{
n = mod;
e = exp;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
@@ -53,8 +53,8 @@ SecureVector<byte> RSA_PublicKey::verify(const byte in[], u32bit len) const
/*************************************************
* Create a RSA private key *
*************************************************/
-RSA_PrivateKey::RSA_PrivateKey(u32bit bits, RandomNumberGenerator& rng,
- u32bit exp)
+RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
+ u32bit bits, u32bit exp)
{
if(bits < 1024)
throw Invalid_Argument(algo_name() + ": Can't make a key that is only " +
@@ -76,7 +76,8 @@ RSA_PrivateKey::RSA_PrivateKey(u32bit bits, RandomNumberGenerator& rng,
/*************************************************
* RSA_PrivateKey Constructor *
*************************************************/
-RSA_PrivateKey::RSA_PrivateKey(const BigInt& prime1, const BigInt& prime2,
+RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng,
+ const BigInt& prime1, const BigInt& prime2,
const BigInt& exp, const BigInt& d_exp,
const BigInt& mod)
{
@@ -89,7 +90,7 @@ RSA_PrivateKey::RSA_PrivateKey(const BigInt& prime1, const BigInt& prime2,
if(d == 0)
d = inverse_mod(e, lcm(p - 1, q - 1));
- PKCS8_load_hook(global_state().prng_reference());
+ PKCS8_load_hook(rng);
}
/*************************************************
diff --git a/src/rw.cpp b/src/rw.cpp
index cf0ca72ba..4cbed6097 100644
--- a/src/rw.cpp
+++ b/src/rw.cpp
@@ -1,13 +1,12 @@
/*************************************************
* Rabin-Williams Source File *
-* (C) 1999-2007 Jack Lloyd *
+* (C) 1999-2008 Jack Lloyd *
*************************************************/
#include <botan/rw.h>
#include <botan/numthry.h>
#include <botan/keypair.h>
#include <botan/parsing.h>
-#include <botan/libstate.h>
#include <algorithm>
namespace Botan {
@@ -19,7 +18,7 @@ RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp)
{
n = mod;
e = exp;
- X509_load_hook(global_state().prng_reference());
+ X509_load_hook();
}
/*************************************************
@@ -53,8 +52,8 @@ 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,
- u32bit exp)
+RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
+ u32bit bits, u32bit exp)
{
if(bits < 1024)
throw Invalid_Argument(algo_name() + ": Can't make a key that is only " +
@@ -76,7 +75,8 @@ RW_PrivateKey::RW_PrivateKey(u32bit bits, RandomNumberGenerator& rng,
/*************************************************
* RW_PrivateKey Constructor *
*************************************************/
-RW_PrivateKey::RW_PrivateKey(const BigInt& prime1, const BigInt& prime2,
+RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng,
+ const BigInt& prime1, const BigInt& prime2,
const BigInt& exp, const BigInt& d_exp,
const BigInt& mod)
{
@@ -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(global_state().prng_reference());
+ PKCS8_load_hook(rng);
}
/*************************************************
diff --git a/src/x509_key.cpp b/src/x509_key.cpp
index f327aac16..26ce16a72 100644
--- a/src/x509_key.cpp
+++ b/src/x509_key.cpp
@@ -11,7 +11,6 @@
#include <botan/pk_algs.h>
#include <botan/oids.h>
#include <botan/pem.h>
-#include <botan/libstate.h>
#include <memory>
namespace Botan {
@@ -98,8 +97,7 @@ Public_Key* load_key(DataSource& source)
throw Decoding_Error("Unknown PK algorithm/OID: " + alg_name + ", " +
alg_id.oid.as_string());
- std::auto_ptr<X509_Decoder> decoder(
- key_obj->x509_decoder(global_state().prng_reference()));
+ std::auto_ptr<X509_Decoder> decoder(key_obj->x509_decoder());
if(!decoder.get())
throw Decoding_Error("Key does not support X.509 decoding");