aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mac/mac.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-01 21:20:55 +0000
committerlloyd <[email protected]>2014-01-01 21:20:55 +0000
commit197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch)
treecdbd3ddaec051c72f0a757db461973d90c37b97a /lib/mac/mac.cpp
parent62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff)
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'lib/mac/mac.cpp')
-rw-r--r--lib/mac/mac.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/mac/mac.cpp b/lib/mac/mac.cpp
new file mode 100644
index 000000000..094aa1b4a
--- /dev/null
+++ b/lib/mac/mac.cpp
@@ -0,0 +1,26 @@
+/*
+* Message Authentication Code base class
+* (C) 1999-2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/mac.h>
+#include <botan/mem_ops.h>
+
+namespace Botan {
+
+/*
+* Default (deterministic) MAC verification operation
+*/
+bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t length)
+ {
+ secure_vector<byte> our_mac = final();
+
+ if(our_mac.size() != length)
+ return false;
+
+ return same_mem(&our_mac[0], &mac[0], length);
+ }
+
+}