diff options
author | lloyd <[email protected]> | 2008-09-28 19:20:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 19:20:33 +0000 |
commit | 9822a701516396b7de4e41339faecd48ff8dc8ff (patch) | |
tree | 719574e03e1fc811530150d3d81486fd3e2cecfb /checks/dolook2.cpp | |
parent | 8534c9a67226ccffe7acbefbf3905aba10e88de3 (diff) |
Allow test suite to build even if RNG or DLIES is missing
Diffstat (limited to 'checks/dolook2.cpp')
-rw-r--r-- | checks/dolook2.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/checks/dolook2.cpp b/checks/dolook2.cpp index 7493f4fe6..ed579ad67 100644 --- a/checks/dolook2.cpp +++ b/checks/dolook2.cpp @@ -6,8 +6,15 @@ #include <botan/lookup.h> #include <botan/look_pk.h> #include <botan/filters.h> -#include <botan/randpool.h> -#include <botan/x931_rng.h> + +#if defined(BOTAN_HAS_RANDPOOL) + #include <botan/randpool.h> +#endif + +#if defined(BOTAN_HAS_X931_RNG) + #include <botan/x931_rng.h> +#endif + #include "common.h" using namespace Botan; @@ -112,6 +119,7 @@ Filter* lookup_rng(const std::string& algname, { RandomNumberGenerator* prng = 0; +#if defined(BOTAN_HAS_X931_RNG) if(algname == "X9.31-RNG(TripleDES)") prng = new ANSI_X931_RNG("TripleDES", new Fixed_Output_RNG(decode_hex(key))); else if(algname == "X9.31-RNG(AES-128)") @@ -120,10 +128,12 @@ Filter* lookup_rng(const std::string& algname, prng = new ANSI_X931_RNG("AES-192", new Fixed_Output_RNG(decode_hex(key))); else if(algname == "X9.31-RNG(AES-256)") prng = new ANSI_X931_RNG("AES-256", new Fixed_Output_RNG(decode_hex(key))); +#endif +#if defined(BOTAN_HAS_X931_RNG) and defined(BOTAN_HAS_RANDPOOL) // these are used for benchmarking: AES-256/SHA-256 matches library // defaults, so benchmark reflects real-world performance (maybe) - else if(algname == "Randpool" || algname == "X9.31-RNG") + if(!prng && (algname == "Randpool" || algname == "X9.31-RNG")) { Randpool* randpool = new Randpool("AES-256", "HMAC(SHA-256)"); randpool->add_entropy(reinterpret_cast<const byte*>(key.c_str()), @@ -134,6 +144,7 @@ Filter* lookup_rng(const std::string& algname, else prng = new ANSI_X931_RNG("AES-256", randpool); } +#endif if(prng) return new RNG_Filter(prng); |