diff options
author | lloyd <[email protected]> | 2010-02-24 02:18:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-24 02:18:55 +0000 |
commit | 6e50979c8d2a0635599228a2ae1a20d59b24a0c6 (patch) | |
tree | 587aaf6c20d45a6fa81ee180ca0aa533f51403d1 /src/rng | |
parent | 888fc3d0f2f6f1dc5e9764e83e9b7fd64da916d8 (diff) | |
parent | 8c951ef2f1e54e1134e8db683662ec881df89c88 (diff) |
propagate from branch 'net.randombit.botan' (head 84baf58b29f3aaaee34e2b873d0040be5a6c4368)
to branch 'net.randombit.botan.gost_3410' (head 63cbe3e357c071d7960bfedc31101eff35895285)
Diffstat (limited to 'src/rng')
-rw-r--r-- | src/rng/auto_rng/auto_rng.cpp | 24 | ||||
-rw-r--r-- | src/rng/hmac_rng/hmac_rng.cpp | 2 | ||||
-rw-r--r-- | src/rng/randpool/randpool.cpp | 2 |
3 files changed, 16 insertions, 12 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); diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 995ec9259..84a7b1c13 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -6,7 +6,7 @@ */ #include <botan/hmac_rng.h> -#include <botan/loadstor.h> +#include <botan/get_byte.h> #include <botan/internal/xor_buf.h> #include <botan/internal/stl_util.h> #include <algorithm> diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index f6479b2dd..9a4d77e55 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -6,7 +6,7 @@ */ #include <botan/randpool.h> -#include <botan/loadstor.h> +#include <botan/get_byte.h> #include <botan/internal/xor_buf.h> #include <botan/internal/stl_util.h> #include <algorithm> |