aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/mac/hmac
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-31 15:30:49 +0000
committerlloyd <[email protected]>2015-01-31 15:30:49 +0000
commit00c9b3f4834603946065c15b9b2e9fa5e973b979 (patch)
treeb0f82333a1eeab624409db9515e511838f6fa2d6 /src/lib/mac/hmac
parent710229be83cdbc061949c61942896b5af9e134d8 (diff)
Use registry for streams and MACs. Start updating callers.
Diffstat (limited to 'src/lib/mac/hmac')
-rw-r--r--src/lib/mac/hmac/hmac.cpp11
-rw-r--r--src/lib/mac/hmac/hmac.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/mac/hmac/hmac.cpp b/src/lib/mac/hmac/hmac.cpp
index 625fd122e..12525f088 100644
--- a/src/lib/mac/hmac/hmac.cpp
+++ b/src/lib/mac/hmac/hmac.cpp
@@ -6,11 +6,20 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
+#include <botan/internal/mac_utils.h>
#include <botan/hmac.h>
-#include <botan/internal/xor_buf.h>
namespace Botan {
+HMAC* HMAC::make(const Spec& spec)
+ {
+ if(spec.arg_count() == 1)
+ return new HMAC(Algo_Registry<HashFunction>::global_registry().make(spec.arg(0)));
+ return nullptr;
+ }
+
+BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "HMAC", HMAC, HMAC::make);
+
/*
* Update a HMAC Calculation
*/
diff --git a/src/lib/mac/hmac/hmac.h b/src/lib/mac/hmac/hmac.h
index b6311d741..6b01eb365 100644
--- a/src/lib/mac/hmac/hmac.h
+++ b/src/lib/mac/hmac/hmac.h
@@ -36,6 +36,8 @@ class BOTAN_DLL HMAC : public MessageAuthenticationCode
*/
HMAC(HashFunction* hash);
+ static HMAC* make(const Spec& spec);
+
HMAC(const HMAC&) = delete;
HMAC& operator=(const HMAC&) = delete;
private: