aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-04-10 05:52:37 +0000
committerlloyd <[email protected]>2008-04-10 05:52:37 +0000
commitf15ca39257de8983babb95f7f5d589a4e555a864 (patch)
tree3f41f5e38cc5d07e3241db716d582fa146a4ac3d /checks
parent59e71322cad61ff2f09664fc3e59b5446af4566a (diff)
parent9ec64ce60cad6c825b7cf40306a359d019e2c13c (diff)
propagate from branch 'net.randombit.botan' (head 6afe2db1f710f75bc27e189bb8bdb23613ce1ca3)
to branch 'net.randombit.botan.remove-libstate' (head e40f0dbdfd847024c30fa0092c2acefc19a550b8)
Diffstat (limited to 'checks')
-rw-r--r--checks/bench.cpp4
-rw-r--r--checks/bigint.cpp4
-rw-r--r--checks/dolook2.cpp4
-rw-r--r--checks/pk.cpp8
-rw-r--r--checks/pk_bench.cpp16
-rw-r--r--checks/validate.cpp4
6 files changed, 20 insertions, 20 deletions
diff --git a/checks/bench.cpp b/checks/bench.cpp
index 089b229f2..48db9d8cf 100644
--- a/checks/bench.cpp
+++ b/checks/bench.cpp
@@ -5,7 +5,7 @@
#include <string>
#include <exception>
-#include <botan/rng.h>
+#include <botan/libstate.h>
#include <botan/filters.h>
using namespace Botan_types;
using Botan::u64bit;
@@ -31,7 +31,7 @@ double bench_filter(std::string name, Botan::Filter* filter,
static const u32bit BUFFERSIZE = 32*1024;
byte buf[BUFFERSIZE];
- Botan::Global_RNG::randomize(buf, BUFFERSIZE);
+ Botan::global_state().randomize(buf, BUFFERSIZE);
u32bit iterations = 0;
u64bit start = get_clock(), clocks_used = 0;
diff --git a/checks/bigint.cpp b/checks/bigint.cpp
index e4fec12b4..6a4d5ac94 100644
--- a/checks/bigint.cpp
+++ b/checks/bigint.cpp
@@ -7,7 +7,7 @@
#include <botan/bigint.h>
#include <botan/exceptn.h>
#include <botan/numthry.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
using namespace Botan;
#include "common.h"
@@ -264,7 +264,7 @@ u32bit check_mod(const std::vector<std::string>& args)
/* Won't work for us, just pick one at random */
while(b_word == 0)
for(u32bit j = 0; j != 2*sizeof(word); j++)
- b_word = (b_word << 4) ^ Global_RNG::random();
+ b_word = (b_word << 4) ^ global_state().random();
b = b_word;
diff --git a/checks/dolook2.cpp b/checks/dolook2.cpp
index b6c9ba339..b49d48a5e 100644
--- a/checks/dolook2.cpp
+++ b/checks/dolook2.cpp
@@ -8,7 +8,7 @@
#include <botan/filters.h>
#include <botan/randpool.h>
#include <botan/x931_rng.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
using namespace Botan;
/* A weird little hack to fit S2K algorithms into the validation suite
@@ -49,7 +49,7 @@ class RNG_Filter : public Filter
void write(const byte[], u32bit);
RNG_Filter(RandomNumberGenerator* r) : rng(r), buffer(1024)
{
- Global_RNG::randomize(buffer, buffer.size());
+ global_state().randomize(buffer, buffer.size());
rng->add_entropy(buffer, buffer.size());
}
~RNG_Filter() { delete rng; }
diff --git a/checks/pk.cpp b/checks/pk.cpp
index f2c2401fd..afd8d61e4 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -21,7 +21,7 @@
#include <botan/numthry.h>
#include <botan/x931_rng.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
using namespace Botan;
#include "common.h"
@@ -194,7 +194,7 @@ u32bit do_pk_validation_tests(const std::string& filename)
global_state().set_prng(new ANSI_X931_RNG);
for(u32bit j = 0; j != 2; j++)
- Global_RNG::seed(true, 384);
+ global_state().seed_prng(true, 384);
do_pk_keygen_tests();
do_x509_tests();
@@ -249,7 +249,7 @@ void validate_encryption(PK_Encryptor* e, PK_Decryptor* d,
global_state().set_prng(new ANSI_X931_RNG);
for(u32bit j = 0; j != 2; j++)
- Global_RNG::seed(true, 384);
+ global_state().seed_prng(true, 384);
validate_decryption(d, algo, out, message, failure);
delete e;
@@ -290,7 +290,7 @@ void validate_signature(PK_Verifier* v, PK_Signer* s, const std::string& algo,
global_state().set_prng(new ANSI_X931_RNG);
for(u32bit j = 0; j != 2; j++)
- Global_RNG::seed(true, 384);
+ global_state().seed_prng(true, 384);
delete v;
delete s;
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index c06f12abf..51a454f4a 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -8,7 +8,7 @@
#include <botan/pkcs8.h>
#include <botan/look_pk.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
using namespace Botan;
@@ -219,7 +219,7 @@ void bench_enc(PK_Encryptor* enc, const std::string& algo_name,
while(clocks_used < seconds * ticks)
{
runs++;
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
u64bit start = get_clock();
enc->encrypt(msg, MSG_SIZE);
@@ -237,7 +237,7 @@ void bench_dec(PK_Encryptor* enc, PK_Decryptor* dec,
{
static const u32bit MSG_SIZE = 16;
byte msg[MSG_SIZE];
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
SecureVector<byte> output;
u32bit runs = 0;
@@ -250,7 +250,7 @@ void bench_dec(PK_Encryptor* enc, PK_Decryptor* dec,
{
runs++;
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
msg[0] |= 0x80; // make sure it works with "Raw" padding
encrypted_msg = enc->encrypt(msg, MSG_SIZE);
@@ -286,7 +286,7 @@ void bench_sig(PK_Signer* sig, const std::string& algo_name,
while(clocks_used < seconds * ticks)
{
runs++;
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
u64bit start = get_clock();
sig->update(msg, MSG_SIZE);
sig->signature();
@@ -304,7 +304,7 @@ void bench_ver(PK_Signer* sig, PK_Verifier* ver,
{
static const u32bit MSG_SIZE = 16;
byte msg[MSG_SIZE];
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
sig->update(msg, MSG_SIZE);
SecureVector<byte> signature = sig->signature();
@@ -317,7 +317,7 @@ void bench_ver(PK_Signer* sig, PK_Verifier* ver,
// feel free to tweak, but make sure this always runs when runs == 0
if(runs % 100 == 0)
{
- Global_RNG::randomize(msg, MSG_SIZE);
+ global_state().randomize(msg, MSG_SIZE);
sig->update(msg, MSG_SIZE);
signature = sig->signature();
}
@@ -352,7 +352,7 @@ void bench_kas(PK_Key_Agreement* kas, const std::string& algo_name,
while(clocks_used < seconds * ticks)
{
runs++;
- Global_RNG::randomize(key, REMOTE_KEY_SIZE);
+ global_state().randomize(key, REMOTE_KEY_SIZE);
u64bit start = get_clock();
kas->derive_key(0, key, REMOTE_KEY_SIZE);
diff --git a/checks/validate.cpp b/checks/validate.cpp
index d634d3bb3..269b353a4 100644
--- a/checks/validate.cpp
+++ b/checks/validate.cpp
@@ -10,7 +10,7 @@
#include <botan/filters.h>
#include <botan/exceptn.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
using namespace Botan_types;
#define EXTRA_TESTS 0
@@ -31,7 +31,7 @@ u32bit random_word(u32bit max)
/* normal version */
u32bit r = 0;
for(u32bit j = 0; j != 4; j++)
- r = (r << 8) | Botan::Global_RNG::random();
+ r = (r << 8) | Botan::global_state().random();
return ((r % max) + 1); // return between 1 and max inclusive
#endif
}