Botan 3.14.1
Crypto and TLS for C&
ffi_util.h File Reference

Internal Header. More...

#include <botan/exceptn.h>
#include <botan/ffi.h>
#include <botan/internal/mem_utils.h>
#include <concepts>
#include <cstdint>
#include <cstring>
#include <exception>
#include <memory>
#include <type_traits>

Go to the source code of this file.

Classes

struct  Botan_FFI::botan_ffi_obj< T, MAGIC, PtrType >
struct  Botan_FFI::botan_ffi_obj_base
struct  Botan_FFI::botan_view_bounce_struct
class  Botan_FFI::FFI_Error
struct  Botan_FFI::detail::is_std_shared_pointer< T >
struct  Botan_FFI::detail::is_std_shared_pointer< std::shared_ptr< T > >
struct  Botan_FFI::detail::is_std_unique_pointer< T >
struct  Botan_FFI::detail::is_std_unique_pointer< std::unique_ptr< T, Deleter > >

Namespaces

namespace  Botan_FFI
namespace  Botan_FFI::detail

Concepts

concept  Botan_FFI::detail::ffi_visit_result
concept  Botan_FFI::detail::ffi_visitor_for
concept  Botan_FFI::ffi_object
concept  Botan_FFI::ffi_object_smart_pointer
concept  Botan_FFI::ffi_raw_visitor_fn
concept  Botan_FFI::ffi_sp_visitor_fn
concept  Botan_FFI::ffi_visitor_fn

Macros

#define BOTAN_FFI_CHECKED_DELETE(o)
#define BOTAN_FFI_DECLARE_DUMMY_STRUCT(NAME, MAGIC)
#define BOTAN_FFI_DECLARE_SHARED_STRUCT(NAME, TYPE, MAGIC)
#define BOTAN_FFI_DECLARE_UNIQUE_STRUCT(NAME, TYPE, MAGIC)
#define BOTAN_FFI_VISIT(obj, lambda)

Functions

template<typename... Ptrs>
bool Botan_FFI::any_null_pointers (Ptrs... ptr)
template<ffi_object HandleT, ffi_visitor_fn< HandleT > VisitorFnT>
int Botan_FFI::botan_ffi_visit (HandleT *o, VisitorFnT func, const char *func_name)
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)
template<std::integral T>
int Botan_FFI::check_and_prepare_output_space (T out[], size_t *out_len, size_t required_len)
template<typename Fn, typename... Args>
int Botan_FFI::copy_view_bin (uint8_t out[], size_t *out_len, Fn fn, Args... args)
template<typename Fn, typename... Args>
int Botan_FFI::copy_view_str (uint8_t out[], size_t *out_len, Fn fn, Args... args)
void Botan_FFI::ffi_clear_last_exception ()
template<ffi_object T>
int Botan_FFI::ffi_delete_object (T *obj, const char *func_name)
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)
template<std::invocable T>
int Botan_FFI::ffi_guard_thunk (const char *func_name, T thunk)
template<typename T, typename... Args>
BOTAN_FFI_ERROR Botan_FFI::ffi_new_object (T *obj, Args &&... args)
int Botan_FFI::invoke_view_callback (botan_view_bin_fn view, botan_view_ctx ctx, std::span< const uint8_t > buf)
int Botan_FFI::invoke_view_callback (botan_view_str_fn view, botan_view_ctx ctx, const std::string &str)
template<ffi_object T>
auto Botan_FFI::safe_get (T *p) -> typename T::element_type &
template<ffi_object T>
auto Botan_FFI::safe_get_sp (T *p) -> const typename T::smart_pointer_type &
template<std::integral T>
int Botan_FFI::write_output (T out[], size_t *out_len, const T buf[], size_t buf_len)
int Botan_FFI::write_str_output (char out[], size_t *out_len, const std::string &str)
int Botan_FFI::write_vec_output (uint8_t out[], size_t *out_len, std::span< const uint8_t > buf)

