aboutsummaryrefslogtreecommitdiffstats
path: root/src/rng
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-01-27 06:06:59 +0000
committerlloyd <[email protected]>2009-01-27 06:06:59 +0000
commit497e3656c1141098ab76dc0fb7922e9e9d5b6bc8 (patch)
tree70621faf857e67f18a755c915e708b7b713e40f9 /src/rng
parentc055f425107cf20c1b8b7c692d5133509dfad52e (diff)
Major change in RNG semantics: you must call reseed before calling
randomize, or PRNG_Unseeded will be thrown.
Diffstat (limited to 'src/rng')
-rw-r--r--src/rng/hmac_rng/hmac_rng.cpp15
-rw-r--r--src/rng/randpool/randpool.cpp7
-rw-r--r--src/rng/x931_rng/x931_rng.cpp2
3 files changed, 4 insertions, 20 deletions
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp
index 245a4039e..f495dda4d 100644
--- a/src/rng/hmac_rng/hmac_rng.cpp
+++ b/src/rng/hmac_rng/hmac_rng.cpp
@@ -36,19 +36,8 @@ void hmac_prf(MessageAuthenticationCode* prf,
*/
void HMAC_RNG::randomize(byte out[], u32bit length)
{
- /* Attempt to seed if we are currently not seeded, or if the
- counter is greater than 2^20
-
- If HMAC_RNG is wrapped in an X9.31/AES PRNG (the default), this
- means a reseed will be kicked off every 16 MiB of RNG output.
- */
- if(!is_seeded() || counter >= 0x100000)
- {
- reseed(8 * prf->OUTPUT_LENGTH);
-
- if(!is_seeded())
- throw PRNG_Unseeded(name() + " seeding attempt failed");
- }
+ if(!is_seeded())
+ throw PRNG_Unseeded(name());
/*
HMAC KDF as described in E-t-E, using a CTXinfo of "rng"
diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp
index 594916a84..1a111e20e 100644
--- a/src/rng/randpool/randpool.cpp
+++ b/src/rng/randpool/randpool.cpp
@@ -31,12 +31,7 @@ enum RANDPOOL_PRF_TAG {
void Randpool::randomize(byte out[], u32bit length)
{
if(!is_seeded())
- {
- reseed(8 * mac->OUTPUT_LENGTH);
-
- if(!is_seeded())
- throw PRNG_Unseeded(name());
- }
+ throw PRNG_Unseeded(name());
update_buffer();
while(length)
diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp
index b947f525d..4b33f4c5e 100644
--- a/src/rng/x931_rng/x931_rng.cpp
+++ b/src/rng/x931_rng/x931_rng.cpp
@@ -15,7 +15,7 @@ namespace Botan {
void ANSI_X931_RNG::randomize(byte out[], u32bit length)
{
if(!is_seeded())
- reseed(8 * cipher->BLOCK_SIZE);
+ throw PRNG_Unseeded(name());
while(length)
{