8#include <botan/internal/ffi_util.h>
9#include <botan/block_cipher.h>
20 if(bc ==
nullptr || bc_name ==
nullptr || *bc_name == 0)
29 *bc =
new botan_block_cipher_struct(std::move(cipher));
51 const uint8_t key[],
size_t len)
65 {
return static_cast<int>(
b.block_size()); });
73 if(in ==
nullptr || out ==
nullptr)
83 if(in ==
nullptr || out ==
nullptr)
90 if(name_len ==
nullptr)
98 size_t* out_minimum_keylength,
99 size_t* out_maximum_keylength,
100 size_t* out_keylength_modulo)
103 if(out_minimum_keylength)
105 if(out_maximum_keylength)
106 *out_maximum_keylength = bc.maximum_keylength();
107 if(out_keylength_modulo)
108 *out_keylength_modulo = bc.key_spec().keylength_multiple();
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
size_t minimum_keylength() const
struct botan_block_cipher_struct * botan_block_cipher_t
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_NULL_POINTER
int botan_block_cipher_get_keyspec(botan_block_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
int botan_block_cipher_clear(botan_block_cipher_t bc)
int botan_block_cipher_init(botan_block_cipher_t *bc, const char *bc_name)
int botan_block_cipher_block_size(botan_block_cipher_t bc)
int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_block_cipher_name(botan_block_cipher_t cipher, char *name, size_t *name_len)
BOTAN_FFI_DECLARE_STRUCT(botan_block_cipher_struct, Botan::BlockCipher, 0x64C29716)
int botan_block_cipher_destroy(botan_block_cipher_t bc)
int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t len)
#define BOTAN_FFI_DO(T, obj, param, block)
#define BOTAN_FFI_CHECKED_DELETE(o)
#define BOTAN_FFI_RETURNING(T, obj, param, block)
int write_str_output(uint8_t out[], size_t *out_len, const std::string &str)
int ffi_guard_thunk(const char *func_name, const std::function< int()> &thunk)