10#include <botan/internal/ffi_util.h>
20 if(!mac || !mac_name || flags != 0) {
30 *mac =
new botan_mac_struct(std::move(m));
44 return BOTAN_FFI_VISIT(mac, [=](
auto& m) { m.start(nonce, nonce_len); });
48 return BOTAN_FFI_VISIT(mac, [=](
const auto& m) { *out = m.output_length(); });
68 size_t* out_minimum_keylength,
69 size_t* out_maximum_keylength,
70 size_t* out_keylength_modulo) {
72 if(out_minimum_keylength)
73 *out_minimum_keylength = m.minimum_keylength();
74 if(out_maximum_keylength)
75 *out_maximum_keylength = m.maximum_keylength();
76 if(out_keylength_modulo)
77 *out_keylength_modulo = m.key_spec().keylength_multiple();
static std::unique_ptr< MessageAuthenticationCode > create(std::string_view algo_spec, std::string_view provider="")
struct botan_mac_struct * botan_mac_t
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_NULL_POINTER
int botan_mac_init(botan_mac_t *mac, const char *mac_name, uint32_t flags)
int botan_mac_destroy(botan_mac_t mac)
int botan_mac_set_nonce(botan_mac_t mac, const uint8_t *nonce, size_t nonce_len)
int botan_mac_final(botan_mac_t mac, uint8_t out[])
int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
int botan_mac_output_length(botan_mac_t mac, size_t *out)
int botan_mac_name(botan_mac_t mac, char *name, size_t *name_len)
int botan_mac_get_keyspec(botan_mac_t mac, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
int botan_mac_set_key(botan_mac_t mac, const uint8_t *key, size_t key_len)
int botan_mac_clear(botan_mac_t mac)
#define BOTAN_FFI_VISIT(obj, lambda)
#define BOTAN_FFI_CHECKED_DELETE(o)
#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC)
int write_str_output(uint8_t out[], size_t *out_len, std::string_view str)
int ffi_guard_thunk(const char *func_name, const std::function< int()> &thunk)