diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dl_algo.cpp | 11 | ||||
-rw-r--r-- | src/dsa.cpp | 4 | ||||
-rw-r--r-- | src/elgamal.cpp | 4 | ||||
-rw-r--r-- | src/filter.cpp | 1 | ||||
-rw-r--r-- | src/if_algo.cpp | 9 | ||||
-rw-r--r-- | src/nr.cpp | 4 | ||||
-rw-r--r-- | src/numthry.cpp | 1 | ||||
-rw-r--r-- | src/pk_keys.cpp | 10 | ||||
-rw-r--r-- | src/rsa.cpp | 4 | ||||
-rw-r--r-- | src/rw.cpp | 4 | ||||
-rw-r--r-- | src/ui.cpp | 1 |
11 files changed, 27 insertions, 26 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) diff --git a/src/dsa.cpp b/src/dsa.cpp index 13ab67374..e22d9bd88 100644 --- a/src/dsa.cpp +++ b/src/dsa.cpp @@ -112,9 +112,9 @@ SecureVector<byte> DSA_PrivateKey::sign(const byte in[], u32bit length) const /************************************************* * Check Private DSA Parameters * *************************************************/ -bool DSA_PrivateKey::check_key(bool strong) const +bool DSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { - if(!DL_Scheme_PrivateKey::check_key(strong) || x >= group_q()) + if(!DL_Scheme_PrivateKey::check_key(rng, strong) || x >= group_q()) return false; if(!strong) diff --git a/src/elgamal.cpp b/src/elgamal.cpp index bcb8a6cc0..95062cc53 100644 --- a/src/elgamal.cpp +++ b/src/elgamal.cpp @@ -104,9 +104,9 @@ SecureVector<byte> ElGamal_PrivateKey::decrypt(const byte in[], /************************************************* * Check Private ElGamal Parameters * *************************************************/ -bool ElGamal_PrivateKey::check_key(bool strong) const +bool ElGamal_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { - if(!DL_Scheme_PrivateKey::check_key(strong)) + if(!DL_Scheme_PrivateKey::check_key(rng, strong)) return false; if(!strong) diff --git a/src/filter.cpp b/src/filter.cpp index a5bc2dea1..253f20c32 100644 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -5,7 +5,6 @@ #include <botan/filter.h> #include <botan/secqueue.h> -#include <botan/libstate.h> namespace Botan { diff --git a/src/if_algo.cpp b/src/if_algo.cpp index b8d8071f4..dfb41f177 100644 --- a/src/if_algo.cpp +++ b/src/if_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 { @@ -183,7 +182,7 @@ void IF_Scheme_PrivateKey::PKCS8_load_hook(bool generated) /************************************************* * Check IF Scheme Public Parameters * *************************************************/ -bool IF_Scheme_PublicKey::check_key(bool) const +bool IF_Scheme_PublicKey::check_key(RandomNumberGenerator&, bool) const { if(n < 35 || n.is_even() || e < 2) return false; @@ -193,7 +192,8 @@ bool IF_Scheme_PublicKey::check_key(bool) const /************************************************* * Check IF Scheme Private Parameters * *************************************************/ -bool IF_Scheme_PrivateKey::check_key(bool strong) const +bool IF_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng, + bool strong) const { if(n < 35 || n.is_even() || e < 2 || d < 2 || p < 3 || q < 3 || p*q != n) return false; @@ -203,8 +203,7 @@ 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, global_state().prng_reference()) || - !check_prime(q, global_state().prng_reference())) + if(!check_prime(p, rng) || !check_prime(q, rng)) return false; return true; } diff --git a/src/nr.cpp b/src/nr.cpp index 0f911daac..53beb4056 100644 --- a/src/nr.cpp +++ b/src/nr.cpp @@ -111,9 +111,9 @@ SecureVector<byte> NR_PrivateKey::sign(const byte in[], u32bit length) const /************************************************* * Check Private Nyberg-Rueppel Parameters * *************************************************/ -bool NR_PrivateKey::check_key(bool strong) const +bool NR_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { - if(!DL_Scheme_PrivateKey::check_key(strong) || x >= group_q()) + if(!DL_Scheme_PrivateKey::check_key(rng, strong) || x >= group_q()) return false; if(!strong) diff --git a/src/numthry.cpp b/src/numthry.cpp index f36e2f3fe..49d078f51 100644 --- a/src/numthry.cpp +++ b/src/numthry.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/numthry.h> -#include <botan/libstate.h> #include <algorithm> namespace Botan { diff --git a/src/pk_keys.cpp b/src/pk_keys.cpp index 719c5509d..8ada71133 100644 --- a/src/pk_keys.cpp +++ b/src/pk_keys.cpp @@ -6,6 +6,7 @@ #include <botan/pk_keys.h> #include <botan/config.h> #include <botan/oids.h> +#include <botan/libstate.h> namespace Botan { @@ -43,7 +44,8 @@ OID Public_Key::get_oid() const *************************************************/ void Public_Key::load_check() const { - if(!check_key(key_check_level("public"))) + if(!check_key(global_state().prng_reference(), + key_check_level("public"))) throw Invalid_Argument(algo_name() + ": Invalid public key"); } @@ -52,7 +54,8 @@ void Public_Key::load_check() const *************************************************/ void Private_Key::load_check() const { - if(!check_key(key_check_level("private"))) + if(!check_key(global_state().prng_reference(), + key_check_level("private"))) throw Invalid_Argument(algo_name() + ": Invalid private key"); } @@ -61,7 +64,8 @@ void Private_Key::load_check() const *************************************************/ void Private_Key::gen_check() const { - if(!check_key(key_check_level("private_gen"))) + if(!check_key(global_state().prng_reference(), + key_check_level("private_gen"))) throw Self_Test_Failure(algo_name() + " private key generation failed"); } diff --git a/src/rsa.cpp b/src/rsa.cpp index e438c8b92..75789fc10 100644 --- a/src/rsa.cpp +++ b/src/rsa.cpp @@ -125,9 +125,9 @@ SecureVector<byte> RSA_PrivateKey::sign(const byte in[], u32bit len) const /************************************************* * Check Private RSA Parameters * *************************************************/ -bool RSA_PrivateKey::check_key(bool strong) const +bool RSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { - if(!IF_Scheme_PrivateKey::check_key(strong)) + if(!IF_Scheme_PrivateKey::check_key(rng, strong)) return false; if(!strong) diff --git a/src/rw.cpp b/src/rw.cpp index 425ab83b3..35e3bbf8d 100644 --- a/src/rw.cpp +++ b/src/rw.cpp @@ -115,9 +115,9 @@ SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len) const /************************************************* * Check Private Rabin-Williams Parameters * *************************************************/ -bool RW_PrivateKey::check_key(bool strong) const +bool RW_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { - if(!IF_Scheme_PrivateKey::check_key(strong)) + if(!IF_Scheme_PrivateKey::check_key(rng, strong)) return false; if(!strong) diff --git a/src/ui.cpp b/src/ui.cpp index 197259e3a..fb81ae23c 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/ui.h> -#include <botan/libstate.h> namespace Botan { |