diff options
-rw-r--r-- | src/codec/base64/base64.cpp | 4 | ||||
-rw-r--r-- | src/credentials/credentials_manager.h | 2 | ||||
-rw-r--r-- | src/filters/modes/mode_pad/mode_pad.cpp | 2 | ||||
-rw-r--r-- | src/filters/out_buf.cpp | 7 | ||||
-rw-r--r-- | src/kdf/prf_ssl3/prf_ssl3.cpp | 3 | ||||
-rw-r--r-- | src/pubkey/dl_group/dl_group.cpp | 2 | ||||
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.cpp | 5 | ||||
-rw-r--r-- | src/pubkey/ecdh/ecdh.cpp | 2 | ||||
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 4 | ||||
-rw-r--r-- | src/pubkey/pubkey.cpp | 3 | ||||
-rw-r--r-- | src/pubkey/rsa/rsa.cpp | 2 | ||||
-rw-r--r-- | src/tls/c_kex.cpp | 2 | ||||
-rw-r--r-- | src/tls/s_kex.cpp | 6 | ||||
-rw-r--r-- | src/tls/tls_channel.cpp | 2 | ||||
-rw-r--r-- | src/utils/assert.cpp | 8 |
15 files changed, 29 insertions, 25 deletions
diff --git a/src/codec/base64/base64.cpp b/src/codec/base64/base64.cpp index 719a3e8fa..b66c4f207 100644 --- a/src/codec/base64/base64.cpp +++ b/src/codec/base64/base64.cpp @@ -86,8 +86,8 @@ std::string base64_encode(const byte input[], input, input_length, consumed, true); - BOTAN_ASSERT_EQUAL(consumed, input_length, "Did not consume all input"); - BOTAN_ASSERT_EQUAL(produced, output.size(), "Did not produce right amount"); + BOTAN_ASSERT_EQUAL(consumed, input_length, "Consumed the entire input"); + BOTAN_ASSERT_EQUAL(produced, output.size(), "Produced expected size"); return output; } diff --git a/src/credentials/credentials_manager.h b/src/credentials/credentials_manager.h index 9ae978048..7510aa91c 100644 --- a/src/credentials/credentials_manager.h +++ b/src/credentials/credentials_manager.h @@ -32,6 +32,8 @@ class BOTAN_DLL Credentials_Manager /** * Return a list of the certificates of CAs that we trust in this * type/context. + * @param context specifies a context relative to type. For instance + * for type "tls-client", context specifies the servers name. */ virtual std::vector<X509_Certificate> trusted_certificate_authorities( const std::string& type, diff --git a/src/filters/modes/mode_pad/mode_pad.cpp b/src/filters/modes/mode_pad/mode_pad.cpp index f5d544e92..03de987e9 100644 --- a/src/filters/modes/mode_pad/mode_pad.cpp +++ b/src/filters/modes/mode_pad/mode_pad.cpp @@ -28,7 +28,7 @@ void PKCS7_Padding::pad(byte block[], size_t size, size_t position) const const byte pad_value = static_cast<byte>(bytes_remaining); BOTAN_ASSERT_EQUAL(pad_value, bytes_remaining, - "Overflow in PKCS7_Padding"); + "PKCS7 pad values match bytes remaining"); for(size_t j = 0; j != size; ++j) block[j] = pad_value; diff --git a/src/filters/out_buf.cpp b/src/filters/out_buf.cpp index b1dc8ff7f..134f6a308 100644 --- a/src/filters/out_buf.cpp +++ b/src/filters/out_buf.cpp @@ -52,10 +52,10 @@ size_t Output_Buffers::remaining(Pipe::message_id msg) const */ void Output_Buffers::add(SecureQueue* queue) { - BOTAN_ASSERT(queue, "argument was NULL"); + BOTAN_ASSERT(queue, "queue was provided"); BOTAN_ASSERT(buffers.size() < buffers.max_size(), - "No more room in container"); + "Room was available in container"); buffers.push_back(queue); } @@ -87,8 +87,7 @@ SecureQueue* Output_Buffers::get(Pipe::message_id msg) const if(msg < offset) return nullptr; - BOTAN_ASSERT(msg < message_count(), - "Message number out of range"); + BOTAN_ASSERT(msg < message_count(), "Message number is in range"); return buffers[msg-offset]; } diff --git a/src/kdf/prf_ssl3/prf_ssl3.cpp b/src/kdf/prf_ssl3/prf_ssl3.cpp index 8475bf40a..984bd1176 100644 --- a/src/kdf/prf_ssl3/prf_ssl3.cpp +++ b/src/kdf/prf_ssl3/prf_ssl3.cpp @@ -25,7 +25,8 @@ OctetString next_hash(size_t where, size_t want, const byte secret[], size_t secret_len, const byte seed[], size_t seed_len) { - BOTAN_ASSERT(want <= md5.output_length(), "Desired output too large"); + BOTAN_ASSERT(want <= md5.output_length(), + "Output size producable by MD5"); const byte ASCII_A_CHAR = 0x41; diff --git a/src/pubkey/dl_group/dl_group.cpp b/src/pubkey/dl_group/dl_group.cpp index cf89abc8d..a6bea3bbc 100644 --- a/src/pubkey/dl_group/dl_group.cpp +++ b/src/pubkey/dl_group/dl_group.cpp @@ -322,7 +322,7 @@ BigInt DL_Group::make_dsa_generator(const BigInt& p, const BigInt& q) { BigInt g, e = (p - 1) / q; - BOTAN_ASSERT(e > 0, "q does not divide p, invalid group"); + BOTAN_ASSERT(e > 0, "q divides p-1"); for(size_t i = 0; i != PRIME_TABLE_SIZE; ++i) { diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index 2b6deea44..367b27584 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -93,7 +93,7 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng, public_key = domain().get_base_point() * private_key; BOTAN_ASSERT(public_key.on_the_curve(), - "ECC private key was not on the curve"); + "Generated public key point was on the curve"); } secure_vector<byte> EC_PrivateKey::pkcs8_private_key() const @@ -130,8 +130,9 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id, if(public_key_bits.empty()) { public_key = domain().get_base_point() * private_key; + BOTAN_ASSERT(public_key.on_the_curve(), - "Public key derived from private key was on the curve"); + "Public point derived from loaded key was on the curve"); } else { diff --git a/src/pubkey/ecdh/ecdh.cpp b/src/pubkey/ecdh/ecdh.cpp index 511dd0678..5a42f4a49 100644 --- a/src/pubkey/ecdh/ecdh.cpp +++ b/src/pubkey/ecdh/ecdh.cpp @@ -27,7 +27,7 @@ secure_vector<byte> ECDH_KA_Operation::agree(const byte w[], size_t w_len) PointGFp S = (cofactor * point) * l_times_priv; BOTAN_ASSERT(S.on_the_curve(), - "ECDH agreed value not on the curve"); + "ECDH agreed value was on the curve"); return BigInt::encode_1363(S.get_affine_x(), curve.get_p().bytes()); diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 289cdcac4..19287d2cf 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -76,7 +76,7 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id, public_key = PointGFp(domain().get_curve(), x, y); BOTAN_ASSERT(public_key.on_the_curve(), - "Loaded GOST 34.10 public key not on the curve"); + "Loaded GOST 34.10 public key is on the curve"); } namespace { @@ -120,7 +120,7 @@ GOST_3410_Signature_Operation::sign(const byte msg[], size_t msg_len, PointGFp k_times_P = base_point * k; BOTAN_ASSERT(k_times_P.on_the_curve(), - "GOST 34.10 k*g not on the curve"); + "GOST 34.10 k*g is on the curve"); BigInt r = k_times_P.get_affine_x() % order; diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp index c27cf4a05..8430e2c7b 100644 --- a/src/pubkey/pubkey.cpp +++ b/src/pubkey/pubkey.cpp @@ -214,8 +214,7 @@ std::vector<byte> PK_Signer::signature(RandomNumberGenerator& rng) std::vector<byte> plain_sig = unlock(op->sign(&encoded[0], encoded.size(), rng)); - BOTAN_ASSERT(self_test_signature(encoded, plain_sig), - "PK_Signer consistency check failed"); + BOTAN_ASSERT(self_test_signature(encoded, plain_sig), "Signature was consistent"); if(op->message_parts() == 1 || sig_format == IEEE_1363) return plain_sig; diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp index 8b121f013..48243c9f9 100644 --- a/src/pubkey/rsa/rsa.cpp +++ b/src/pubkey/rsa/rsa.cpp @@ -112,7 +112,7 @@ RSA_Private_Operation::decrypt(const byte msg[], size_t msg_len) BigInt x = blinder.unblind(private_op(blinder.blind(m))); BOTAN_ASSERT(m == powermod_e_n(x), - "RSA private op failed consistency check"); + "RSA decrypt passed consistency check"); return BigInt::encode_locked(x); } diff --git a/src/tls/c_kex.cpp b/src/tls/c_kex.cpp index 54c5af5c3..836edf8ce 100644 --- a/src/tls/c_kex.cpp +++ b/src/tls/c_kex.cpp @@ -276,7 +276,7 @@ Client_Key_Exchange::Client_Key_Exchange(const std::vector<byte>& contents, if(kex_algo == "RSA") { BOTAN_ASSERT(state->server_certs && !state->server_certs->cert_chain().empty(), - "No server certificate to use for RSA"); + "RSA key exchange negotiated so server sent a certificate"); const Private_Key* private_key = state->server_rsa_kex_key; diff --git a/src/tls/s_kex.cpp b/src/tls/s_kex.cpp index 694462082..e6ea14dbe 100644 --- a/src/tls/s_kex.cpp +++ b/src/tls/s_kex.cpp @@ -123,7 +123,7 @@ Server_Key_Exchange::Server_Key_Exchange(Record_Writer& writer, if(state->suite.sig_algo() != "") { - BOTAN_ASSERT(signing_key, "No signing key set"); + BOTAN_ASSERT(signing_key, "Signing key was set"); std::pair<std::string, Signature_Format> format = state->choose_sig_format(signing_key, m_hash_algo, m_sig_algo, false, policy); @@ -279,14 +279,14 @@ bool Server_Key_Exchange::verify(const X509_Certificate& cert, const Private_Key& Server_Key_Exchange::server_kex_key() const { - BOTAN_ASSERT(m_kex_key, "Key is non-NULL"); + BOTAN_ASSERT_NONNULL(m_kex_key); return *m_kex_key; } // Only valid for SRP negotiation SRP6_Server_Session& Server_Key_Exchange::server_srp_params() { - BOTAN_ASSERT(m_srp_params, "SRP params are non-NULL"); + BOTAN_ASSERT_NONNULL(m_srp_params); return *m_srp_params; } } diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp index e3188cafa..1b4cb407e 100644 --- a/src/tls/tls_channel.cpp +++ b/src/tls/tls_channel.cpp @@ -181,7 +181,7 @@ void Channel::read_handshake(byte rec_type, m_state->handshake_reader()->add_input(&rec_buf[0], rec_buf.size()); } - BOTAN_ASSERT(m_state, "Handshake message recieved without state in place"); + BOTAN_ASSERT_NONNULL(m_state); while(true) { diff --git a/src/utils/assert.cpp b/src/utils/assert.cpp index 4b69b4420..91356f15b 100644 --- a/src/utils/assert.cpp +++ b/src/utils/assert.cpp @@ -1,6 +1,6 @@ /* * Runtime assertion checking -* (C) 2010 Jack Lloyd +* (C) 2010,2012 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -19,10 +19,12 @@ void assertion_failure(const char* expr_str, { std::ostringstream format; - format << "Assertion " << expr_str << " failed "; + format << "False assertion "; if(assertion_made && assertion_made[0] != 0) - format << "(" << assertion_made << ") "; + format << "'" << assertion_made << "' (expression " << expr_str << ") "; + else + format << expr_str << " "; if(func) format << "in " << func << " "; |