diff options
author | lloyd <[email protected]> | 2008-05-24 19:02:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-05-24 19:02:31 +0000 |
commit | df8691c753ad17d364c868f9b34a56a1f52bb9cf (patch) | |
tree | 2fd98f1fadff870727154a7085e2caa2a5e4b457 /src/keypair.cpp | |
parent | c66c9ad30fc635f25a0564ad8b7722fceda92a73 (diff) |
Keypair::check_key no longer references global PRNG
Diffstat (limited to 'src/keypair.cpp')
-rw-r--r-- | src/keypair.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/keypair.cpp b/src/keypair.cpp index edec0b572..e16656dbc 100644 --- a/src/keypair.cpp +++ b/src/keypair.cpp @@ -5,7 +5,6 @@ #include <botan/keypair.h> #include <botan/look_pk.h> -#include <botan/libstate.h> #include <memory> namespace Botan { @@ -15,7 +14,8 @@ namespace KeyPair { /************************************************* * Check an encryption key pair for consistency * *************************************************/ -void check_key(PK_Encryptor* encryptor, PK_Decryptor* decryptor) +void check_key(RandomNumberGenerator& rng, + PK_Encryptor* encryptor, PK_Decryptor* decryptor) { if(encryptor->maximum_input_size() == 0) return; @@ -24,7 +24,7 @@ void check_key(PK_Encryptor* encryptor, PK_Decryptor* decryptor) std::auto_ptr<PK_Decryptor> dec(decryptor); SecureVector<byte> message(enc->maximum_input_size() - 1); - global_state().randomize(message, message.size()); + rng.randomize(message, message.size()); SecureVector<byte> ciphertext = enc->encrypt(message); if(ciphertext == message) @@ -38,13 +38,14 @@ void check_key(PK_Encryptor* encryptor, PK_Decryptor* decryptor) /************************************************* * Check a signature key pair for consistency * *************************************************/ -void check_key(PK_Signer* signer, PK_Verifier* verifier) +void check_key(RandomNumberGenerator& rng, + PK_Signer* signer, PK_Verifier* verifier) { std::auto_ptr<PK_Signer> sig(signer); std::auto_ptr<PK_Verifier> ver(verifier); SecureVector<byte> message(16); - global_state().randomize(message, message.size()); + rng.randomize(message, message.size()); SecureVector<byte> signature; |