Botan  2.4.0
Crypto and TLS for C++11
Namespaces | Macros | Functions
assert.h File Reference
#include <botan/build.h>
#include <botan/compiler.h>

Go to the source code of this file.

Namespaces

 Botan
 

Macros

#define _BOTAN_UNUSED_GET_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, IMPL_NAME, ...)   IMPL_NAME
 
#define _BOTAN_UNUSED_IMPL1(a)   static_cast<void>(a)
 
#define _BOTAN_UNUSED_IMPL2(a, b)   static_cast<void>(a); _BOTAN_UNUSED_IMPL1(b)
 
#define _BOTAN_UNUSED_IMPL3(a, b, c)   static_cast<void>(a); _BOTAN_UNUSED_IMPL2(b, c)
 
#define _BOTAN_UNUSED_IMPL4(a, b, c, d)   static_cast<void>(a); _BOTAN_UNUSED_IMPL3(b, c, d)
 
#define _BOTAN_UNUSED_IMPL5(a, b, c, d, e)   static_cast<void>(a); _BOTAN_UNUSED_IMPL4(b, c, d, e)
 
#define _BOTAN_UNUSED_IMPL6(a, b, c, d, e, f)   static_cast<void>(a); _BOTAN_UNUSED_IMPL5(b, c, d, e, f)
 
#define _BOTAN_UNUSED_IMPL7(a, b, c, d, e, f, g)   static_cast<void>(a); _BOTAN_UNUSED_IMPL6(b, c, d, e, f, g)
 
#define _BOTAN_UNUSED_IMPL8(a, b, c, d, e, f, g, h)   static_cast<void>(a); _BOTAN_UNUSED_IMPL7(b, c, d, e, f, g, h)
 
#define _BOTAN_UNUSED_IMPL9(a, b, c, d, e, f, g, h, i)   static_cast<void>(a); _BOTAN_UNUSED_IMPL8(b, c, d, e, f, g, h, i)
 
#define BOTAN_ASSERT(expr, assertion_made)
 
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
 
#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg)
 
#define BOTAN_ASSERT_NOMSG(expr)
 
#define BOTAN_ASSERT_NONNULL(ptr)
 
#define BOTAN_UNUSED(...)
 

Functions

void Botan::assertion_failure (const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
 

Macro Definition Documentation

◆ _BOTAN_UNUSED_GET_IMPL

#define _BOTAN_UNUSED_GET_IMPL (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7,
  _8,
  _9,
  IMPL_NAME,
  ... 
)    IMPL_NAME

Definition at line 104 of file assert.h.

◆ _BOTAN_UNUSED_IMPL1

#define _BOTAN_UNUSED_IMPL1 (   a)    static_cast<void>(a)

Mark variable as unused. Takes between 1 and 9 arguments and marks all as unused, e.g. BOTAN_UNUSED(a); or BOTAN_UNUSED(x, y, z);

Definition at line 95 of file assert.h.

◆ _BOTAN_UNUSED_IMPL2

#define _BOTAN_UNUSED_IMPL2 (   a,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL1(b)

Definition at line 96 of file assert.h.

◆ _BOTAN_UNUSED_IMPL3

#define _BOTAN_UNUSED_IMPL3 (   a,
  b,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL2(b, c)

Definition at line 97 of file assert.h.

◆ _BOTAN_UNUSED_IMPL4

#define _BOTAN_UNUSED_IMPL4 (   a,
  b,
  c,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL3(b, c, d)

Definition at line 98 of file assert.h.

◆ _BOTAN_UNUSED_IMPL5

#define _BOTAN_UNUSED_IMPL5 (   a,
  b,
  c,
  d,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL4(b, c, d, e)

Definition at line 99 of file assert.h.

◆ _BOTAN_UNUSED_IMPL6

#define _BOTAN_UNUSED_IMPL6 (   a,
  b,
  c,
  d,
  e,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL5(b, c, d, e, f)

Definition at line 100 of file assert.h.

◆ _BOTAN_UNUSED_IMPL7

#define _BOTAN_UNUSED_IMPL7 (   a,
  b,
  c,
  d,
  e,
  f,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL6(b, c, d, e, f, g)

Definition at line 101 of file assert.h.

◆ _BOTAN_UNUSED_IMPL8

#define _BOTAN_UNUSED_IMPL8 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL7(b, c, d, e, f, g, h)

Definition at line 102 of file assert.h.

◆ _BOTAN_UNUSED_IMPL9

#define _BOTAN_UNUSED_IMPL9 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    static_cast<void>(a); _BOTAN_UNUSED_IMPL8(b, c, d, e, f, g, h, i)

Definition at line 103 of file assert.h.

◆ BOTAN_ASSERT

#define BOTAN_ASSERT (   expr,
  assertion_made 
)
Value:
do { \
if(!(expr)) \
assertion_made, \
__FILE__, \
__LINE__); \
} while(0)
#define BOTAN_CURRENT_FUNCTION
Definition: compiler.h:143
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:13

Make an assertion

