diff options
author | Ed Baak <ed.baak@nokia.com> | 2010-07-26 14:06:13 +1000 |
---|---|---|
committer | Ed Baak <ed.baak@nokia.com> | 2010-07-26 14:06:13 +1000 |
commit | 02e9b6740ff7851b52ab677800e94fb77e6092ed (patch) | |
tree | a38a4f4d44b53a95b5db40e5ec12b513b5896e06 /botan/src/engine/def_engine/lookup_mac.cpp | |
parent | eb2fbe409d1423c0b707b9986ee1e56fa19b355a (diff) |
Included Botan and ssh code to make QtUItest compile again (as a separate package without creator). Note that this is a temporary hack and will go away when we moveQtUItest into creator.
Diffstat (limited to 'botan/src/engine/def_engine/lookup_mac.cpp')
-rw-r--r-- | botan/src/engine/def_engine/lookup_mac.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/botan/src/engine/def_engine/lookup_mac.cpp b/botan/src/engine/def_engine/lookup_mac.cpp new file mode 100644 index 0000000..3fef12b --- /dev/null +++ b/botan/src/engine/def_engine/lookup_mac.cpp @@ -0,0 +1,70 @@ +/* +* MAC Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/def_eng.h> +#include <botan/scan_name.h> +#include <botan/algo_factory.h> + +#if defined(BOTAN_HAS_CBC_MAC) + #include <botan/cbc_mac.h> +#endif + +#if defined(BOTAN_HAS_CMAC) + #include <botan/cmac.h> +#endif + +#if defined(BOTAN_HAS_HMAC) + #include <botan/hmac.h> +#endif + +#if defined(BOTAN_HAS_SSL3_MAC) + #include <botan/ssl3_mac.h> +#endif + +#if defined(BOTAN_HAS_ANSI_X919_MAC) + #include <botan/x919_mac.h> +#endif + +namespace Botan { + +/* +* Look for an algorithm with this name +*/ +MessageAuthenticationCode* +Default_Engine::find_mac(const SCAN_Name& request, + Algorithm_Factory& af) const + { + +#if defined(BOTAN_HAS_CBC_MAC) + if(request.algo_name() == "CBC-MAC" && request.arg_count() == 1) + return new CBC_MAC(af.make_block_cipher(request.arg(0))); +#endif + +#if defined(BOTAN_HAS_CMAC) + if(request.algo_name() == "CMAC" && request.arg_count() == 1) + return new CMAC(af.make_block_cipher(request.arg(0))); +#endif + +#if defined(BOTAN_HAS_HMAC) + if(request.algo_name() == "HMAC" && request.arg_count() == 1) + return new HMAC(af.make_hash_function(request.arg(0))); +#endif + +#if defined(BOTAN_HAS_SSL3_MAC) + if(request.algo_name() == "SSL3-MAC" && request.arg_count() == 1) + return new SSL3_MAC(af.make_hash_function(request.arg(0))); +#endif + +#if defined(BOTAN_HAS_ANSI_X919_MAC) + if(request.algo_name() == "X9.19-MAC" && request.arg_count() == 0) + return new ANSI_X919_MAC(af.make_block_cipher("DES")); +#endif + + return 0; + } + +} |