diff options
author | lloyd <[email protected]> | 2008-09-30 15:57:43 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 15:57:43 +0000 |
commit | 6230bfc6102da58416ef46b0d8df4f700ec8513b (patch) | |
tree | f58b0711116758d08dad2c243bc6d5830eedbb06 /src/core/rng.cpp | |
parent | 21b7f7d0ed6ae166236264df4a85b3277e780ae5 (diff) |
Have RNG::make_rng throw an exception rather than return NULL
Diffstat (limited to 'src/core/rng.cpp')
-rw-r--r-- | src/core/rng.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/rng.cpp b/src/core/rng.cpp index d4ef37b5e..3790f3c4e 100644 --- a/src/core/rng.cpp +++ b/src/core/rng.cpp @@ -80,14 +80,14 @@ byte RandomNumberGenerator::next_byte() *************************************************/ RandomNumberGenerator* RandomNumberGenerator::make_rng() { -#if !defined(BOTAN_HAS_RANDPOOL) - return 0; -#else +#if defined(BOTAN_HAS_RANDPOOL) + /* Randpool is required for make_rng to work */ RandomNumberGenerator* rng = new Randpool(get_block_cipher("AES-256"), get_mac("HMAC(SHA-256)")); + /* If X9.31 is available, wrap the Randpool algorithm in it */ #if defined(BOTAN_HAS_X931_RNG) rng = new ANSI_X931_RNG(get_block_cipher("AES-256"), rng); #endif @@ -142,6 +142,8 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() return rng; #endif + + throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG object available"); } } |