diff options
author | lloyd <[email protected]> | 2014-12-29 02:40:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-12-29 02:40:08 +0000 |
commit | dfc93a3c8992b067f66ca148ac91c24489f493fc (patch) | |
tree | d2af4bc335fc1ceebbaedc75dc7fa2d4f04ff2b4 /src/lib/engine | |
parent | 05b6811827fe7f4e107a9339142f6aec56f0f202 (diff) |
Add Poly1305, based on poly1305-donna by Andrew Moon.
Diffstat (limited to 'src/lib/engine')
-rw-r--r-- | src/lib/engine/core_engine/lookup_mac.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lib/engine/core_engine/lookup_mac.cpp b/src/lib/engine/core_engine/lookup_mac.cpp index 32275b559..acb8da019 100644 --- a/src/lib/engine/core_engine/lookup_mac.cpp +++ b/src/lib/engine/core_engine/lookup_mac.cpp @@ -21,6 +21,10 @@ #include <botan/hmac.h> #endif +#if defined(BOTAN_HAS_POLY1305) + #include <botan/poly1305.h> +#endif + #if defined(BOTAN_HAS_SSL3_MAC) #include <botan/ssl3_mac.h> #endif @@ -38,10 +42,9 @@ MessageAuthenticationCode* Core_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))); +#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_CMAC) @@ -49,9 +52,14 @@ Core_Engine::find_mac(const SCAN_Name& request, 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))); +#if defined(BOTAN_HAS_POLY1305) + if(request.algo_name() == "Poly1305") + return new Poly1305; +#endif + +#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_SSL3_MAC) |