Detailed Description

Internal Header.

Definition in file ffi_util.h.

Macro Definition Documentation

◆ BOTAN_FFI_CHECKED_DELETE

◆ BOTAN_FFI_DECLARE_DUMMY_STRUCT

#define BOTAN_FFI_DECLARE_DUMMY_STRUCT ( NAME,
MAGIC )
Value:
struct NAME final : public Botan_FFI::botan_ffi_obj<int, MAGIC, std::unique_ptr> {}

Definition at line 174 of file ffi_util.h.

174#define BOTAN_FFI_DECLARE_DUMMY_STRUCT(NAME, MAGIC) \
175 struct NAME final : public Botan_FFI::botan_ffi_obj<int, MAGIC, std::unique_ptr> {}

◆ BOTAN_FFI_DECLARE_SHARED_STRUCT

#define BOTAN_FFI_DECLARE_SHARED_STRUCT ( NAME,
TYPE,
MAGIC )
Value:
struct NAME final : public Botan_FFI::botan_ffi_obj<TYPE, MAGIC, std::shared_ptr> { \
}
botan_ffi_obj(smart_pointer_type obj)
Definition ffi_util.h:122

Definition at line 169 of file ffi_util.h.

169#define BOTAN_FFI_DECLARE_SHARED_STRUCT(NAME, TYPE, MAGIC) \
170 struct NAME final : public Botan_FFI::botan_ffi_obj<TYPE, MAGIC, std::shared_ptr> { \
171 using botan_ffi_obj::botan_ffi_obj; \
172 }

◆ BOTAN_FFI_DECLARE_UNIQUE_STRUCT

#define BOTAN_FFI_DECLARE_UNIQUE_STRUCT ( NAME,
TYPE,
MAGIC )
Value:
struct NAME final : public Botan_FFI::botan_ffi_obj<TYPE, MAGIC, std::unique_ptr> { \
}

Definition at line 164 of file ffi_util.h.

164#define BOTAN_FFI_DECLARE_UNIQUE_STRUCT(NAME, TYPE, MAGIC) \
165 struct NAME final : public Botan_FFI::botan_ffi_obj<TYPE, MAGIC, std::unique_ptr> { \
166 using botan_ffi_obj::botan_ffi_obj; \
167 }

◆ BOTAN_FFI_VISIT

#define BOTAN_FFI_VISIT ( obj,
lambda )
Value:
botan_ffi_visit(obj, lambda, __func__)

Definition at line 327 of file ffi_util.h.

