diff options
author | Jack Lloyd <[email protected]> | 2017-02-19 10:20:55 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-02-19 10:20:55 -0500 |
commit | 5b7c0aba50abf70ac081277141aaf375e4d8373d (patch) | |
tree | c386fa3946a17a48ffef41116e15e6e3cb0f2e19 /src/lib/rng | |
parent | 0b56eef10b2d95d4a2e942333b63fb80797d4370 (diff) |
Avoid use of deprecated function in (deprecated) Serialized_RNG constructor
Diffstat (limited to 'src/lib/rng')
-rw-r--r-- | src/lib/rng/rng.cpp | 11 | ||||
-rw-r--r-- | src/lib/rng/rng.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/rng/rng.cpp b/src/lib/rng/rng.cpp index 57e25cdd2..4fa8e42a6 100644 --- a/src/lib/rng/rng.cpp +++ b/src/lib/rng/rng.cpp @@ -58,7 +58,16 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() } #if defined(BOTAN_TARGET_OS_HAS_THREADS) -Serialized_RNG::Serialized_RNG() : m_rng(RandomNumberGenerator::make_rng()) {} + +#if defined(BOTAN_HAS_AUTO_SEEDING_RNG) +Serialized_RNG::Serialized_RNG() : m_rng(new AutoSeeded_RNG) {} +#else +Serialized_RNG::Serialized_RNG() + { + throw Exception("Serialized_RNG default constructor failed: AutoSeeded_RNG disabled in build"); + } +#endif + #endif } diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h index d8d3c855f..09908ab3c 100644 --- a/src/lib/rng/rng.h +++ b/src/lib/rng/rng.h @@ -174,7 +174,8 @@ class BOTAN_DLL RandomNumberGenerator typedef RandomNumberGenerator RNG; /** -* Hardware RNG has no members but exists to tag hardware RNG types +* Hardware_RNG has no members but exists to tag hardware RNG types +* (PKCS11_RNG, TPM_RNG, RDRAND_RNG) */ class BOTAN_DLL Hardware_RNG : public RandomNumberGenerator { |