Botan 1.10.17
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
11namespace Botan {
12
13/*
14* Default (deterministic) MAC verification operation
15*/
16bool 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}
size_t size() const
Definition secmem.h:29
virtual bool verify_mac(const byte in[], size_t length)
Definition mac.cpp:16
bool same_mem(const T *p1, const T *p2, size_t n)
Definition mem_ops.h:57