9#include <botan/base64.h>
11#include <botan/mem_ops.h>
12#include <botan/version.h>
13#include <botan/internal/ct_utils.h>
14#include <botan/internal/ffi_util.h>
15#include <botan/internal/os_utils.h>
29 static_cast<void>(std::fprintf(stderr,
"in %s exception '%s' returning %d\n", func_name, exn, rc));
39 if(vctx ==
nullptr || buf ==
nullptr) {
45 const size_t avail = *ctx->
out_len;
48 if(avail < len || ctx->out_ptr ==
nullptr) {
123 }
catch(std::bad_alloc&) {
129 }
catch(std::exception& e) {
152 return "Invalid verifier";
155 return "Invalid input";
158 return "Invalid authentication code";
161 return "Insufficient buffer space";
164 return "String conversion error";
167 return "Exception thrown";
170 return "Out of memory";
173 return "Error while calling system API";
176 return "Internal error";
182 return "Null pointer argument";
185 return "Bad parameter";
188 return "Key not set on object";
191 return "Invalid key length";
194 return "Invalid object state";
197 return "Not implemented";
200 return "Invalid object handle";
209 return "Unknown error";
212 return "Unknown error";
225 if(api_version == 20240408) {
230 if(api_version == 20231009) {
235 if(api_version == 20230711) {
240 if(api_version == 20230403) {
245 if(api_version == 20210220) {
250 if(api_version == 20191214) {
255 if(api_version == 20180713) {
260 if(api_version == 20170815) {
265 if(api_version == 20170327) {
270 if(api_version == 20150515) {
301 return static_cast<int>(same.select(1, 0)) - 1;
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_TPM_ERROR
@ 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
constexpr CT::Mask< T > is_equal(const T x[], const T y[], size_t len)
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()
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)
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 copy_mem(T *out, const T *in, size_t n)
constexpr void clear_mem(T *ptr, size_t n)