aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-13 02:59:43 +0000
committerlloyd <[email protected]>2010-10-13 02:59:43 +0000
commit61ed0d4d90164675396feb7c7cecdd3bc5012f91 (patch)
tree31f48086086c78c6f0ce5fd533d819c8463be822 /src/mac
parent3697dcff8b5e9765b41114281ce10e7ed3d3abb4 (diff)
Remove most uses of HASH_BLOCK_SIZE
Diffstat (limited to 'src/mac')
-rw-r--r--src/mac/hmac/hmac.cpp10
-rw-r--r--src/mac/ssl3mac/ssl3_mac.cpp4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp
index 90da24eaf..06923138a 100644
--- a/src/mac/hmac/hmac.cpp
+++ b/src/mac/hmac/hmac.cpp
@@ -40,7 +40,7 @@ void HMAC::key_schedule(const byte key[], size_t length)
std::fill(i_key.begin(), i_key.end(), 0x36);
std::fill(o_key.begin(), o_key.end(), 0x5C);
- if(length > hash->HASH_BLOCK_SIZE)
+ if(length > hash->hash_block_size())
{
SecureVector<byte> hmac_key = hash->process(key, length);
xor_buf(i_key, hmac_key, hmac_key.size());
@@ -86,14 +86,14 @@ MessageAuthenticationCode* HMAC::clone() const
*/
HMAC::HMAC(HashFunction* hash_in) :
MessageAuthenticationCode(hash_in->output_length(),
- 0, 2*hash_in->HASH_BLOCK_SIZE),
+ 0, 2*hash_in->hash_block_size()),
hash(hash_in)
{
- if(hash->HASH_BLOCK_SIZE == 0)
+ if(hash->hash_block_size() == 0)
throw Invalid_Argument("HMAC cannot be used with " + hash->name());
- i_key.resize(hash->HASH_BLOCK_SIZE);
- o_key.resize(hash->HASH_BLOCK_SIZE);
+ i_key.resize(hash->hash_block_size());
+ o_key.resize(hash->hash_block_size());
}
}
diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp
index e29770bde..fcbccc06e 100644
--- a/src/mac/ssl3mac/ssl3_mac.cpp
+++ b/src/mac/ssl3mac/ssl3_mac.cpp
@@ -77,11 +77,11 @@ SSL3_MAC::SSL3_MAC(HashFunction* hash_in) :
hash_in->output_length()),
hash(hash_in)
{
- if(hash->HASH_BLOCK_SIZE == 0)
+ if(hash->hash_block_size() == 0)
throw Invalid_Argument("SSL3-MAC cannot be used with " + hash->name());
size_t INNER_HASH_LENGTH =
- (hash->name() == "SHA-160") ? 60 : hash->HASH_BLOCK_SIZE;
+ (hash->name() == "SHA-160") ? 60 : hash->hash_block_size();
i_key.resize(INNER_HASH_LENGTH);
o_key.resize(INNER_HASH_LENGTH);