|
Botan 3.12.0
Crypto and TLS for C&
|
#include <botan/ffi.h>#include <botan/base64.h>#include <botan/hex.h>#include <botan/mem_ops.h>#include <botan/version.h>#include <botan/internal/ct_utils.h>#include <botan/internal/ffi_util.h>#include <cstdio>Go to the source code of this file.
Namespaces | |
| namespace | Botan_FFI |
Functions | |
| int | botan_base64_decode (const char *base64_str, size_t in_len, uint8_t *out, size_t *out_len) |
| int | botan_base64_encode (const uint8_t *in, size_t len, char *out, size_t *out_len) |
| int | botan_constant_time_compare (const uint8_t *x, const uint8_t *y, size_t len) |
| const char * | botan_error_description (int err) |
| const char * | botan_error_last_exception_message () |
| uint32_t | botan_ffi_api_version () |
| int | botan_ffi_supports_api (uint32_t api_version) |
| int | botan_hex_decode (const char *hex_str, size_t in_len, uint8_t *out, size_t *out_len) |
| int | botan_hex_encode (const uint8_t *in, size_t len, char *out, uint32_t flags) |
| int | botan_same_mem (const uint8_t *x, const uint8_t *y, size_t len) |
| int | botan_scrub_mem (void *mem, size_t bytes) |
| uint32_t | botan_version_datestamp () |
| uint32_t | botan_version_major () |
| uint32_t | botan_version_minor () |
| uint32_t | botan_version_patch () |
| const char * | botan_version_string () |
| int | Botan_FFI::botan_view_bin_bounce_fn (botan_view_ctx vctx, const uint8_t *buf, size_t len) |
| int | Botan_FFI::botan_view_str_bounce_fn (botan_view_ctx vctx, const char *str, size_t len) |
| void | Botan_FFI::ffi_clear_last_exception () |
| int | Botan_FFI::ffi_error_exception_thrown (const char *func_name, const char *exn, Botan::ErrorType err) |
| int | Botan_FFI::ffi_error_exception_thrown (const char *func_name, const char *exn, int rc) |
| int botan_base64_decode | ( | const char * | base64_str, |
| size_t | in_len, | ||
| uint8_t * | out, | ||
| size_t * | out_len ) |
Perform base64 decoding
Definition at line 370 of file ffi.cpp.
References Botan_FFI::any_null_pointers(), Botan::base64_decode(), Botan::base64_decode_max_output(), botan_base64_decode(), BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, and Botan_FFI::ffi_guard_thunk().
Referenced by botan_base64_decode().
| int botan_base64_encode | ( | const uint8_t * | x, |
| size_t | len, | ||
| char * | out, | ||
| size_t * | out_len ) |
Perform base64 encoding
| x | the input data |
| len | the length of x |
| out | the output buffer |
| out_len | the size of the output buffer on input, set to the number of bytes written |
Definition at line 360 of file ffi.cpp.
References Botan::base64_encode(), botan_base64_encode(), BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::write_str_output().
Referenced by botan_base64_encode().
| int botan_constant_time_compare | ( | const uint8_t * | x, |
| const uint8_t * | y, | ||
| size_t | len ) |
Returns 0 if x[0..len] == y[0..len], or otherwise -1
Definition at line 318 of file ffi.cpp.
References Botan_FFI::any_null_pointers(), botan_constant_time_compare(), BOTAN_FFI_ERROR_NULL_POINTER, and Botan::CT::is_equal().
Referenced by botan_constant_time_compare(), and botan_same_mem().
| const char * botan_error_description | ( | int | err | ) |
Convert an error code into a string. Returns "Unknown error" if the error code is not a known one.
Definition at line 142 of file ffi.cpp.
References botan_error_description(), BOTAN_FFI_ERROR_BAD_FLAG, BOTAN_FFI_ERROR_BAD_MAC, BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_HTTP_ERROR, BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE, BOTAN_FFI_ERROR_INTERNAL_ERROR, BOTAN_FFI_ERROR_INVALID_INPUT, BOTAN_FFI_ERROR_INVALID_KEY_LENGTH, BOTAN_FFI_ERROR_INVALID_OBJECT, BOTAN_FFI_ERROR_INVALID_OBJECT_STATE, BOTAN_FFI_ERROR_KEY_NOT_SET, BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_MEMORY, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR, BOTAN_FFI_ERROR_SYSTEM_ERROR, BOTAN_FFI_ERROR_TLS_ERROR, BOTAN_FFI_ERROR_UNKNOWN_ERROR, BOTAN_FFI_INVALID_VERIFIER, and BOTAN_FFI_SUCCESS.
Referenced by botan_error_description().
| const char * botan_error_last_exception_message | ( | void | ) |
Return the message of the last exception caught in this thread.
This pointer can/will be reallocated or overwritten the next time this thread calls any other Botan FFI function and must be copied to persistent storage first.
Definition at line 138 of file ffi.cpp.
References botan_error_last_exception_message().
Referenced by botan_error_last_exception_message().
| uint32_t botan_ffi_api_version | ( | void | ) |
Return the version of the currently supported FFI API. This is expressed in the form YYYYMMDD of the release date of this version of the API.
Definition at line 219 of file ffi.cpp.
References botan_ffi_api_version(), and BOTAN_HAS_FFI.
Referenced by botan_ffi_api_version().
| int botan_ffi_supports_api | ( | uint32_t | api_version | ) |
Return 0 (ok) if the version given is one this library supports. botan_ffi_supports_api(botan_ffi_api_version()) will always return 0.
Definition at line 223 of file ffi.cpp.
References BOTAN_FFI_SUCCESS, and botan_ffi_supports_api().
Referenced by botan_ffi_supports_api().
| int botan_hex_decode | ( | const char * | hex_str, |
| size_t | in_len, | ||
| uint8_t * | out, | ||
| size_t * | out_len ) |
Perform hex decoding
| hex_str | a string of hex chars (whitespace is ignored) |
| in_len | the length of hex_str |
| out | the output buffer should be at least strlen(hex_str)/2 bytes |
| out_len | the size of the output buffer on input, set to the number of bytes written |
Definition at line 350 of file ffi.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, botan_hex_decode(), Botan_FFI::ffi_guard_thunk(), Botan::hex_decode(), and Botan_FFI::write_vec_output().
Referenced by botan_hex_decode().
| int botan_hex_encode | ( | const uint8_t * | x, |
| size_t | len, | ||
| char * | out, | ||
| uint32_t | flags ) |
Perform hex encoding
| x | is some binary data |
| len | length of x in bytes |
| out | an array of at least x*2 bytes |
| flags | flags out be upper or lower case? |
Definition at line 339 of file ffi.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_HEX_LOWER_CASE, BOTAN_FFI_SUCCESS, botan_hex_encode(), Botan_FFI::ffi_guard_thunk(), and Botan::hex_encode().
Referenced by botan_hex_encode().
| int botan_same_mem | ( | const uint8_t * | x, |
| const uint8_t * | y, | ||
| size_t | len ) |
Deprecated equivalent to botan_constant_time_compare
Definition at line 327 of file ffi.cpp.
References botan_constant_time_compare(), and botan_same_mem().
Referenced by botan_same_mem().
| int botan_scrub_mem | ( | void * | mem, |
| size_t | bytes ) |
Clear out memory using a system specific approach to bypass elision by the compiler (currently using RtlSecureZeroMemory or tricks with volatile pointers).
Definition at line 331 of file ffi.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, botan_scrub_mem(), and Botan::secure_scrub_memory().
Referenced by botan_scrub_mem().
| uint32_t botan_version_datestamp | ( | void | ) |
Return the date this version was released as an integer.
Returns 0 if the library was not built from an official release
Definition at line 314 of file ffi.cpp.
References botan_version_datestamp(), and Botan::version_datestamp().
Referenced by botan_version_datestamp().
| uint32_t botan_version_major | ( | void | ) |
Return the major version of the library
Definition at line 302 of file ffi.cpp.
References botan_version_major(), and Botan::version_major().
Referenced by botan_version_major().
| uint32_t botan_version_minor | ( | void | ) |
Return the minor version of the library
Definition at line 306 of file ffi.cpp.
References botan_version_minor(), and Botan::version_minor().
Referenced by botan_version_minor().
| uint32_t botan_version_patch | ( | void | ) |
Return the patch version of the library
Definition at line 310 of file ffi.cpp.
References botan_version_patch(), and Botan::version_patch().
Referenced by botan_version_patch().
| const char * botan_version_string | ( | void | ) |
Return a free-form version string, e.g., 2.0.0
Definition at line 298 of file ffi.cpp.
References botan_version_string(), and Botan::version_cstr().
Referenced by botan_version_string().