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
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 }
Botan::same_mem
bool same_mem(const T *p1, const T *p2, size_t n)
Definition: mem_ops.h:57
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::MessageAuthenticationCode::verify_mac
virtual bool verify_mac(const byte in[], size_t length)
Definition: mac.cpp:16
Botan
Definition: algo_base.h:14
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29
Botan::SecureVector< byte >