From df8691c753ad17d364c868f9b34a56a1f52bb9cf Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 24 May 2008 19:02:31 +0000 Subject: Keypair::check_key no longer references global PRNG --- src/keypair.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/keypair.cpp') 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 #include -#include #include 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 dec(decryptor); SecureVector message(enc->maximum_input_size() - 1); - global_state().randomize(message, message.size()); + rng.randomize(message, message.size()); SecureVector 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 sig(signer); std::auto_ptr ver(verifier); SecureVector message(16); - global_state().randomize(message, message.size()); + rng.randomize(message, message.size()); SecureVector signature; -- cgit v1.2.3