diff options
author | lloyd <[email protected]> | 2010-10-13 00:56:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-13 00:56:15 +0000 |
commit | 6e706bfefa04fc28d6c204442ca45982993dc550 (patch) | |
tree | c3a151b6ce91cb5add058b224a925e4f3b8cfb5d /src/mac | |
parent | c59d960db6d69bd9c479ec674768b7ec371830b5 (diff) |
More size_t
Diffstat (limited to 'src/mac')
-rw-r--r-- | src/mac/mac.cpp | 10 | ||||
-rw-r--r-- | src/mac/mac.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mac/mac.cpp b/src/mac/mac.cpp index cb89e872a..2ef4ab64c 100644 --- a/src/mac/mac.cpp +++ b/src/mac/mac.cpp @@ -6,21 +6,21 @@ */ #include <botan/mac.h> +#include <botan/mem_ops.h> namespace Botan { /* * Default (deterministic) MAC verification operation */ -bool MessageAuthenticationCode::verify_mac(const byte mac[], u32bit length) +bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t 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; + + return same_mem(&our_mac[0], &mac[0], length); } } diff --git a/src/mac/mac.h b/src/mac/mac.h index 4518d91ad..1350c7d7a 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -27,7 +27,7 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation, * @param length the length of param in * @return true if the MAC is valid, false otherwise */ - virtual bool verify_mac(const byte in[], u32bit length); + virtual bool verify_mac(const byte in[], size_t length); /** * Get a new object representing the same algorithm as *this |