aboutsummaryrefslogtreecommitdiffstats
path: root/checks
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
parent54fecdc60438d15f970055bb691e18c6469e1785 (diff)
Change PK_Signer::signature to take a RandomNumberGenerator reference
instead of always using the global PRNG.
Diffstat (limited to 'checks')
-rw-r--r--checks/pk.cpp20
-rw-r--r--checks/pk_bench.cpp6
2 files changed, 5 insertions, 21 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;
}
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index c34827258..e6ab90153 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -295,7 +295,7 @@ void bench_sig(PK_Signer* sig, const std::string& algo_name,
global_state().randomize(msg, MSG_SIZE);
u64bit start = get_clock();
sig->update(msg, MSG_SIZE);
- sig->signature();
+ sig->signature(global_state().prng_reference());
clocks_used += get_clock() - start;
}
@@ -313,7 +313,7 @@ void bench_ver(PK_Signer* sig, PK_Verifier* ver,
global_state().randomize(msg, MSG_SIZE);
sig->update(msg, MSG_SIZE);
- SecureVector<byte> signature = sig->signature();
+ SecureVector<byte> signature = sig->signature(global_state().prng_reference());
u32bit runs = 0;
u64bit clocks_used = 0;
@@ -325,7 +325,7 @@ void bench_ver(PK_Signer* sig, PK_Verifier* ver,
{
global_state().randomize(msg, MSG_SIZE);
sig->update(msg, MSG_SIZE);
- signature = sig->signature();
+ signature = sig->signature(global_state().prng_reference());
}
runs++;