aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-10 18:14:54 +0000
committerlloyd <[email protected]>2008-06-10 18:14:54 +0000
commit54fecdc60438d15f970055bb691e18c6469e1785 (patch)
tree1bd44b39489876256adf3d9a0f4ae88e88cfc9d5 /src/pubkey.cpp
parentdec416d649715617e0eb66b18d69f6dbe9c308b3 (diff)
PK_Encryptor::encrypt now takes a RandomNumberGenerator reference, instead
of using the global RNG object.
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r--src/pubkey.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index dc14c66b7..80f49fcad 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -18,17 +18,19 @@ namespace Botan {
/*************************************************
* Encrypt a message *
*************************************************/
-SecureVector<byte> PK_Encryptor::encrypt(const byte in[], u32bit len) const
+SecureVector<byte> PK_Encryptor::encrypt(const byte in[], u32bit len,
+ RandomNumberGenerator& rng) const
{
- return enc(in, len);
+ return enc(in, len, rng);
}
/*************************************************
* Encrypt a message *
*************************************************/
-SecureVector<byte> PK_Encryptor::encrypt(const MemoryRegion<byte>& in) const
+SecureVector<byte> PK_Encryptor::encrypt(const MemoryRegion<byte>& in,
+ RandomNumberGenerator& rng) const
{
- return enc(in.begin(), in.size());
+ return enc(in.begin(), in.size(), rng);
}
/*************************************************
@@ -59,11 +61,11 @@ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const PK_Encrypting_Key& k,
/*************************************************
* Encrypt a message *
*************************************************/
-SecureVector<byte> PK_Encryptor_MR_with_EME::enc(const byte msg[],
- u32bit length) const
+SecureVector<byte>
+PK_Encryptor_MR_with_EME::enc(const byte msg[],
+ u32bit length,
+ RandomNumberGenerator& rng) const
{
- RandomNumberGenerator& rng = global_state().prng_reference();
-
SecureVector<byte> message;
if(encoder)
message = encoder->encode(msg, length, key.max_input_bits(), rng);