The unified diff between revisions [83275766..] and [4e40e885..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/keypair.cpp'
#
#
# patch "src/keypair.cpp"
# from [9cab4fb41529c3ad3477b2c0cc99a21543a67e38]
# to [4f2e835c21a1b15d2a497cf2b80b90ef2724bd86]
#
============================================================
--- src/keypair.cpp 9cab4fb41529c3ad3477b2c0cc99a21543a67e38
+++ src/keypair.cpp 4f2e835c21a1b15d2a497cf2b80b90ef2724bd86
@@ -1,11 +1,11 @@
/*************************************************
* Keypair Checks Source File *
-* (C) 1999-2006 The Botan Project *
+* (C) 1999-2007 Jack Lloyd *
*************************************************/
#include <botan/keypair.h>
#include <botan/look_pk.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
#include <memory>
namespace Botan {
@@ -24,7 +24,7 @@ void check_key(PK_Encryptor* encryptor,
std::auto_ptr<PK_Decryptor> dec(decryptor);
SecureVector<byte> message(enc->maximum_input_size() - 1);
- Global_RNG::randomize(message, message.size());
+ global_state().randomize(message, message.size());
SecureVector<byte> ciphertext = enc->encrypt(message);
if(ciphertext == message)
@@ -44,10 +44,18 @@ void check_key(PK_Signer* signer, PK_Ver
std::auto_ptr<PK_Verifier> ver(verifier);
SecureVector<byte> message(16);
- Global_RNG::randomize(message, message.size());
+ global_state().randomize(message, message.size());
- SecureVector<byte> signature = sig->sign_message(message);
+ SecureVector<byte> signature;
+ try {
+ signature = sig->sign_message(message);
+ }
+ catch(Encoding_Error)
+ {
+ return;
+ }
+
if(!ver->verify_message(message, signature))
throw Self_Test_Failure("Signature key pair consistency failure");