Botan  1.11.15
Namespaces | Defines | Functions
src/lib/utils/assert.h File Reference
#include <botan/build.h>

Go to the source code of this file.

Namespaces

namespace  Botan

Defines

#define BOTAN_ASSERT(expr, assertion_made)
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg)
#define BOTAN_ASSERT_NONNULL(ptr)
#define BOTAN_UNUSED(v)   static_cast<void>(v)

Functions

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

Define Documentation

#define BOTAN_ASSERT (   expr,
  assertion_made 
)
Value:
do {                                                   \
      if(!(expr))                                         \
         Botan::assertion_failure(#expr,                  \
                                  assertion_made,         \
                                  BOTAN_CURRENT_FUNCTION, \
                                  __FILE__,               \
                                  __LINE__);              \
   } while(0)

Make an assertion

Definition at line 27 of file assert.h.

Referenced by Botan::Output_Buffers::add(), Botan::mlock_allocator::allocate(), Botan::bigint_add2_nc(), Botan::bigint_monty_redc(), Botan::bigint_sub2(), Botan::bigint_sub2_rev(), Botan::bigint_sub3(), botan_cipher_start(), botan_cipher_update(), Botan::TLS::Channel::change_cipher_spec_reader(), Botan::TLS::Channel::change_cipher_spec_writer(), Botan::TLS::Client_Hello::Client_Hello(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Connection_Cipher_State::Connection_Cipher_State(), Botan::mlock_allocator::deallocate(), Botan::Threefish_512::decrypt_n(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::CCM_Mode::encode_length(), Botan::Threefish_512::encrypt_n(), Botan::ECB_Encryption::finish(), Botan::XTS_Encryption::finish(), Botan::CBC_Encryption::finish(), Botan::XTS_Decryption::finish(), Botan::SIV_Encryption::finish(), Botan::ECB_Decryption::finish(), Botan::CTS_Encryption::finish(), Botan::ChaCha20Poly1305_Decryption::finish(), Botan::CCM_Encryption::finish(), Botan::OCB_Encryption::finish(), Botan::SIV_Decryption::finish(), Botan::GCM_Decryption::finish(), Botan::CBC_Decryption::finish(), Botan::EAX_Decryption::finish(), Botan::CCM_Decryption::finish(), Botan::OCB_Decryption::finish(), Botan::CTS_Decryption::finish(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), 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::OCB_Decryption::output_length(), Botan::CCM_Decryption::output_length(), Botan::TLS::Channel::received_data(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::CCM_Mode::set_associated_data(), Botan::OCB_Mode::set_associated_data(), Botan::PK_Signer::signature(), Botan::TLS::Datagram_Handshake_IO::timeout_check(), Botan::SIV_Mode::update(), Botan::CCM_Mode::update(), Botan::ECB_Encryption::update(), Botan::XTS_Encryption::update(), Botan::ChaCha20Poly1305_Encryption::update(), Botan::CBC_Encryption::update(), Botan::CFB_Encryption::update(), Botan::GCM_Encryption::update(), Botan::XTS_Decryption::update(), Botan::ECB_Decryption::update(), Botan::EAX_Encryption::update(), Botan::CFB_Decryption::update(), Botan::ChaCha20Poly1305_Decryption::update(), Botan::OCB_Encryption::update(), Botan::GCM_Decryption::update(), Botan::CBC_Decryption::update(), Botan::EAX_Decryption::update(), Botan::OCB_Decryption::update(), Botan::GHASH::update(), Botan::TLS::Ciphersuite::valid(), and Botan::TLS::write_record().

#define BOTAN_ASSERT_EQUAL (   expr1,
  expr2,
  assertion_made 
)
Value:
do {                                                    \
     if((expr1) != (expr2))                                \
       Botan::assertion_failure(#expr1 " == " #expr2,      \
                                  assertion_made,          \
                                  BOTAN_CURRENT_FUNCTION,  \
                                  __FILE__,                \
                                  __LINE__);               \
   } while(0)

Assert that value1 == value2

Definition at line 40 of file assert.h.

Referenced by Botan::base64_encode(), Botan::TLS::Connection_Cipher_State::Connection_Cipher_State(), Botan::PBKDF::pbkdf_iterations(), and Botan::TLS::write_record().

#define BOTAN_ASSERT_IMPLICATION (   expr1,
  expr2,
  msg 
)
Value:
do {                                                    \
     if((expr1) && !(expr2))                               \
       Botan::assertion_failure(#expr1 " implies " #expr2, \
                                msg,                       \
                                  BOTAN_CURRENT_FUNCTION,  \
                                  __FILE__,                \
                                  __LINE__);               \
   } while(0)

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

Definition at line 53 of file assert.h.

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

#define BOTAN_ASSERT_NONNULL (   ptr)
Value:
do {                                                    \
      if(static_cast<bool>(ptr) == false)                  \
         Botan::assertion_failure(#ptr " is not null",     \
                                  "",                      \
                                  BOTAN_CURRENT_FUNCTION,  \
                                  __FILE__,                \
                                  __LINE__);               \
   } while(0)

Assert that a pointer is not null

Definition at line 66 of file assert.h.

Referenced by botan_pk_op_decrypt_create(), botan_pk_op_encrypt_create(), botan_pk_op_key_agreement_create(), botan_pk_op_sign_create(), botan_pk_op_verify_create(), Botan::TLS::Certificate_Verify::Certificate_Verify(), Botan::CBC_Mode::padding(), Botan::TLS::Server_Key_Exchange::server_kex_key(), and Botan::TLS::Server_Key_Exchange::server_srp_params().

#define BOTAN_UNUSED (   v)    static_cast<void>(v)

Mark variable as unused

Definition at line 79 of file assert.h.