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> 45 std::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) 69 return std::unique_ptr<MessageAuthenticationCode>(
new HMAC(h.release()));
74 #if defined(BOTAN_HAS_POLY1305) 78 return std::unique_ptr<MessageAuthenticationCode>(
new Poly1305);
82 #if defined(BOTAN_HAS_SIPHASH) 87 return std::unique_ptr<MessageAuthenticationCode>(
93 #if defined(BOTAN_HAS_CMAC) 100 return std::unique_ptr<MessageAuthenticationCode>(
new CMAC(bc.release()));
106 #if defined(BOTAN_HAS_CBC_MAC) 112 return std::unique_ptr<MessageAuthenticationCode>(
new CBC_MAC(bc.release()));
117 #if defined(BOTAN_HAS_ANSI_X919_MAC) 122 return std::unique_ptr<MessageAuthenticationCode>(
new ANSI_X919_MAC);
133 std::vector<std::string>
136 return probe_providers_of<MessageAuthenticationCode>(algo_spec, {
"base",
"openssl"});
140 std::unique_ptr<MessageAuthenticationCode>
142 const std::string& provider)
165 if(our_mac.size() != length)
virtual void start_msg(const uint8_t nonce[], size_t nonce_len)
static std::unique_ptr< MessageAuthenticationCode > create(const std::string &algo_spec, const std::string &provider="")
virtual std::string provider() const
size_t arg_as_integer(size_t i, size_t def_value) const
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
static std::vector< std::string > providers(const std::string &algo_spec)
virtual std::string name() const =0
virtual bool verify_mac(const uint8_t in[], size_t length)
std::string arg(size_t i) const
static std::unique_ptr< HashFunction > create(const std::string &algo_spec, const std::string &provider="")
#define BOTAN_UNUSED(...)
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
const std::string & algo_name() const
static std::unique_ptr< MessageAuthenticationCode > create_or_throw(const std::string &algo_spec, const std::string &provider="")
std::vector< T, secure_allocator< T > > secure_vector