Botan  1.10.9
mac.cpp
Go to the documentation of this file.
1 /*
2 * Message Authentication Code base class
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #include <botan/mac.h>
9 #include <botan/mem_ops.h>
10 
11 namespace Botan {
12 
13 /*
14 * Default (deterministic) MAC verification operation
15 */
16 bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t length)
17  {
18  SecureVector<byte> our_mac = final();
19 
20  if(our_mac.size() != length)
21  return false;
22 
23  return same_mem(&our_mac[0], &mac[0], length);
24  }
25 
26 }
bool same_mem(const T *p1, const T *p2, size_t n)
Definition: mem_ops.h:57
unsigned char byte
Definition: types.h:22
MessageAuthenticationCode * mac
Definition: fpe_fe1.cpp:94
virtual bool verify_mac(const byte in[], size_t length)
Definition: mac.cpp:16
size_t size() const
Definition: secmem.h:29