aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac
diff options
context:
space:
mode:
Diffstat (limited to 'src/mac')
-rw-r--r--src/mac/cbc_mac/cbc_mac.cpp1
-rw-r--r--src/mac/cbc_mac/cbc_mac.h3
-rw-r--r--src/mac/cmac/cmac.cpp4
-rw-r--r--src/mac/cmac/cmac.h4
-rw-r--r--src/mac/hmac/hmac.cpp4
-rw-r--r--src/mac/hmac/hmac.h2
-rw-r--r--src/mac/mac.h9
-rw-r--r--src/mac/ssl3mac/ssl3_mac.cpp4
-rw-r--r--src/mac/ssl3mac/ssl3_mac.h4
-rw-r--r--src/mac/x919_mac/x919_mac.cpp1
-rw-r--r--src/mac/x919_mac/x919_mac.h1
11 files changed, 14 insertions, 23 deletions
diff --git a/src/mac/cbc_mac/cbc_mac.cpp b/src/mac/cbc_mac/cbc_mac.cpp
index a3899c87e..118570e72 100644
--- a/src/mac/cbc_mac/cbc_mac.cpp
+++ b/src/mac/cbc_mac/cbc_mac.cpp
@@ -89,7 +89,6 @@ MessageAuthenticationCode* CBC_MAC::clone() const
* CBC-MAC Constructor
*/
CBC_MAC::CBC_MAC(BlockCipher* e_in) :
- MessageAuthenticationCode(e_in->block_size()),
e(e_in), state(e->block_size())
{
position = 0;
diff --git a/src/mac/cbc_mac/cbc_mac.h b/src/mac/cbc_mac/cbc_mac.h
index ff2a8f3fa..5cc8adc67 100644
--- a/src/mac/cbc_mac/cbc_mac.h
+++ b/src/mac/cbc_mac/cbc_mac.h
@@ -19,9 +19,10 @@ namespace Botan {
class BOTAN_DLL CBC_MAC : public MessageAuthenticationCode
{
public:
- void clear();
std::string name() const;
MessageAuthenticationCode* clone() const;
+ size_t output_length() const { return e->block_size(); }
+ void clear();
Key_Length_Specification key_spec() const
{
diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp
index 37f83ffe4..7db597fff 100644
--- a/src/mac/cmac/cmac.cpp
+++ b/src/mac/cmac/cmac.cpp
@@ -130,9 +130,7 @@ MessageAuthenticationCode* CMAC::clone() const
/*
* CMAC Constructor
*/
-CMAC::CMAC(BlockCipher* e_in) :
- MessageAuthenticationCode(e_in->block_size()),
- e(e_in)
+CMAC::CMAC(BlockCipher* e_in) : e(e_in)
{
if(e->block_size() == 16)
polynomial = 0x87;
diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h
index aa9bfb38e..98634bdb7 100644
--- a/src/mac/cmac/cmac.h
+++ b/src/mac/cmac/cmac.h
@@ -19,10 +19,12 @@ namespace Botan {
class BOTAN_DLL CMAC : public MessageAuthenticationCode
{
public:
- void clear();
std::string name() const;
+ size_t output_length() const { return e->block_size(); }
MessageAuthenticationCode* clone() const;
+ void clear();
+
Key_Length_Specification key_spec() const
{
return e->key_spec();
diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp
index 284bc87ec..fc35e26ea 100644
--- a/src/mac/hmac/hmac.cpp
+++ b/src/mac/hmac/hmac.cpp
@@ -84,9 +84,7 @@ MessageAuthenticationCode* HMAC::clone() const
/*
* HMAC Constructor
*/
-HMAC::HMAC(HashFunction* hash_in) :
- MessageAuthenticationCode(hash_in->output_length()),
- 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 505d0dd6b..b76a058f4 100644
--- a/src/mac/hmac/hmac.h
+++ b/src/mac/hmac/hmac.h
@@ -23,6 +23,8 @@ 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());
diff --git a/src/mac/mac.h b/src/mac/mac.h
index 1cb87d21e..f46cd7e35 100644
--- a/src/mac/mac.h
+++ b/src/mac/mac.h
@@ -39,15 +39,6 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation,
* @return name of this algorithm
*/
virtual std::string name() const = 0;
-
- /**
- * @param mac_len the output length of this MAC
- * @param key_min the minimum key size
- * @param key_max the maximum key size
- * @param key_mod the modulo restriction on the key size
- */
- MessageAuthenticationCode(size_t mac_len) :
- BufferedComputation(mac_len) {}
};
}
diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp
index daaca1b57..a07622eb3 100644
--- a/src/mac/ssl3mac/ssl3_mac.cpp
+++ b/src/mac/ssl3mac/ssl3_mac.cpp
@@ -72,9 +72,7 @@ MessageAuthenticationCode* SSL3_MAC::clone() const
/*
* SSL3-MAC Constructor
*/
-SSL3_MAC::SSL3_MAC(HashFunction* hash_in) :
- MessageAuthenticationCode(hash_in->output_length()),
- hash(hash_in)
+SSL3_MAC::SSL3_MAC(HashFunction* hash_in) : hash(hash_in)
{
if(hash->hash_block_size() == 0)
throw Invalid_Argument("SSL3-MAC cannot be used with " + hash->name());
diff --git a/src/mac/ssl3mac/ssl3_mac.h b/src/mac/ssl3mac/ssl3_mac.h
index 455cfa266..a85a78263 100644
--- a/src/mac/ssl3mac/ssl3_mac.h
+++ b/src/mac/ssl3mac/ssl3_mac.h
@@ -19,10 +19,12 @@ namespace Botan {
class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode
{
public:
- void clear();
std::string name() const;
+ size_t output_length() const { return hash->output_length(); }
MessageAuthenticationCode* clone() const;
+ void clear();
+
Key_Length_Specification key_spec() const
{
return Key_Length_Specification(hash->output_length());
diff --git a/src/mac/x919_mac/x919_mac.cpp b/src/mac/x919_mac/x919_mac.cpp
index bd53a6c7d..fcbe77537 100644
--- a/src/mac/x919_mac/x919_mac.cpp
+++ b/src/mac/x919_mac/x919_mac.cpp
@@ -85,7 +85,6 @@ MessageAuthenticationCode* ANSI_X919_MAC::clone() const
* ANSI X9.19 MAC Constructor
*/
ANSI_X919_MAC::ANSI_X919_MAC(BlockCipher* e_in) :
- MessageAuthenticationCode(e_in->block_size()),
e(e_in), d(e->clone()), state(e->block_size()), position(0)
{
if(e->name() != "DES")
diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h
index 600955919..58a005e0b 100644
--- a/src/mac/x919_mac/x919_mac.h
+++ b/src/mac/x919_mac/x919_mac.h
@@ -21,6 +21,7 @@ class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode
public:
void clear();
std::string name() const;
+ size_t output_length() const { return e->block_size(); }
MessageAuthenticationCode* clone() const;
Key_Length_Specification key_spec() const