aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng/x931_rng
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-02-13 18:59:49 +0000
committerlloyd <[email protected]>2014-02-13 18:59:49 +0000
commit241499ab648e27961f83c7c9724360657d8cf93b (patch)
tree26f450a27abace2d98aa6ec74ed15e58a42ef157 /src/lib/rng/x931_rng
parentc123180d2cdce837706eeffedc4e6105be0b2a5e (diff)
Change X9.31 to automatically reseed if randomize is called while unseeded.
If no entropy sources at all are enabled in the build, throw an exception immediately rather than having the poll mysteriously fail.
Diffstat (limited to 'src/lib/rng/x931_rng')
-rw-r--r--src/lib/rng/x931_rng/x931_rng.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/rng/x931_rng/x931_rng.cpp b/src/lib/rng/x931_rng/x931_rng.cpp
index dbf09b367..a77ac2ca8 100644
--- a/src/lib/rng/x931_rng/x931_rng.cpp
+++ b/src/lib/rng/x931_rng/x931_rng.cpp
@@ -14,7 +14,12 @@ namespace Botan {
void ANSI_X931_RNG::randomize(byte out[], size_t length)
{
if(!is_seeded())
- throw PRNG_Unseeded(name());
+ {
+ reseed(BOTAN_RNG_RESEED_POLL_BITS);
+
+ if(!is_seeded())
+ throw PRNG_Unseeded(name());
+ }
while(length)
{