aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-10 19:10:34 +0000
committerlloyd <[email protected]>2008-06-10 19:10:34 +0000
commitb36db2d74992f2ea80329378c32a6321d6a60b26 (patch)
tree426add866dd75f8b3e73e0bde0ae5d936c305662 /checks/pk.cpp
parent54fecdc60438d15f970055bb691e18c6469e1785 (diff)
Change PK_Signer::signature to take a RandomNumberGenerator reference
instead of always using the global PRNG.
Diffstat (limited to 'checks/pk.cpp')
-rw-r--r--checks/pk.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index 8c2231313..90b9e1b5d 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -19,10 +19,6 @@
#include <botan/filters.h>
#include <botan/look_pk.h>
#include <botan/numthry.h>
-
-#include <botan/x931_rng.h>
-#include <botan/randpool.h>
-#include <botan/libstate.h>
using namespace Botan;
#include "common.h"
@@ -165,12 +161,6 @@ u32bit do_pk_validation_tests(const std::string& filename)
std::cout << std::endl;
- global_state().set_prng(new ANSI_X931_RNG("AES-128",
- new Randpool("AES-256",
- "HMAC(SHA-256)")));
- for(u32bit j = 0; j != 2; j++)
- global_state().seed_prng(true, 384);
-
do_pk_keygen_tests();
do_x509_tests();
@@ -229,11 +219,11 @@ void validate_signature(PK_Verifier* v, PK_Signer* s, const std::string& algo,
const std::string& exp, bool& failure)
{
SecureVector<byte> message = decode_hex(input);
- global_state().set_prng(new Fixed_Output_RNG(decode_hex(random)));
SecureVector<byte> expected = decode_hex(exp);
- SecureVector<byte> sig = s->sign_message(message, message.size());
+ Fixed_Output_RNG rng(decode_hex(random));
+ SecureVector<byte> sig = s->sign_message(message, message.size(), rng);
if(sig != expected)
{
@@ -257,12 +247,6 @@ void validate_signature(PK_Verifier* v, PK_Signer* s, const std::string& algo,
failure = true;
}
- global_state().set_prng(new ANSI_X931_RNG("AES-128",
- new Randpool("AES-256",
- "HMAC(SHA-256)")));
- for(u32bit j = 0; j != 2; j++)
- global_state().seed_prng(true, 384);
-
delete v;
delete s;
}