diff options
author | lloyd <[email protected]> | 2008-05-24 18:47:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-05-24 18:47:11 +0000 |
commit | c4bad5476b30811ad51b1edd3bd873864d423c07 (patch) | |
tree | 94679d6cee3a38da1d64b8f5f671986566ac8a18 /src/dl_algo.cpp | |
parent | ebc67ae27481549a152858f24fff4a7a82ad4e51 (diff) |
Avoid using the global RNG in check_key, instead pass a reference.
Update the examples
Diffstat (limited to 'src/dl_algo.cpp')
-rw-r--r-- | src/dl_algo.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dl_algo.cpp b/src/dl_algo.cpp index afefe2df3..e1de143a0 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 { @@ -128,11 +127,12 @@ PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder() /************************************************* * Check Public DL Parameters * *************************************************/ -bool DL_Scheme_PublicKey::check_key(bool strong) const +bool DL_Scheme_PublicKey::check_key(RandomNumberGenerator& rng, + bool strong) const { if(y < 2 || y >= group_p()) return false; - if(!group.verify_group(global_state().prng_reference(), strong)) + if(!group.verify_group(rng, strong)) return false; return true; } @@ -140,14 +140,15 @@ bool DL_Scheme_PublicKey::check_key(bool strong) const /************************************************* * Check DL Scheme Private Parameters * *************************************************/ -bool DL_Scheme_PrivateKey::check_key(bool strong) const +bool DL_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng, + bool strong) const { const BigInt& p = group_p(); const BigInt& g = group_g(); if(y < 2 || y >= p || x < 2 || x >= p) return false; - if(!group.verify_group(global_state().prng_reference(), strong)) + if(!group.verify_group(rng, strong)) return false; if(!strong) |