aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2015-12-22 21:50:43 +0100
committerDaniel Neus <[email protected]>2015-12-22 21:50:43 +0100
commitaedb8d8ef646ed480296eb0a53513c74475cef08 (patch)
treeb57a9fc558d859baf39730278b7f56d881c31e6e
parenta589d7a2ede70871d3f563ed34cdd3c10046e5c2 (diff)
some trivial compiler/PVS-Studio warning fixes
-rw-r--r--src/build-data/buildh.in2
-rw-r--r--src/cli/cli.h2
-rw-r--r--src/lib/cert/x509/x509_obj.cpp2
-rw-r--r--src/lib/cert/x509/x509path.cpp2
-rw-r--r--src/lib/stream/rc4/rc4.cpp2
-rw-r--r--src/lib/tls/msg_client_kex.cpp2
-rw-r--r--src/lib/utils/http_util/http_util.cpp1
-rw-r--r--src/tests/test_aead.cpp6
-rw-r--r--src/tests/test_bigint.cpp2
-rw-r--r--src/tests/test_fuzzer.cpp2
-rw-r--r--src/tests/test_mceliece.cpp2
-rw-r--r--src/tests/test_pubkey.cpp2
-rw-r--r--src/tests/test_utils.cpp2
-rw-r--r--src/tests/tests.cpp6
-rw-r--r--src/tests/unit_ecc.cpp9
-rw-r--r--src/tests/unit_ecdsa.cpp2
-rw-r--r--src/tests/unit_tls.cpp4
17 files changed, 21 insertions, 29 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index c6c4f9064..967e067e4 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -22,7 +22,7 @@
#define BOTAN_DISTRIBUTION_INFO "%{distribution_info}"
-#define BOTAN_INSTALL_PREFIX "%{prefix}"
+#define BOTAN_INSTALL_PREFIX R"(%{prefix})"
#define BOTAN_INSTALL_HEADER_DIR "%{includedir}/botan-%{version_major}.%{version_minor}"
#define BOTAN_INSTALL_LIB_DIR "%{libdir}"
#define BOTAN_LIB_LINK "%{link_to}"
diff --git a/src/cli/cli.h b/src/cli/cli.h
index fdc83e97b..df7e345f5 100644
--- a/src/cli/cli.h
+++ b/src/cli/cli.h
@@ -371,7 +371,7 @@ class Command
{
return static_cast<size_t>(std::stoul(s));
}
- catch(std::exception& e)
+ catch(std::exception&)
{
throw CLI_Usage_Error("Invalid integer value '" + s + "' for option " + opt_name);
}
diff --git a/src/lib/cert/x509/x509_obj.cpp b/src/lib/cert/x509/x509_obj.cpp
index 4dae68607..e908e8cab 100644
--- a/src/lib/cert/x509/x509_obj.cpp
+++ b/src/lib/cert/x509/x509_obj.cpp
@@ -201,7 +201,7 @@ bool X509_Object::check_signature(const Public_Key& pub_key) const
return verifier.verify_message(tbs_data(), signature());
}
- catch(std::exception& e)
+ catch(std::exception&)
{
return false;
}
diff --git a/src/lib/cert/x509/x509path.cpp b/src/lib/cert/x509/x509path.cpp
index 7e54ad9f9..5e12ddb2a 100644
--- a/src/lib/cert/x509/x509path.cpp
+++ b/src/lib/cert/x509/x509path.cpp
@@ -170,7 +170,7 @@ check_chain(const std::vector<X509_Certificate>& cert_path,
else if(ocsp_status == Certificate_Status_Code::OCSP_RESPONSE_GOOD)
continue;
}
- catch(std::exception& e)
+ catch(std::exception&)
{
//std::cout << "OCSP error: " << e.what() << "\n";
}
diff --git a/src/lib/stream/rc4/rc4.cpp b/src/lib/stream/rc4/rc4.cpp
index 6146e2818..d94bf8164 100644
--- a/src/lib/stream/rc4/rc4.cpp
+++ b/src/lib/stream/rc4/rc4.cpp
@@ -111,6 +111,6 @@ void RC4::clear()
/*
* RC4 Constructor
*/
-RC4::RC4(size_t s) : SKIP(s), X(0), Y(0) {}
+RC4::RC4(size_t s) : SKIP(s), X(0), Y(0), state(), buffer(), position(0) {}
}
diff --git a/src/lib/tls/msg_client_kex.cpp b/src/lib/tls/msg_client_kex.cpp
index 7ce9b9df2..68809f22f 100644
--- a/src/lib/tls/msg_client_kex.cpp
+++ b/src/lib/tls/msg_client_kex.cpp
@@ -365,7 +365,7 @@ Client_Key_Exchange::Client_Key_Exchange(const std::vector<byte>& contents,
else
m_pre_master = shared_secret;
}
- catch(std::exception &e)
+ catch(std::exception &)
{
/*
* Something failed in the DH computation. To avoid possible
diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp
index 1f67c0b4b..6d4e7c8e8 100644
--- a/src/lib/utils/http_util/http_util.cpp
+++ b/src/lib/utils/http_util/http_util.cpp
@@ -98,7 +98,6 @@ Response http_sync(http_exch_fn http_transact,
const auto protocol_host_sep = url.find("://");
if(protocol_host_sep == std::string::npos)
throw Exception("Invalid URL " + url);
- const std::string protocol = url.substr(0, protocol_host_sep);
const auto host_loc_sep = url.find('/', protocol_host_sep + 3);
diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp
index 5d7e1094e..a31996fad 100644
--- a/src/tests/test_aead.cpp
+++ b/src/tests/test_aead.cpp
@@ -71,7 +71,7 @@ class AEAD_Tests : public Text_Based_Test
dec->finish(buf);
result.test_failure("accepted modified message", mutated_input);
}
- catch(Botan::Integrity_Failure& e)
+ catch(Botan::Integrity_Failure&)
{
result.test_note("correctly rejected modified message");
}
@@ -93,7 +93,7 @@ class AEAD_Tests : public Text_Based_Test
dec->finish(buf);
result.test_failure("accepted message with modified nonce", bad_nonce);
}
- catch(Botan::Integrity_Failure& e)
+ catch(Botan::Integrity_Failure&)
{
result.test_note("correctly rejected modified nonce");
}
@@ -115,7 +115,7 @@ class AEAD_Tests : public Text_Based_Test
dec->finish(buf);
result.test_failure("accepted message with modified ad", bad_ad);
}
- catch(Botan::Integrity_Failure& e)
+ catch(Botan::Integrity_Failure&)
{
result.test_note("correctly rejected modified ad");
}
diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp
index 5eaa0d0f1..6599b89b3 100644
--- a/src/tests/test_bigint.cpp
+++ b/src/tests/test_bigint.cpp
@@ -63,7 +63,7 @@ class BigInt_Unit_Tests : public Test
a.to_u32bit();
result.test_failure("BigInt::to_u32bit roundtripped out of range value");
}
- catch(std::exception& e)
+ catch(std::exception&)
{
result.test_success("BigInt::to_u32bit rejected out of range");
}
diff --git a/src/tests/test_fuzzer.cpp b/src/tests/test_fuzzer.cpp
index eba49a1ae..3a5dcc47c 100644
--- a/src/tests/test_fuzzer.cpp
+++ b/src/tests/test_fuzzer.cpp
@@ -58,7 +58,7 @@ class Fuzzer_Input_Tests : public Test
// TODO: check for memory consumption?
Botan::X509_Certificate cert(vec_file);
}
- catch(std::exception& e)
+ catch(std::exception&)
{
}
diff --git a/src/tests/test_mceliece.cpp b/src/tests/test_mceliece.cpp
index d3c646504..d894f2045 100644
--- a/src/tests/test_mceliece.cpp
+++ b/src/tests/test_mceliece.cpp
@@ -222,7 +222,7 @@ class McEliece_Tests : public Test
result.test_failure("AEAD decrypted manipulated ciphertext");
result.test_note("Manipulated text was " + Botan::hex_encode(bad_ct));
}
- catch(Botan::Integrity_Failure& e)
+ catch(Botan::Integrity_Failure&)
{
result.test_note("AEAD rejected manipulated ciphertext");
}
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp
index fa6146bf8..14f36dbbd 100644
--- a/src/tests/test_pubkey.cpp
+++ b/src/tests/test_pubkey.cpp
@@ -74,7 +74,7 @@ void check_invalid_ciphertexts(Test::Result& result,
result.test_eq("used corrupted ciphertext", bad_ctext, ciphertext);
}
}
- catch(std::exception& e)
+ catch(std::exception&)
{
++ciphertext_rejected;
}
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp
index 16b1848ef..47f740a17 100644
--- a/src/tests/test_utils.cpp
+++ b/src/tests/test_utils.cpp
@@ -305,7 +305,7 @@ class Base64_Tests : public Text_Based_Test
{
result.test_failure("decoded whitespace base64", Botan::base64_decode(b64_ws, false));
}
- catch(std::exception& e) {}
+ catch(std::exception&) {}
try
{
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 4d035c0c8..b9d99b1ce 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -512,7 +512,7 @@ std::vector<uint8_t> Text_Based_Test::get_req_bin(const VarMap& vars,
{
return Botan::hex_decode(i->second);
}
- catch(std::exception& e)
+ catch(std::exception&)
{
throw Test_Error("Test invalid hex input '" + i->second + "'" +
+ " for key " + key);
@@ -556,7 +556,7 @@ std::vector<uint8_t> Text_Based_Test::get_opt_bin(const VarMap& vars,
{
return Botan::hex_decode(i->second);
}
- catch(std::exception& e)
+ catch(std::exception&)
{
throw Test_Error("Test invalid hex input '" + i->second + "'" +
+ " for key " + key);
@@ -583,7 +583,7 @@ Botan::BigInt Text_Based_Test::get_req_bn(const VarMap& vars,
{
return Botan::BigInt(i->second);
}
- catch(std::exception& e)
+ catch(std::exception&)
{
throw Test_Error("Test invalid bigint input '" + i->second + "' for key " + key);
}
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index 92dee8ba4..5b4d9058e 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -523,7 +523,6 @@ Test::Result test_enc_dec_compressed_256()
std::string a_secp = "ffffffff00000001000000000000000000000000ffffffffffffffffffffffFC";
std::string b_secp = "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
std::string G_secp_comp = "036B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
- std::string G_order_secp_comp = "ffffffff00000000ffffffffffffffffBCE6FAADA7179E84F3B9CAC2FC632551";
std::vector<byte> sv_p_secp = Botan::hex_decode ( p_secp );
std::vector<byte> sv_a_secp = Botan::hex_decode ( a_secp );
@@ -554,7 +553,6 @@ Test::Result test_enc_dec_uncompressed_112()
std::string a_secp = "6127C24C05F38A0AAAF65C0EF02C";
std::string b_secp = "51DEF1815DB5ED74FCC34C85D709";
std::string G_secp_uncomp = "044BA30AB5E892B4E1649DD0928643ADCD46F5882E3747DEF36E956E97";
- std::string G_order_secp_uncomp = "36DF0AAFD8B8D7597CA10520D04B";
std::vector<byte> sv_p_secp = Botan::hex_decode ( p_secp );
std::vector<byte> sv_a_secp = Botan::hex_decode ( a_secp );
@@ -583,7 +581,6 @@ Test::Result test_enc_dec_uncompressed_521()
std::string a_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
std::string b_secp = "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
std::string G_secp_uncomp = "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
- std::string G_order_secp_uncomp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409";
std::vector<byte> sv_p_secp = Botan::hex_decode ( p_secp );
std::vector<byte> sv_a_secp = Botan::hex_decode ( a_secp );
@@ -613,7 +610,6 @@ Test::Result test_enc_dec_uncompressed_521_prime_too_large()
std::string a_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
std::string b_secp = "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
std::string G_secp_uncomp = "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
- std::string G_order_secp_uncomp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409";
std::vector<byte> sv_p_secp = Botan::hex_decode ( p_secp );
std::vector<byte> sv_a_secp = Botan::hex_decode ( a_secp );
@@ -632,7 +628,7 @@ Test::Result test_enc_dec_uncompressed_521_prime_too_large()
p_G = std::unique_ptr<Botan::PointGFp>(new Botan::PointGFp(Botan::OS2ECP ( sv_G_secp_uncomp, secp521r1)));
result.test_failure("point decoding with too large value accepted");
}
- catch(std::exception& e)
+ catch(std::exception&)
{
result.test_note("rejected invalid point");
}
@@ -684,9 +680,6 @@ Test::Result test_more_zeropoint()
Botan::EC_Group secp160r1(Botan::OIDS::lookup("secp160r1"));
const Botan::CurveGFp& curve = secp160r1.get_curve();
- std::string G = "024a96b5688ef573284664698968c38bb913cbfc82";
- std::vector<byte> sv_G_secp_comp = Botan::hex_decode ( G );
-
Botan::PointGFp p1(curve,
Botan::BigInt("16984103820118642236896513183038186009872590470"),
Botan::BigInt("1373093393927139016463695321221277758035357890939"));
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index 66c2610f8..5b750e7fb 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -284,7 +284,7 @@ Test::Result test_read_pkcs8()
result.test_failure("loaded key with unknown OID");
}
- catch(std::exception& e)
+ catch(std::exception&)
{
result.test_note("rejected key with unknown OID");
}
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp
index 0ff85bb29..3996b36b0 100644
--- a/src/tests/unit_tls.cpp
+++ b/src/tests/unit_tls.cpp
@@ -530,7 +530,7 @@ Test::Result test_dtls_handshake(Botan::TLS::Protocol_Version offer_version,
needed = client.received_data(input.data(), input.size());
}
}
- catch(std::exception& e)
+ catch(std::exception&)
{
result.test_note("corruption caused server exception");
}
@@ -570,7 +570,7 @@ Test::Result test_dtls_handshake(Botan::TLS::Protocol_Version offer_version,
needed = client.received_data(input.data(), input.size());
}
}
- catch(std::exception& e)
+ catch(std::exception&)
{
result.test_note("corruption caused client exception");
}