Definition at line 29 of file assert.h.

Referenced by Botan::Output_Buffers::add(), Botan::mlock_allocator::allocate(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::assoc_data_with_len(), Botan::bigint_add2_nc(), Botan::bigint_monty_redc(), Botan::bigint_sqr(), Botan::bigint_sub2(), Botan::bigint_sub2_rev(), Botan::bigint_sub3(), botan_cipher_update(), Botan::TLS::Ciphersuite::by_id(), Botan::TLS::Channel::change_cipher_spec_reader(), Botan::TLS::Channel::change_cipher_spec_writer(), Botan::Stream_Compression::clear(), Botan::Stream_Decompression::clear(), Botan::TLS::Client_Hello::Client_Hello(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::X509_Time::cmp(), Botan::TLS::Connection_Cipher_State::Connection_Cipher_State(), Botan::BigInt::const_time_lookup(), Botan::Sqlite3_Database::create_table(), Botan::ct_inverse_mod_odd_modulus(), Botan::PK_Decryptor::decrypt_or_random(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::ECIES_Decryptor::ECIES_Decryptor(), Botan::ECIES_Encryptor::ECIES_Encryptor(), Botan::polyn_gf2m::eea_with_coefficients(), Botan::OID::encode_into(), Botan::CCM_Mode::encode_length(), Botan::polyn_gf2m::eval(), Botan::XTS_Encryption::finish(), Botan::CBC_Encryption::finish(), Botan::XTS_Decryption::finish(), Botan::CCM_Encryption::finish(), Botan::SIV_Encryption::finish(), Botan::ChaCha20Poly1305_Decryption::finish(), Botan::CTS_Encryption::finish(), Botan::OCB_Encryption::finish(), Botan::SIV_Decryption::finish(), Botan::EAX_Decryption::finish(), Botan::CCM_Decryption::finish(), Botan::CBC_Decryption::finish(), Botan::OCB_Decryption::finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish(), Botan::CTS_Decryption::finish(), Botan::Stream_Compression::finish(), Botan::XMSS_WOTS_PrivateKey::generate_public_key(), Botan::XMSS_Address::get_chain_address(), Botan::XMSS_Address::get_hash_address(), Botan::XMSS_Address::get_ltree_address(), Botan::XMSS_Address::get_ots_address(), Botan::XMSS_Address::get_tree_height(), Botan::XMSS_Address::get_tree_index(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::TLS::Datagram_Handshake_IO::initial_record_version(), Botan::CPUID::initialize(), Botan::mceies_encrypt(), Botan::TLS::Datagram_Sequence_Numbers::next_write_sequence(), Botan::GHASH::nonce_hash(), Botan::operator*(), Botan::ChaCha20Poly1305_Decryption::output_length(), Botan::GCM_Decryption::output_length(), Botan::EAX_Decryption::output_length(), Botan::SIV_Decryption::output_length(), Botan::CCM_Decryption::output_length(), Botan::OCB_Decryption::output_length(), Botan::XTS_Encryption::process(), Botan::CBC_Encryption::process(), Botan::XTS_Decryption::process(), Botan::OCB_Encryption::process(), Botan::CBC_Decryption::process(), Botan::OCB_Decryption::process(), Botan::ChaCha::provider(), Botan::XMSS_Common_Ops::randomize_tree_hash(), Botan::TLS::Channel::received_data(), Botan::redc_p521(), Botan::Stateful_RNG::reseed_check(), Botan::Output_Buffers::retire(), Botan::round_up(), Botan::TLS::Server::Server(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::CCM_Mode::set_associated_data(), Botan::OCB_Mode::set_associated_data(), Botan::XMSS_Address::set_chain_address(), Botan::XMSS_Address::set_hash_address(), Botan::XMSS_Address::set_key_mask_mode(), Botan::XMSS_Address::set_layer_addr(), Botan::XMSS_Address::set_ltree_address(), Botan::XMSS_Address::set_ots_address(), Botan::XMSS_Address::set_tree_addr(), Botan::XMSS_Address::set_tree_height(), Botan::XMSS_Address::set_tree_index(), Botan::TLS::Compat_Callbacks::tls_alert(), Botan::TLS::Compat_Callbacks::tls_emit_data(), Botan::TLS::Compat_Callbacks::tls_record_received(), Botan::TLS::Compat_Callbacks::tls_session_established(), Botan::XMSS_PrivateKey::tree_hash(), Botan::GHASH::update(), Botan::Cipher_Mode::update(), Botan::Stream_Compression::update(), Botan::TLS::write_record(), Botan::XMSS_Address::XMSS_Address(), Botan::XMSS_Hash::XMSS_Hash(), Botan::XMSS_PrivateKey::XMSS_PrivateKey(), Botan::XMSS_Signature::XMSS_Signature(), Botan::XMSS_WOTS_Parameters::XMSS_WOTS_Parameters(), and Botan::TLS::Channel::~Channel().

◆ BOTAN_ASSERT_EQUAL

#define BOTAN_ASSERT_EQUAL (   expr1,
  expr2,
  assertion_made 
)
Value:
do { \
if((expr1) != (expr2)) \
Botan::assertion_failure(#expr1 " == " #expr2, \
assertion_made, \
__FILE__, \
__LINE__); \
} while(0)
#define BOTAN_CURRENT_FUNCTION
Definition: compiler.h:143
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:13

Assert that value1 == value2

Definition at line 55 of file assert.h.

Referenced by Botan::aont_package(), Botan::aont_unpackage(), Botan::base64_encode(), Botan::TLS::Connection_Cipher_State::Connection_Cipher_State(), Botan::TLS::Connection_Cipher_State::format_ad(), Botan::ASN1::maybe_BER(), Botan::monty_inverse(), Botan::PBKDF::pbkdf_iterations(), Botan::redc_p521(), and Botan::TLS::write_record().

◆ BOTAN_ASSERT_IMPLICATION

#define BOTAN_ASSERT_IMPLICATION (   expr1,
  expr2,
  msg 
)
Value:
do { \
if((expr1) && !(expr2)) \
Botan::assertion_failure(#expr1 " implies " #expr2, \
msg, \
__FILE__, \
__LINE__); \
} while(0)
#define BOTAN_CURRENT_FUNCTION
Definition: compiler.h:143
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:13

Assert that expr1 (if true) implies expr2 is also true

Definition at line 68 of file assert.h.

Referenced by Botan::TLS::Blocking_Client::read().

◆ BOTAN_ASSERT_NOMSG

#define BOTAN_ASSERT_NOMSG (   expr)
Value:
do { \
if(!(expr)) \
"", \
__FILE__, \
__LINE__); \
} while(0)
#define BOTAN_CURRENT_FUNCTION
Definition: compiler.h:143
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:13

Make an assertion

Definition at line 42 of file assert.h.

◆ BOTAN_ASSERT_NONNULL

#define BOTAN_ASSERT_NONNULL (   ptr)

◆ BOTAN_UNUSED

#define BOTAN_UNUSED (   ...)
Value:
_BOTAN_UNUSED_GET_IMPL(__VA_ARGS__, \
unused dummy rest value \
) /* we got an one of _BOTAN_UNUSED_IMPL*, now call it */ (__VA_ARGS__)
#define _BOTAN_UNUSED_IMPL6(a, b, c, d, e, f)
Definition: assert.h:100
#define _BOTAN_UNUSED_IMPL5(a, b, c, d, e)
Definition: assert.h:99
#define _BOTAN_UNUSED_IMPL9(a, b, c, d, e, f, g, h, i)
Definition: assert.h:103
#define _BOTAN_UNUSED_GET_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, IMPL_NAME,...)
Definition: assert.h:104
#define _BOTAN_UNUSED_IMPL3(a, b, c)
Definition: assert.h:97
#define _BOTAN_UNUSED_IMPL8(a, b, c, d, e, f, g, h)
Definition: assert.h:102
#define _BOTAN_UNUSED_IMPL7(a, b, c, d, e, f, g)
Definition: assert.h:101
#define _BOTAN_UNUSED_IMPL1(a)
Definition: assert.h:95
#define _BOTAN_UNUSED_IMPL2(a, b)
Definition: assert.h:96
#define _BOTAN_UNUSED_IMPL4(a, b, c, d)
Definition: assert.h:98

Definition at line 106 of file assert.h.

Referenced by Botan::OS::allocate_locked_pages(), Botan::CPUID::bit_from_string(), botan_privkey_ed25519_get_privkey(), botan_privkey_load_dh(), botan_privkey_load_dsa(), botan_privkey_load_ecdh(), botan_privkey_load_ecdsa(), botan_privkey_load_ed25519(), botan_privkey_load_elgamal(), botan_privkey_load_rsa(), botan_privkey_load_sm2(), botan_privkey_load_sm2_enc(), botan_pubkey_ed25519_get_pubkey(), botan_pubkey_load_dh(), botan_pubkey_load_dsa(), botan_pubkey_load_ecdh(), botan_pubkey_load_ecdsa(), botan_pubkey_load_ed25519(), botan_pubkey_load_elgamal(), botan_pubkey_load_rsa(), botan_pubkey_load_sm2(), botan_pubkey_load_sm2_enc(), Botan::PKCS8::copy_key(), Botan::BlockCipher::create(), Botan::PBKDF::create(), Botan::StreamCipher::create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::Entropy_Source::create(), Botan::create_private_key(), Botan::get_files_recursive(), Botan::SP800_56A_Hash::kdf(), Botan::PKCS8::load_key(), Botan::make_compressor(), Botan::make_decompressor(), Botan::CT::poison(), Botan::probe_provider_private_key(), Botan::MessageAuthenticationCode::start_msg(), Botan::TLS::Callbacks::tls_log_debug(), Botan::TLS::Callbacks::tls_log_debug_bin(), Botan::TLS::Callbacks::tls_log_error(), and Botan::CT::unpoison().