diff options
author | lloyd <[email protected]> | 2008-05-24 18:25:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-05-24 18:25:00 +0000 |
commit | b7563677f13adb8dfa5813ef91ed79364b2d984d (patch) | |
tree | cf7fabb3eb43bc49333be726c15ecac1a7f9a1a7 /src/if_algo.cpp | |
parent | a6a9110d02925e111cff2dc1143a09a3b7680f0b (diff) |
Previously random_integer and friends used the global PRNG object to get
random bits. Now they take a reference to a RandomNumberGenerator object.
This was applied several times out, so now the constructors to private
key objects also take a RandomNumberGenerator& argument. This is also true
for a number of randomized algorithms (Miller-Rabin, for instance).
You can get a reference to the global PRNG with
global_state().prng_reference()
This is a provisional thing: and warning: it is not thread safe! If this
is a problem instead keep per-thread PRNGs and pass them were needed.
Diffstat (limited to 'src/if_algo.cpp')
-rw-r--r-- | src/if_algo.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/if_algo.cpp b/src/if_algo.cpp index 895e049d3..b8d8071f4 100644 --- a/src/if_algo.cpp +++ b/src/if_algo.cpp @@ -7,6 +7,7 @@ #include <botan/numthry.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> +#include <botan/libstate.h> namespace Botan { @@ -202,7 +203,8 @@ bool IF_Scheme_PrivateKey::check_key(bool strong) const if(d1 != d % (p - 1) || d2 != d % (q - 1) || c != inverse_mod(q, p)) return false; - if(!check_prime(p) || !check_prime(q)) + if(!check_prime(p, global_state().prng_reference()) || + !check_prime(q, global_state().prng_reference())) return false; return true; } |