From c967179d47e361cd872bcde6fc6c3f13e2493741 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 30 Sep 2008 15:52:44 +0000 Subject: Correctly handle Randpool enabled but X9.31 not --- src/core/rng.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/rng.cpp b/src/core/rng.cpp index 16c87f563..d4ef37b5e 100644 --- a/src/core/rng.cpp +++ b/src/core/rng.cpp @@ -80,11 +80,13 @@ byte RandomNumberGenerator::next_byte() *************************************************/ RandomNumberGenerator* RandomNumberGenerator::make_rng() { - RandomNumberGenerator* rng = 0; +#if !defined(BOTAN_HAS_RANDPOOL) + return 0; +#else + + RandomNumberGenerator* rng = new Randpool(get_block_cipher("AES-256"), + get_mac("HMAC(SHA-256)")); -#if defined(BOTAN_HAS_RANDPOOL) - rng = new Randpool(get_block_cipher("AES-256"), - get_mac("HMAC(SHA-256)")); #if defined(BOTAN_HAS_X931_RNG) rng = new ANSI_X931_RNG(get_block_cipher("AES-256"), rng); @@ -136,11 +138,10 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() #if defined(BOTAN_HAS_ENTROPY_SRC_FTW) rng->add_entropy_source(new FTW_EntropySource("/proc")); -#endif - #endif return rng; +#endif } } -- cgit v1.2.3