aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac/hmac/hmac.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mac/hmac/hmac.cpp')
-rw-r--r--src/mac/hmac/hmac.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp
index b8c76e8f6..6401b0000 100644
--- a/src/mac/hmac/hmac.cpp
+++ b/src/mac/hmac/hmac.cpp
@@ -5,7 +5,6 @@
*************************************************/
#include <botan/hmac.h>
-#include <botan/lookup.h>
#include <botan/xor_buf.h>
namespace Botan {
@@ -77,19 +76,20 @@ std::string HMAC::name() const
*************************************************/
MessageAuthenticationCode* HMAC::clone() const
{
- return new HMAC(hash->name());
+ return new HMAC(hash->clone());
}
/*************************************************
* HMAC Constructor *
*************************************************/
-HMAC::HMAC(const std::string& hash_name) :
- MessageAuthenticationCode(output_length_of(hash_name),
- 1, 2*block_size_of(hash_name)),
- hash(get_hash(hash_name))
+HMAC::HMAC(HashFunction* hash_in) :
+ MessageAuthenticationCode(hash_in->OUTPUT_LENGTH,
+ 1, 2*hash_in->HASH_BLOCK_SIZE),
+ hash(hash_in)
{
if(hash->HASH_BLOCK_SIZE == 0)
throw Invalid_Argument("HMAC cannot be used with " + hash->name());
+
i_key.create(hash->HASH_BLOCK_SIZE);
o_key.create(hash->HASH_BLOCK_SIZE);
}