8#include <botan/internal/ffi_util.h>
9#include <botan/internal/os_utils.h>
10#include <botan/version.h>
11#include <botan/mem_ops.h>
13#include <botan/base64.h>
28 static_cast<void>(std::fprintf(stderr,
"in %s exception '%s' returning %d\n", func_name, exn, rc));
40 if(vctx ==
nullptr || buf ==
nullptr)
45 const size_t avail = *ctx->
out_len;
48 if(avail < len || ctx->out_ptr ==
nullptr)
128 catch(std::bad_alloc&)
140 catch(std::exception& e)
171 return "Invalid verifier";
174 return "Invalid input";
177 return "Invalid authentication code";
180 return "Insufficient buffer space";
183 return "String conversion error";
186 return "Exception thrown";
189 return "Out of memory";
192 return "Error while calling system API";
195 return "Internal error";
201 return "Null pointer argument";
204 return "Bad parameter";
207 return "Key not set on object";
210 return "Invalid key length";
213 return "Invalid object state";
216 return "Not implemented";
219 return "Invalid object handle";
228 return "Unknown error";
231 return "Unknown error";
246 if(api_version == 20230403)
250 if(api_version == 20210220)
254 if(api_version == 20191214)
258 if(api_version == 20180713)
262 if(api_version == 20170815)
266 if(api_version == 20170327)
270 if(api_version == 20150515)
329 uint8_t* out,
size_t* out_len)
const char * what() const noexcept override
Botan::ErrorType error_type() const noexcept override
int error_code() const noexcept override
uint32_t botan_version_datestamp()
int botan_same_mem(const uint8_t *x, const uint8_t *y, size_t len)
const char * botan_version_string()
int botan_base64_decode(const char *base64_str, size_t in_len, uint8_t *out, size_t *out_len)
uint32_t botan_version_patch()
int botan_base64_encode(const uint8_t *in, size_t len, char *out, size_t *out_len)
int botan_scrub_mem(void *mem, size_t bytes)
int botan_hex_encode(const uint8_t *in, size_t len, char *out, uint32_t flags)
uint32_t botan_version_major()
uint32_t botan_ffi_api_version()
int botan_ffi_supports_api(uint32_t api_version)
const char * botan_error_description(int err)
uint32_t botan_version_minor()
int botan_constant_time_compare(const uint8_t *x, const uint8_t *y, size_t len)
int botan_hex_decode(const char *hex_str, size_t in_len, uint8_t *out, size_t *out_len)
const char * botan_error_last_exception_message()
#define BOTAN_FFI_HEX_LOWER_CASE
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_INVALID_KEY_LENGTH
@ BOTAN_FFI_ERROR_KEY_NOT_SET
@ BOTAN_FFI_ERROR_TLS_ERROR
@ BOTAN_FFI_ERROR_EXCEPTION_THROWN
@ BOTAN_FFI_ERROR_OUT_OF_MEMORY
@ BOTAN_FFI_ERROR_INTERNAL_ERROR
@ BOTAN_FFI_INVALID_VERIFIER
@ BOTAN_FFI_ERROR_INVALID_OBJECT
@ BOTAN_FFI_ERROR_UNKNOWN_ERROR
@ BOTAN_FFI_ERROR_HTTP_ERROR
@ BOTAN_FFI_ERROR_BAD_FLAG
@ BOTAN_FFI_ERROR_INVALID_INPUT
@ BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR
@ BOTAN_FFI_ERROR_NULL_POINTER
@ BOTAN_FFI_ERROR_SYSTEM_ERROR
@ BOTAN_FFI_ERROR_ROUGHTIME_ERROR
@ BOTAN_FFI_ERROR_INVALID_OBJECT_STATE
@ BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE
@ BOTAN_FFI_ERROR_BAD_MAC
@ BOTAN_FFI_ERROR_BAD_PARAMETER
bool read_env_variable(std::string &value_out, std::string_view var_name)
int ffi_error_exception_thrown(const char *func_name, const char *exn, int rc)
int botan_view_bin_bounce_fn(botan_view_ctx vctx, const uint8_t *buf, size_t len)
int botan_view_str_bounce_fn(botan_view_ctx vctx, const char *str, size_t len)
int write_str_output(uint8_t out[], size_t *out_len, std::string_view str)
thread_local std::string g_last_exception_what
int ffi_guard_thunk(const char *func_name, const std::function< int()> &thunk)
int write_vec_output(uint8_t out[], size_t *out_len, const std::vector< uint8_t, Alloc > &buf)
const char * version_cstr()
size_t base64_encode(char out[], const uint8_t in[], size_t input_length, size_t &input_consumed, bool final_inputs)
uint32_t version_datestamp()
constexpr void copy_mem(T *out, const T *in, size_t n)
void secure_scrub_memory(void *ptr, size_t n)
size_t base64_decode(uint8_t out[], const char in[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws)
bool constant_time_compare(const uint8_t x[], const uint8_t y[], size_t len)
void hex_encode(char output[], const uint8_t input[], size_t input_length, bool uppercase)
size_t base64_decode_max_output(size_t input_length)
size_t hex_decode(uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool ignore_ws)
constexpr void clear_mem(T *ptr, size_t n)