From 00c9b3f4834603946065c15b9b2e9fa5e973b979 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 31 Jan 2015 15:30:49 +0000 Subject: Use registry for streams and MACs. Start updating callers. --- src/lib/mac/hmac/hmac.cpp | 11 ++++++++++- src/lib/mac/hmac/hmac.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/lib/mac/hmac') 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 #include -#include namespace Botan { +HMAC* HMAC::make(const Spec& spec) + { + if(spec.arg_count() == 1) + return new HMAC(Algo_Registry::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: -- cgit v1.2.3