aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac/mac.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-08 19:01:32 +0000
committerlloyd <[email protected]>2008-11-08 19:01:32 +0000
commit5164d043709c1df2b7acd0fe09efe979d23a3e33 (patch)
tree4ad92bd8148e5dac8af85e338c212f4fd3701f8a /src/mac/mac.cpp
parenta236130625cec42d3577293cc8eb571c7a8099f4 (diff)
Move BufferedComputation to new buf_comp.{h,cpp}
Diffstat (limited to 'src/mac/mac.cpp')
-rw-r--r--src/mac/mac.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mac/mac.cpp b/src/mac/mac.cpp
new file mode 100644
index 000000000..63be1ea17
--- /dev/null
+++ b/src/mac/mac.cpp
@@ -0,0 +1,24 @@
+/**
+Message Authentication Code base class
+(C) 1999-2008 Jack Lloyd
+*/
+
+#include <botan/mac.h>
+
+namespace Botan {
+
+/**
+* Default (deterministic) MAC verification operation
+*/
+bool MessageAuthenticationCode::verify_mac(const byte mac[], u32bit length)
+ {
+ SecureVector<byte> our_mac = final();
+ if(our_mac.size() != length)
+ return false;
+ for(u32bit j = 0; j != length; ++j)
+ if(mac[j] != our_mac[j])
+ return false;
+ return true;
+ }
+
+}