Referenced by botan_block_cipher_block_size(), botan_block_cipher_clear(), botan_block_cipher_decrypt_blocks(), botan_block_cipher_encrypt_blocks(), botan_block_cipher_get_keyspec(), botan_block_cipher_name(), botan_block_cipher_set_key(), botan_cipher_clear(), botan_cipher_get_default_nonce_length(), botan_cipher_get_ideal_update_granularity(), botan_cipher_get_keyspec(), botan_cipher_get_tag_length(), botan_cipher_get_update_granularity(), botan_cipher_is_authenticated(), botan_cipher_name(), botan_cipher_output_length(), botan_cipher_query_keylen(), botan_cipher_requires_entire_message(), botan_cipher_reset(), botan_cipher_set_associated_data(), botan_cipher_set_key(), botan_cipher_valid_nonce_length(), botan_ec_group_equal(), botan_ec_group_get_curve_oid(), botan_ec_group_unregister(), botan_ec_group_view_der(), botan_ec_group_view_pem(), botan_ec_point_add(), botan_ec_point_equal(), botan_ec_point_from_bytes(), botan_ec_point_generator(), botan_ec_point_get_group(), botan_ec_point_identity(), botan_ec_point_is_identity(), botan_ec_point_mul(), botan_ec_point_negate(), botan_ec_point_to_mp_xy(), botan_ec_point_view_compressed(), botan_ec_point_view_uncompressed(), botan_ec_point_view_x_bytes(), botan_ec_point_view_xy_bytes(), botan_ec_point_view_y_bytes(), botan_ec_scalar_from_mp(), botan_ec_scalar_get_group(), botan_ec_scalar_random(), botan_ec_scalar_to_mp(), botan_hash_block_size(), botan_hash_clear(), botan_hash_copy_state(), botan_hash_final(), botan_hash_name(), botan_hash_output_length(), botan_hash_security_level(), botan_hash_update(), botan_hotp_check(), botan_hotp_generate(), botan_mac_clear(), botan_mac_final(), botan_mac_get_keyspec(), botan_mac_name(), botan_mac_output_length(), botan_mac_set_key(), botan_mac_set_nonce(), botan_mac_update(), botan_mp_add(), botan_mp_add_u32(), botan_mp_clear(), botan_mp_clear_bit(), botan_mp_cmp(), botan_mp_div(), botan_mp_equal(), botan_mp_flip_sign(), botan_mp_from_bin(), botan_mp_gcd(), botan_mp_get_bit(), botan_mp_is_even(), botan_mp_is_negative(), botan_mp_is_odd(), botan_mp_is_positive(), botan_mp_is_prime(), botan_mp_is_zero(), botan_mp_lshift(), botan_mp_mod_inverse(), botan_mp_mod_mul(), botan_mp_mul(), botan_mp_num_bits(), botan_mp_num_bytes(), botan_mp_powmod(), botan_mp_rand_bits(), botan_mp_rand_range(), botan_mp_rshift(), botan_mp_set_bit(), botan_mp_set_from_int(), botan_mp_set_from_mp(), botan_mp_set_from_radix_str(), botan_mp_set_from_str(), botan_mp_sub(), botan_mp_sub_u32(), botan_mp_swap(), botan_mp_to_bin(), botan_mp_to_hex(), botan_mp_to_str(), botan_mp_to_uint32(), botan_mp_view_bin(), botan_mp_view_hex(), botan_mp_view_str(), botan_oid_cmp(), botan_oid_equal(), botan_oid_register(), botan_oid_view_name(), botan_oid_view_string(), botan_pk_op_decrypt(), botan_pk_op_decrypt_output_length(), botan_pk_op_encrypt(), botan_pk_op_encrypt_output_length(), botan_pk_op_kem_decrypt_shared_key(), botan_pk_op_kem_decrypt_shared_key_length(), botan_pk_op_kem_encrypt_create_shared_key(), botan_pk_op_kem_encrypt_encapsulated_key_length(), botan_pk_op_kem_encrypt_shared_key_length(), botan_pk_op_key_agreement(), botan_pk_op_key_agreement_size(), botan_pk_op_key_agreement_view_public(), botan_pk_op_sign_finish(), botan_pk_op_sign_output_length(), botan_pk_op_sign_update(), botan_pk_op_verify_finish(), botan_pk_op_verify_update(), botan_privkey_algo_name(), botan_privkey_check_key(), botan_privkey_ed25519_get_privkey(), botan_privkey_ed448_get_privkey(), botan_privkey_get_field(), botan_privkey_oid(), botan_privkey_remaining_operations(), botan_privkey_rsa_get_privkey(), botan_privkey_stateful_operation(), botan_privkey_view_der(), botan_privkey_view_encrypted_der(), botan_privkey_view_encrypted_der_timed(), botan_privkey_view_encrypted_pem(), botan_privkey_view_encrypted_pem_timed(), botan_privkey_view_kyber_raw_key(), botan_privkey_view_pem(), botan_privkey_view_raw(), botan_privkey_x25519_get_privkey(), botan_privkey_x448_get_privkey(), botan_pubkey_algo_name(), botan_pubkey_check_key(), botan_pubkey_ed25519_get_pubkey(), botan_pubkey_ed448_get_pubkey(), botan_pubkey_estimated_strength(), botan_pubkey_fingerprint(), botan_pubkey_get_field(), botan_pubkey_oid(), botan_pubkey_view_der(), botan_pubkey_view_ec_public_point(), botan_pubkey_view_kyber_raw_key(), botan_pubkey_view_pem(), botan_pubkey_view_raw(), botan_pubkey_x25519_get_pubkey(), botan_pubkey_x448_get_pubkey(), botan_rng_add_entropy(), botan_rng_generate_with_input(), botan_rng_get(), botan_rng_reseed(), botan_rng_reseed_from_rng(), botan_spake2p_params_confirmation_size(), botan_spake2p_params_share_size(), botan_spake2p_prover_generate_message(), botan_spake2p_prover_process_message(), botan_spake2p_prover_shared_secret(), botan_spake2p_verifier_process_message(), botan_spake2p_verifier_shared_secret(), botan_spake2p_verifier_skip_confirmation(), botan_spake2p_verifier_verify_confirmation(), botan_srp6_server_session_step1(), botan_srp6_server_session_step2(), botan_tls_credentials_add_cert_chain(), botan_tls_credentials_add_crl(), botan_tls_credentials_add_trusted_cert(), botan_tls_credentials_add_trusted_dir(), botan_tls_credentials_use_system_store(), botan_tls_policy_view_text(), botan_totp_check(), botan_totp_generate(), botan_tpm2_ctx_enable_crypto_backend(), botan_tpm2_rng_init(), botan_tpm2_unauthenticated_session_init(), botan_x509_cert_allowed_extended_usage_oid(), botan_x509_cert_allowed_extended_usage_str(), botan_x509_cert_allowed_usage(), botan_x509_cert_excluded_name_constraints(), botan_x509_cert_excluded_name_constraints_count(), botan_x509_cert_get_authority_key_id(), botan_x509_cert_get_fingerprint(), botan_x509_cert_get_issuer_dn(), botan_x509_cert_get_issuer_dn_count(), botan_x509_cert_get_path_length_constraint(), botan_x509_cert_get_serial_number(), botan_x509_cert_get_subject_dn(), botan_x509_cert_get_subject_dn_count(), botan_x509_cert_get_subject_key_id(), botan_x509_cert_get_time_expires(), botan_x509_cert_get_time_starts(), botan_x509_cert_hostname_match(), botan_x509_cert_is_ca(), botan_x509_cert_issuer_alternative_names(), botan_x509_cert_issuer_alternative_names_count(), botan_x509_cert_not_after(), botan_x509_cert_not_before(), botan_x509_cert_permitted_name_constraints(), botan_x509_cert_permitted_name_constraints_count(), botan_x509_cert_serial_number(), botan_x509_cert_subject_alternative_names(), botan_x509_cert_subject_alternative_names_count(), botan_x509_cert_view_as_string(), botan_x509_cert_view_binary_values(), botan_x509_cert_view_public_key_bits(), botan_x509_cert_view_string_values(), botan_x509_crl_entries(), botan_x509_crl_entries_count(), botan_x509_crl_entry_reason(), botan_x509_crl_entry_revocation_date(), botan_x509_crl_entry_serial_number(), botan_x509_crl_entry_view_serial_number(), botan_x509_crl_next_update(), botan_x509_crl_this_update(), botan_x509_crl_verify_signature(), botan_x509_crl_view_binary_values(), botan_x509_crl_view_issuer_dn(), botan_x509_crl_view_issuer_dn_count(), botan_x509_crl_view_string_values(), botan_x509_general_name_get_type(), botan_x509_general_name_view_binary_value(), botan_x509_general_name_view_string_value(), botan_x509_is_revoked(), botan_xof_accepts_input(), botan_xof_block_size(), botan_xof_clear(), botan_xof_copy_state(), botan_xof_name(), botan_xof_output(), and botan_xof_update().