diff options
author | lloyd <[email protected]> | 2008-09-30 06:47:38 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 06:47:38 +0000 |
commit | 66869d7e0fcaf120f5c22eee43277fabd00e94fd (patch) | |
tree | 5161b89557a8a8cd8f69ee7459368391872980fb /src/core | |
parent | 33bb3dca54ecef2599b756d27b66781e14d06ae3 (diff) |
Remove lookup.h from X9.31 PRNG, X9.19 MAC, SSLv3 MAC, PBKDF1
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/libstate/def_alg.cpp | 31 | ||||
-rw-r--r-- | src/core/rng.cpp | 2 |
2 files changed, 26 insertions, 7 deletions
diff --git a/src/core/libstate/def_alg.cpp b/src/core/libstate/def_alg.cpp index ea58bd06f..475b56225 100644 --- a/src/core/libstate/def_alg.cpp +++ b/src/core/libstate/def_alg.cpp @@ -538,33 +538,49 @@ Default_Engine::find_mac(const std::string& algo_spec) const return 0; const std::string algo_name = global_state().deref_alias(name[0]); +#if defined(BOTAN_HAS_CBC_MAC) if(algo_name == "CBC-MAC") { if(name.size() == 2) return new CBC_MAC(find_block_cipher(name[1])); throw Invalid_Algorithm_Name(algo_spec); } +#endif +#if defined(BOTAN_HAS_CMAC) if(algo_name == "CMAC") { if(name.size() == 2) return new CMAC(find_block_cipher(name[1])); throw Invalid_Algorithm_Name(algo_spec); } +#endif +#if defined(BOTAN_HAS_HMAC) if(algo_name == "HMAC") { if(name.size() == 2) return new HMAC(find_hash(name[1])); throw Invalid_Algorithm_Name(algo_spec); } +#endif #if defined(BOTAN_HAS_SSL3_MAC) - HANDLE_TYPE_ONE_STRING("SSL3-MAC", SSL3_MAC); + if(algo_name == "SSL3-MAC") + { + if(name.size() == 2) + return new SSL3_MAC(find_hash(name[1])); + throw Invalid_Algorithm_Name(algo_spec); + } #endif #if defined(BOTAN_HAS_ANSI_X919_MAC) - HANDLE_TYPE_NO_ARGS("X9.19-MAC", ANSI_X919_MAC); + if(algo_name == "X9.19-MAC") + { + if(name.size() == 1) + return new ANSI_X919_MAC(find_block_cipher("DES")); + throw Invalid_Algorithm_Name(algo_spec); + } #endif return 0; @@ -581,11 +597,14 @@ S2K* Default_Engine::find_s2k(const std::string& algo_spec) const const std::string algo_name = global_state().deref_alias(name[0]); -#if defined(BOTAN_HAS_PBKDF1) - HANDLE_TYPE_ONE_STRING("PBKDF1", PKCS5_PBKDF1); -#endif + if(algo_name == "PBKDF1") + { + if(name.size() == 2) + return new PKCS5_PBKDF1(find_hash(name[1])); + throw Invalid_Algorithm_Name(algo_spec); + } - if(algo_spec == "PBKDF2") + if(algo_name == "PBKDF2") { if(name.size() == 2) return new PKCS5_PBKDF2(find_mac("HMAC(" + name[1] + ")")); diff --git a/src/core/rng.cpp b/src/core/rng.cpp index 37b03684c..16c87f563 100644 --- a/src/core/rng.cpp +++ b/src/core/rng.cpp @@ -87,7 +87,7 @@ RandomNumberGenerator* RandomNumberGenerator::make_rng() get_mac("HMAC(SHA-256)")); #if defined(BOTAN_HAS_X931_RNG) - rng = new ANSI_X931_RNG("AES-256", rng); + rng = new ANSI_X931_RNG(get_block_cipher("AES-256"), rng); #endif #if defined(BOTAN_HAS_TIMER_HARDWARE) |