diff options
author | lloyd <[email protected]> | 2008-09-30 06:20:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 06:20:10 +0000 |
commit | 33bb3dca54ecef2599b756d27b66781e14d06ae3 (patch) | |
tree | 4c7b07a1b1b3f40e82202570c7aec298a672339c /src/mac/hmac | |
parent | c9749d5d4693b5d93171f6085b29fc72c1e12ba0 (diff) |
Remove lookup from Randpool, HMAC, CMAC, CBC-MAC, TLS-PRF, and PBKDF2
Diffstat (limited to 'src/mac/hmac')
-rw-r--r-- | src/mac/hmac/hmac.cpp | 12 | ||||
-rw-r--r-- | src/mac/hmac/hmac.h | 3 |
2 files changed, 8 insertions, 7 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); } diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h index 62529cf13..67ebc4190 100644 --- a/src/mac/hmac/hmac.h +++ b/src/mac/hmac/hmac.h @@ -19,7 +19,8 @@ class BOTAN_DLL HMAC : public MessageAuthenticationCode void clear() throw(); std::string name() const; MessageAuthenticationCode* clone() const; - HMAC(const std::string&); + + HMAC(HashFunction* hash); ~HMAC() { delete hash; } private: void add_data(const byte[], u32bit); |