diff options
author | lloyd <[email protected]> | 2008-11-08 19:01:32 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-08 19:01:32 +0000 |
commit | 5164d043709c1df2b7acd0fe09efe979d23a3e33 (patch) | |
tree | 4ad92bd8148e5dac8af85e338c212f4fd3701f8a /src/mac | |
parent | a236130625cec42d3577293cc8eb571c7a8099f4 (diff) |
Move BufferedComputation to new buf_comp.{h,cpp}
Diffstat (limited to 'src/mac')
-rw-r--r-- | src/mac/info.txt | 12 | ||||
-rw-r--r-- | src/mac/mac.cpp | 24 | ||||
-rw-r--r-- | src/mac/mac.h | 2 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/mac/info.txt b/src/mac/info.txt new file mode 100644 index 000000000..0e4dc11a2 --- /dev/null +++ b/src/mac/info.txt @@ -0,0 +1,12 @@ +realname "Message Authentication Codes" + +load_on auto + +<requires> +utils +</requires> + +<add> +mac.h +mac.cpp +</add> 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; + } + +} diff --git a/src/mac/mac.h b/src/mac/mac.h index e7bdada14..99184fd3f 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -6,7 +6,9 @@ #ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__ #define BOTAN_MESSAGE_AUTH_CODE_BASE_H__ +#include <botan/buf_comp.h> #include <botan/base.h> +#include <string> namespace Botan { |