aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/mac
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/mac')
-rw-r--r--src/lib/mac/cbc_mac/cbc_mac.cpp2
-rw-r--r--src/lib/mac/cmac/cmac.cpp2
-rw-r--r--src/lib/mac/hmac/hmac.cpp2
-rw-r--r--src/lib/mac/mac.cpp52
-rw-r--r--src/lib/mac/mac.h6
-rw-r--r--src/lib/mac/poly1305/poly1305.cpp2
-rw-r--r--src/lib/mac/siphash/siphash.cpp2
-rw-r--r--src/lib/mac/x919_mac/x919_mac.cpp2
8 files changed, 56 insertions, 14 deletions
diff --git a/src/lib/mac/cbc_mac/cbc_mac.cpp b/src/lib/mac/cbc_mac/cbc_mac.cpp
index b58372c78..29507f17b 100644
--- a/src/lib/mac/cbc_mac/cbc_mac.cpp
+++ b/src/lib/mac/cbc_mac/cbc_mac.cpp
@@ -20,8 +20,6 @@ CBC_MAC* CBC_MAC::make(const Spec& spec)
return nullptr;
}
-BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CBC-MAC", CBC_MAC, CBC_MAC::make);
-
/*
* Update an CBC-MAC Calculation
*/
diff --git a/src/lib/mac/cmac/cmac.cpp b/src/lib/mac/cmac/cmac.cpp
index 1621079dc..85c19c19f 100644
--- a/src/lib/mac/cmac/cmac.cpp
+++ b/src/lib/mac/cmac/cmac.cpp
@@ -20,8 +20,6 @@ CMAC* CMAC::make(const Spec& spec)
return nullptr;
}
-BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CMAC", CMAC, CMAC::make);
-
/*
* Perform CMAC's multiplication in GF(2^n)
*/
diff --git a/src/lib/mac/hmac/hmac.cpp b/src/lib/mac/hmac/hmac.cpp
index 1c6821a54..2cd512746 100644
--- a/src/lib/mac/hmac/hmac.cpp
+++ b/src/lib/mac/hmac/hmac.cpp
@@ -21,8 +21,6 @@ HMAC* HMAC::make(const Spec& spec)
return nullptr;
}
-BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "HMAC", HMAC, HMAC::make);
-
/*
* Update a HMAC Calculation
*/
diff --git a/src/lib/mac/mac.cpp b/src/lib/mac/mac.cpp
index 0bb1939c7..af59bd4c6 100644
--- a/src/lib/mac/mac.cpp
+++ b/src/lib/mac/mac.cpp
@@ -6,10 +6,37 @@
*/
#include <botan/mac.h>
+#include <botan/internal/mac_utils.h>
#include <botan/mem_ops.h>
+#if defined(BOTAN_HAS_CBC_MAC)
+ #include <botan/cbc_mac.h>
+#endif
+
+#if defined(BOTAN_HAS_CMAC)
+ #include <botan/cmac.h>
+#endif
+
+#if defined(BOTAN_HAS_HMAC)
+ #include <botan/hmac.h>
+#endif
+
+#if defined(BOTAN_HAS_POLY1305)
+ #include <botan/poly1305.h>
+#endif
+
+#if defined(BOTAN_HAS_SIPHASH)
+ #include <botan/siphash.h>
+#endif
+
+#if defined(BOTAN_HAS_ANSI_X919_MAC)
+ #include <botan/x919_mac.h>
+#endif
+
namespace Botan {
+MessageAuthenticationCode::~MessageAuthenticationCode() {}
+
/*
* Default (deterministic) MAC verification operation
*/
@@ -23,4 +50,29 @@ bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t length)
return same_mem(our_mac.data(), mac, length);
}
+
+#if defined(BOTAN_HAS_CBC_MAC)
+BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CBC-MAC", CBC_MAC, CBC_MAC::make);
+#endif
+
+#if defined(BOTAN_HAS_CMAC)
+BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CMAC", CMAC, CMAC::make);
+#endif
+
+#if defined(BOTAN_HAS_HMAC)
+BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "HMAC", HMAC, HMAC::make);
+#endif
+
+#if defined(BOTAN_HAS_POLY1305)
+BOTAN_REGISTER_MAC_NOARGS(Poly1305);
+#endif
+
+#if defined(BOTAN_HAS_SIPHASH)
+BOTAN_REGISTER_NAMED_T_2LEN(MessageAuthenticationCode, SipHash, "SipHash", "base", 2, 4);
+#endif
+
+#if defined(BOTAN_HAS_ANSI_X919_MAC)
+BOTAN_REGISTER_MAC_NAMED_NOARGS(ANSI_X919_MAC, "X9.19-MAC");
+#endif
+
}
diff --git a/src/lib/mac/mac.h b/src/lib/mac/mac.h
index 8ad2d1e99..28894bbcd 100644
--- a/src/lib/mac/mac.h
+++ b/src/lib/mac/mac.h
@@ -22,6 +22,10 @@ class BOTAN_DLL MessageAuthenticationCode : public Buffered_Computation,
public SymmetricAlgorithm
{
public:
+ typedef SCAN_Name Spec;
+
+ virtual ~MessageAuthenticationCode();
+
/**
* Verify a MAC.
* @param in the MAC to verify as a byte array
@@ -34,8 +38,6 @@ class BOTAN_DLL MessageAuthenticationCode : public Buffered_Computation,
* Get a new object representing the same algorithm as *this
*/
virtual MessageAuthenticationCode* clone() const = 0;
-
- typedef SCAN_Name Spec;
};
}
diff --git a/src/lib/mac/poly1305/poly1305.cpp b/src/lib/mac/poly1305/poly1305.cpp
index 659667baf..1a072c6b4 100644
--- a/src/lib/mac/poly1305/poly1305.cpp
+++ b/src/lib/mac/poly1305/poly1305.cpp
@@ -16,8 +16,6 @@
namespace Botan {
-BOTAN_REGISTER_MAC_NOARGS(Poly1305);
-
namespace {
void poly1305_init(secure_vector<u64bit>& X, const byte key[32])
diff --git a/src/lib/mac/siphash/siphash.cpp b/src/lib/mac/siphash/siphash.cpp
index f8ed28a84..689d03c13 100644
--- a/src/lib/mac/siphash/siphash.cpp
+++ b/src/lib/mac/siphash/siphash.cpp
@@ -10,8 +10,6 @@
namespace Botan {
-BOTAN_REGISTER_NAMED_T_2LEN(MessageAuthenticationCode, SipHash, "SipHash", "base", 2, 4);
-
namespace {
void SipRounds(u64bit M, secure_vector<u64bit>& V, size_t r)
diff --git a/src/lib/mac/x919_mac/x919_mac.cpp b/src/lib/mac/x919_mac/x919_mac.cpp
index 542f9040a..ce7c38ebb 100644
--- a/src/lib/mac/x919_mac/x919_mac.cpp
+++ b/src/lib/mac/x919_mac/x919_mac.cpp
@@ -10,8 +10,6 @@
namespace Botan {
-BOTAN_REGISTER_MAC_NAMED_NOARGS(ANSI_X919_MAC, "X9.19-MAC");
-
/*
* Update an ANSI X9.19 MAC Calculation
*/