From 20191a0e123d0098375be099fcce22f6a6415402 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 4 Nov 2010 02:13:29 +0000 Subject: Move PBKDF lookups to engine --- src/libstate/get_enc.cpp | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'src/libstate/get_enc.cpp') diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp index d4ca99535..6a87268e8 100644 --- a/src/libstate/get_enc.cpp +++ b/src/libstate/get_enc.cpp @@ -9,18 +9,6 @@ #include #include -#if defined(BOTAN_HAS_PBKDF1) - #include -#endif - -#if defined(BOTAN_HAS_PBKDF2) - #include -#endif - -#if defined(BOTAN_HAS_PGPS2K) - #include -#endif - #if defined(BOTAN_HAS_MGF1) #include #endif @@ -84,29 +72,10 @@ namespace Botan { */ PBKDF* get_pbkdf(const std::string& algo_spec) { - SCAN_Name request(algo_spec); - Algorithm_Factory& af = global_state().algorithm_factory(); -#if defined(BOTAN_HAS_PBKDF1) - if(request.algo_name() == "PBKDF1" && request.arg_count() == 1) - return new PKCS5_PBKDF1(af.make_hash_function(request.arg(0))); -#endif - -#if defined(BOTAN_HAS_PBKDF2) - if(request.algo_name() == "PBKDF2" && request.arg_count() == 1) - { - if(const MessageAuthenticationCode* mac_proto = af.prototype_mac(request.arg(0))) - return new PKCS5_PBKDF2(mac_proto->clone()); - - return new PKCS5_PBKDF2(af.make_mac("HMAC(" + request.arg(0) + ")")); - } -#endif - -#if defined(BOTAN_HAS_PGPS2K) - if(request.algo_name() == "OpenPGP-S2K" && request.arg_count() == 1) - return new OpenPGP_S2K(af.make_hash_function(request.arg(0))); -#endif + if(PBKDF* pbkdf = af.make_pbkdf(algo_spec)) + return pbkdf; throw Algorithm_Not_Found(algo_spec); } -- cgit v1.2.3