diff options
Diffstat (limited to 'src/lib/mac/cbc_mac')
-rw-r--r-- | src/lib/mac/cbc_mac/cbc_mac.cpp | 12 | ||||
-rw-r--r-- | src/lib/mac/cbc_mac/cbc_mac.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/mac/cbc_mac/cbc_mac.cpp b/src/lib/mac/cbc_mac/cbc_mac.cpp index e8fc394fa..d893b922f 100644 --- a/src/lib/mac/cbc_mac/cbc_mac.cpp +++ b/src/lib/mac/cbc_mac/cbc_mac.cpp @@ -5,12 +5,20 @@ * Botan is released under the Simplified BSD License (see license.txt) */ +#include <botan/internal/mac_utils.h> #include <botan/cbc_mac.h> -#include <botan/internal/xor_buf.h> -#include <algorithm> namespace Botan { +CBC_MAC* CBC_MAC::make(const Spec& spec) + { + if(spec.arg_count() == 1) + return new CBC_MAC(Algo_Registry<BlockCipher>::global_registry().make(spec.arg(0))); + return nullptr; + } + +BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CBC-MAC", CBC_MAC, CBC_MAC::make); + /* * Update an CBC-MAC Calculation */ diff --git a/src/lib/mac/cbc_mac/cbc_mac.h b/src/lib/mac/cbc_mac/cbc_mac.h index 10c8a0da4..722658174 100644 --- a/src/lib/mac/cbc_mac/cbc_mac.h +++ b/src/lib/mac/cbc_mac/cbc_mac.h @@ -34,6 +34,7 @@ class BOTAN_DLL CBC_MAC : public MessageAuthenticationCode */ CBC_MAC(BlockCipher* cipher); + static CBC_MAC* make(const Spec& spec); private: void add_data(const byte[], size_t); void final_result(byte[]); |