From 6e706bfefa04fc28d6c204442ca45982993dc550 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 13 Oct 2010 00:56:15 +0000 Subject: More size_t --- src/mac/mac.cpp | 10 +++++----- src/mac/mac.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mac') 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 +#include 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 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 -- cgit v1.2.3