10#include <botan/exceptn.h>
11#include <botan/mem_ops.h>
12#include <botan/internal/scan_name.h>
14#if defined(BOTAN_HAS_CMAC)
15 #include <botan/internal/cmac.h>
18#if defined(BOTAN_HAS_GMAC)
19 #include <botan/block_cipher.h>
20 #include <botan/internal/gmac.h>
23#if defined(BOTAN_HAS_HMAC)
24 #include <botan/hash.h>
25 #include <botan/internal/hmac.h>
28#if defined(BOTAN_HAS_POLY1305)
29 #include <botan/internal/poly1305.h>
32#if defined(BOTAN_HAS_SIPHASH)
33 #include <botan/internal/siphash.h>
36#if defined(BOTAN_HAS_ANSI_X919_MAC)
37 #include <botan/internal/x919_mac.h>
40#if defined(BOTAN_HAS_BLAKE2BMAC)
41 #include <botan/internal/blake2bmac.h>
44#if defined(BOTAN_HAS_KMAC)
45 #include <botan/internal/kmac.h>
51 std::string_view provider) {
54#if defined(BOTAN_HAS_BLAKE2BMAC)
60#if defined(BOTAN_HAS_GMAC)
64 return std::make_unique<GMAC>(std::move(bc));
70#if defined(BOTAN_HAS_HMAC)
74 return std::make_unique<HMAC>(std::move(hash));
80#if defined(BOTAN_HAS_POLY1305)
83 return std::make_unique<Poly1305>();
88#if defined(BOTAN_HAS_SIPHASH)
96#if defined(BOTAN_HAS_CMAC)
100 return std::make_unique<CMAC>(std::move(bc));
106#if defined(BOTAN_HAS_ANSI_X919_MAC)
109 return std::make_unique<ANSI_X919_MAC>();
114#if defined(BOTAN_HAS_KMAC)
119 "invalid algorithm specification for KMAC-128: need exactly one argument for output bit length");
129 "invalid algorithm specification for KMAC-256: need exactly one argument for output bit length");
143 return probe_providers_of<MessageAuthenticationCode>(algo_spec);
148 std::string_view provider) {
168 if(our_mac.size() != mac.size()) {
static std::unique_ptr< BlockCipher > create(std::string_view algo_spec, std::string_view provider="")
static std::unique_ptr< HashFunction > create(std::string_view algo_spec, std::string_view provider="")
virtual bool verify_mac_result(std::span< const uint8_t > in)
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(std::string_view algo_spec, std::string_view provider="")
static std::unique_ptr< MessageAuthenticationCode > create(std::string_view algo_spec, std::string_view provider="")
virtual std::string provider() const
virtual void start_msg(std::span< const uint8_t > nonce)
static std::vector< std::string > providers(std::string_view algo_spec)
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