9#include <botan/block_cipher.h>
10#include <botan/internal/ffi_util.h>
20 if(bc ==
nullptr || bc_name ==
nullptr || *bc_name == 0) {
27 if(cipher ==
nullptr) {
61 return BOTAN_FFI_VISIT(bc, [](
const auto& b) {
return static_cast<int>(b.block_size()); });
65 if(in ==
nullptr || out ==
nullptr) {
68 return BOTAN_FFI_VISIT(bc, [=](
const auto& b) { b.encrypt_n(in, out, blocks); });
72 if(in ==
nullptr || out ==
nullptr) {
75 return BOTAN_FFI_VISIT(bc, [=](
const auto& b) { b.decrypt_n(in, out, blocks); });
79 if(name_len ==
nullptr) {
87 size_t* out_minimum_keylength,
88 size_t* out_maximum_keylength,
89 size_t* out_keylength_modulo) {
91 if(out_minimum_keylength) {
92 *out_minimum_keylength = bc.minimum_keylength();
94 if(out_maximum_keylength) {
95 *out_maximum_keylength = bc.maximum_keylength();
97 if(out_keylength_modulo) {
98 *out_keylength_modulo = bc.key_spec().keylength_multiple();
static std::unique_ptr< BlockCipher > create(std::string_view algo_spec, std::string_view provider="")
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)
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_VISIT(obj, lambda)
#define BOTAN_FFI_CHECKED_DELETE(o)
#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC)
BOTAN_FFI_ERROR ffi_new_object(T *obj, Args &&... args)
int ffi_guard_thunk(const char *func_name, T thunk)
int write_str_output(char out[], size_t *out_len, const std::string &str)