9#include <botan/exceptn.h>
10#include <botan/scan_name.h>
11#include <botan/mem_ops.h>
13#if defined(BOTAN_HAS_CBC_MAC)
14 #include <botan/cbc_mac.h>
17#if defined(BOTAN_HAS_CMAC)
18 #include <botan/cmac.h>
21#if defined(BOTAN_HAS_GMAC)
22 #include <botan/gmac.h>
23 #include <botan/block_cipher.h>
26#if defined(BOTAN_HAS_HMAC)
27 #include <botan/hmac.h>
28 #include <botan/hash.h>
31#if defined(BOTAN_HAS_POLY1305)
32 #include <botan/poly1305.h>
35#if defined(BOTAN_HAS_SIPHASH)
36 #include <botan/siphash.h>
39#if defined(BOTAN_HAS_ANSI_X919_MAC)
40 #include <botan/x919_mac.h>
45std::unique_ptr<MessageAuthenticationCode>
47 const std::string& provider)
51#if defined(BOTAN_HAS_GMAC)
57 return std::unique_ptr<MessageAuthenticationCode>(
new GMAC(bc.release()));
62#if defined(BOTAN_HAS_HMAC)
68 return std::unique_ptr<MessageAuthenticationCode>(
new HMAC(h.release()));
73#if defined(BOTAN_HAS_POLY1305)
77 return std::unique_ptr<MessageAuthenticationCode>(
new Poly1305);
81#if defined(BOTAN_HAS_SIPHASH)
86 return std::unique_ptr<MessageAuthenticationCode>(
92#if defined(BOTAN_HAS_CMAC)
98 return std::unique_ptr<MessageAuthenticationCode>(
new CMAC(bc.release()));
104#if defined(BOTAN_HAS_CBC_MAC)
110 return std::unique_ptr<MessageAuthenticationCode>(
new CBC_MAC(bc.release()));
115#if defined(BOTAN_HAS_ANSI_X919_MAC)
120 return std::unique_ptr<MessageAuthenticationCode>(
new ANSI_X919_MAC);
131std::vector<std::string>
134 return probe_providers_of<MessageAuthenticationCode>(algo_spec, {
"base",
"openssl"});
138std::unique_ptr<MessageAuthenticationCode>
140 const std::string& provider)
163 if(our_mac.size() != length)
#define BOTAN_UNUSED(...)
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
static std::unique_ptr< HashFunction > create(const std::string &algo_spec, const std::string &provider="")
static std::vector< std::string > providers(const std::string &algo_spec)
virtual void start_msg(const uint8_t nonce[], size_t nonce_len)
virtual std::string provider() const
static std::unique_ptr< MessageAuthenticationCode > create(const std::string &algo_spec, const std::string &provider="")
virtual bool verify_mac(const uint8_t in[], size_t length)
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(const std::string &algo_spec, const std::string &provider="")
std::string arg(size_t i) const
const std::string & algo_name() const
size_t arg_as_integer(size_t i, size_t def_value) const
virtual std::string name() const =0
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
std::vector< T, secure_allocator< T > > secure_vector