aboutsummaryrefslogtreecommitdiffstats
path: root/src/rng/auto_rng/auto_rng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rng/auto_rng/auto_rng.cpp')
-rw-r--r--src/rng/auto_rng/auto_rng.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/rng/auto_rng/auto_rng.cpp b/src/rng/auto_rng/auto_rng.cpp
index 5befc9d14..78a7ca21d 100644
--- a/src/rng/auto_rng/auto_rng.cpp
+++ b/src/rng/auto_rng/auto_rng.cpp
@@ -6,10 +6,8 @@
*/
#include <botan/auto_rng.h>
+#include <botan/libstate.h>
#include <botan/parsing.h>
-#include <botan/hmac.h>
-#include <botan/sha2_32.h>
-#include <botan/sha2_64.h>
#if defined(BOTAN_HAS_RANDPOOL)
#include <botan/randpool.h>
@@ -23,10 +21,6 @@
#include <botan/x931_rng.h>
#endif
-#if defined(BOTAN_HAS_AES)
- #include <botan/aes.h>
-#endif
-
#if defined(BOTAN_HAS_ENTROPY_SRC_HIGH_RESOLUTION_TIMER)
#include <botan/internal/hres_timer.h>
#endif
@@ -115,10 +109,18 @@ AutoSeeded_RNG::AutoSeeded_RNG(u32bit poll_bits)
{
rng = 0;
+ Algorithm_Factory& af = global_state().algorithm_factory();
+
#if defined(BOTAN_HAS_HMAC_RNG)
- rng = new HMAC_RNG(new HMAC(new SHA_512), new HMAC(new SHA_256));
+
+ rng = new HMAC_RNG(af.make_mac("HMAC(SHA-512)"),
+ af.make_mac("HMAC(SHA-256)"));
+
#elif defined(BOTAN_HAS_RANDPOOL) && defined(BOTAN_HAS_AES)
- rng = new Randpool(new AES_256, new HMAC(new SHA_256));
+
+ rng = new Randpool(af.make_block_cipher("AES-256"),
+ af.make_mac("HMAC(SHA-256)"));
+
#endif
if(!rng)
@@ -126,7 +128,9 @@ AutoSeeded_RNG::AutoSeeded_RNG(u32bit poll_bits)
/* If X9.31 is available, use it to wrap the other RNG as a failsafe */
#if defined(BOTAN_HAS_X931_RNG) && defined(BOTAN_HAS_AES)
- rng = new ANSI_X931_RNG(new AES_256, rng);
+
+ rng = new ANSI_X931_RNG(af.make_block_cipher("AES-256"), rng);
+
#endif
add_entropy_sources(rng);