aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dh/dh.cpp
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2013-12-25 19:57:13 +0000
committerlloyd <lloyd@randombit.net>2013-12-25 19:57:13 +0000
commita4a59c29500bbae02273bfb75ddb8318a449e851 (patch)
tree7779f1c9b2708e55eb0f7ad1d5208753a1966ce1 /src/pubkey/dh/dh.cpp
parent4d2242a5e920ba14e37c69a8962b34d08cd485f6 (diff)
Remove global_rng calls for setting up blinding, instead require a RNG
be passed to the engine. Currently pubkey.cpp just passes along the global_rng but eventually we'll break this API and require a RNG to the constructor.
Diffstat (limited to 'src/pubkey/dh/dh.cpp')
-rw-r--r--src/pubkey/dh/dh.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pubkey/dh/dh.cpp b/src/pubkey/dh/dh.cpp
index 956552c7d..80e690c24 100644
--- a/src/pubkey/dh/dh.cpp
+++ b/src/pubkey/dh/dh.cpp
@@ -7,7 +7,6 @@
#include <botan/dh.h>
#include <botan/numthry.h>
-#include <botan/libstate.h>
#include <botan/internal/workfactor.h>
namespace Botan {
@@ -76,10 +75,11 @@ std::vector<byte> DH_PrivateKey::public_value() const
return DH_PublicKey::public_value();
}
-DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh) :
+DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh,
+ RandomNumberGenerator& rng) :
p(dh.group_p()), powermod_x_p(dh.get_x(), p)
{
- BigInt k(global_state().global_rng(), std::min<size_t>(160, p.bits() - 1));
+ BigInt k(rng, p.bits() - 1);
blinder = Blinder(k, powermod_x_p(inverse_mod(k, p)), p);
}