aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac/hmac
diff options
context:
space:
mode:
Diffstat (limited to 'src/mac/hmac')
-rw-r--r--src/mac/hmac/hmac.cpp5
-rw-r--r--src/mac/hmac/hmac.h7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp
index 06923138a..fc35e26ea 100644
--- a/src/mac/hmac/hmac.cpp
+++ b/src/mac/hmac/hmac.cpp
@@ -84,10 +84,7 @@ MessageAuthenticationCode* HMAC::clone() const
/*
* HMAC Constructor
*/
-HMAC::HMAC(HashFunction* hash_in) :
- MessageAuthenticationCode(hash_in->output_length(),
- 0, 2*hash_in->hash_block_size()),
- hash(hash_in)
+HMAC::HMAC(HashFunction* hash_in) : hash(hash_in)
{
if(hash->hash_block_size() == 0)
throw Invalid_Argument("HMAC cannot be used with " + hash->name());
diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h
index 33af62f6a..b76a058f4 100644
--- a/src/mac/hmac/hmac.h
+++ b/src/mac/hmac/hmac.h
@@ -23,6 +23,13 @@ class BOTAN_DLL HMAC : public MessageAuthenticationCode
std::string name() const;
MessageAuthenticationCode* clone() const;
+ size_t output_length() const { return hash->output_length(); }
+
+ Key_Length_Specification key_spec() const
+ {
+ return Key_Length_Specification(0, 2*hash->hash_block_size());
+ }
+
/**
* @param hash the hash to use for HMACing
*/