diff options
author | lloyd <[email protected]> | 2008-11-11 02:29:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-11 02:29:39 +0000 |
commit | 686f1b30a4a7be70697644a071d50973a547f58e (patch) | |
tree | b646ebda7d30ba41b505a804e9f58ea6253728ad /src/math/numbertheory | |
parent | 788e47caeff1588bec4a36f4644574b95eda1a7c (diff) |
Bubble up use of global algo factory out of DSA parameter gen to DL_Group
Diffstat (limited to 'src/math/numbertheory')
-rw-r--r-- | src/math/numbertheory/dsa_gen.cpp | 8 | ||||
-rw-r--r-- | src/math/numbertheory/numthry.h | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/math/numbertheory/dsa_gen.cpp b/src/math/numbertheory/dsa_gen.cpp index 6f4a7cefa..1e44b7148 100644 --- a/src/math/numbertheory/dsa_gen.cpp +++ b/src/math/numbertheory/dsa_gen.cpp @@ -4,7 +4,7 @@ *************************************************/ #include <botan/numthry.h> -#include <botan/libstate.h> +#include <botan/algo_factory.h> #include <botan/hash.h> #include <botan/parsing.h> #include <algorithm> @@ -37,6 +37,7 @@ bool fips186_3_valid_size(u32bit pbits, u32bit qbits) * Attempt DSA prime generation with given seed * *************************************************/ bool generate_dsa_primes(RandomNumberGenerator& rng, + Algorithm_Factory& af, BigInt& p, BigInt& q, u32bit pbits, u32bit qbits, const MemoryRegion<byte>& seed_c) @@ -51,8 +52,6 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, "Generating a DSA parameter set with a " + to_string(qbits) + "long q requires a seed at least as many bits long"); - Algorithm_Factory& af = global_state().algo_factory(); - std::auto_ptr<HashFunction> hash( af.make_hash_function("SHA-" + to_string(qbits))); @@ -116,6 +115,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, * Generate DSA Primes * *************************************************/ SecureVector<byte> generate_dsa_primes(RandomNumberGenerator& rng, + Algorithm_Factory& af, BigInt& p, BigInt& q, u32bit pbits, u32bit qbits) { @@ -125,7 +125,7 @@ SecureVector<byte> generate_dsa_primes(RandomNumberGenerator& rng, { rng.randomize(seed, seed.size()); - if(generate_dsa_primes(rng, p, q, pbits, qbits, seed)) + if(generate_dsa_primes(rng, af, p, q, pbits, qbits, seed)) return seed; } } diff --git a/src/math/numbertheory/numthry.h b/src/math/numbertheory/numthry.h index 19726646a..78910d063 100644 --- a/src/math/numbertheory/numthry.h +++ b/src/math/numbertheory/numthry.h @@ -74,13 +74,17 @@ BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator&, /************************************************* * DSA Parameter Generation * *************************************************/ +class Algorithm_Factory; + SecureVector<byte> BOTAN_DLL generate_dsa_primes(RandomNumberGenerator& rng, + Algorithm_Factory& af, BigInt& p, BigInt& q, u32bit pbits, u32bit qbits); bool BOTAN_DLL generate_dsa_primes(RandomNumberGenerator& rng, + Algorithm_Factory& af, BigInt& p_out, BigInt& q_out, u32bit p_bits, u32bit q_bits, const MemoryRegion<byte>& seed); |