10#include <botan/internal/ffi_util.h>
20 if(hash ==
nullptr || hash_name ==
nullptr || *hash_name == 0) {
32 *hash =
new botan_hash_struct(std::move(h));
45 return BOTAN_FFI_VISIT(hash, [=](
const auto& h) { *out = h.output_length(); });
52 return BOTAN_FFI_VISIT(hash, [=](
const auto& h) { *out = h.hash_block_size(); });
79 return BOTAN_FFI_VISIT(source, [=](
const auto& src) { *dest =
new botan_hash_struct(src.copy_state()); });
83 if(name_len ==
nullptr) {
static std::unique_ptr< HashFunction > create(std::string_view algo_spec, std::string_view provider="")
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_BAD_FLAG
@ BOTAN_FFI_ERROR_NULL_POINTER
struct botan_hash_struct * botan_hash_t
int botan_hash_output_length(botan_hash_t hash, size_t *out)
int botan_hash_name(botan_hash_t hash, char *name, size_t *name_len)
int botan_hash_block_size(botan_hash_t hash, size_t *out)
int botan_hash_destroy(botan_hash_t hash)
int botan_hash_clear(botan_hash_t hash)
int botan_hash_copy_state(botan_hash_t *dest, const botan_hash_t source)
int botan_hash_final(botan_hash_t hash, uint8_t out[])
int botan_hash_init(botan_hash_t *hash, const char *hash_name, uint32_t flags)
int botan_hash_update(botan_hash_t hash, const uint8_t *buf, size_t len)
#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)