diff options
author | Jack Lloyd <[email protected]> | 2017-10-02 23:55:55 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-02 23:55:55 -0400 |
commit | 8c700bcf093b82a29e93f79932e4f1542818186a (patch) | |
tree | 1ac3548255490fc01fd6d6ee366b2029b16b18f4 | |
parent | a0a27808005346ef151ea7b07550dc03434b9e84 (diff) |
Remove various unused variables
Sonar finds
-rw-r--r-- | src/cli/timing_tests.cpp | 2 | ||||
-rw-r--r-- | src/cli/tls_server.cpp | 1 | ||||
-rw-r--r-- | src/lib/ffi/ffi_pkey_algs.cpp | 1 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_state.cpp | 2 | ||||
-rw-r--r-- | src/lib/x509/name_constraint.cpp | 1 | ||||
-rw-r--r-- | src/tests/test_bigint.cpp | 3 | ||||
-rw-r--r-- | src/tests/test_c25519.cpp | 6 | ||||
-rw-r--r-- | src/tests/test_cryptobox.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_tpm.cpp | 1 | ||||
-rw-r--r-- | src/tests/unit_ecc.cpp | 4 |
10 files changed, 9 insertions, 14 deletions
diff --git a/src/cli/timing_tests.cpp b/src/cli/timing_tests.cpp index 73296e230..3ea82c746 100644 --- a/src/cli/timing_tests.cpp +++ b/src/cli/timing_tests.cpp @@ -280,6 +280,8 @@ ticks ECDSA_Timing_Test::measure_critical_function(std::vector<uint8_t> input) const Botan::PointGFp k_times_P = m_base_point.blinded_multiply(k, Timing_Test::timing_test_rng()); const Botan::BigInt r = m_mod_order.reduce(k_times_P.get_affine_x()); const Botan::BigInt s = m_mod_order.multiply(inverse_mod(k, m_order), mul_add(m_x, r, msg)); + BOTAN_UNUSED(r); + BOTAN_UNUSED(s); ticks end = get_ticks(); diff --git a/src/cli/tls_server.cpp b/src/cli/tls_server.cpp index 0d3dca785..703967641 100644 --- a/src/cli/tls_server.cpp +++ b/src/cli/tls_server.cpp @@ -91,7 +91,6 @@ class TLS_Server final : public Command std::unique_ptr<Botan::TLS::Policy> policy; const std::string policy_file = get_arg("policy"); - std::filebuf fb; if(policy_file.size() > 0) { std::ifstream policy_stream(policy_file); diff --git a/src/lib/ffi/ffi_pkey_algs.cpp b/src/lib/ffi/ffi_pkey_algs.cpp index 36f7f25a5..0b8c8f712 100644 --- a/src/lib/ffi/ffi_pkey_algs.cpp +++ b/src/lib/ffi/ffi_pkey_algs.cpp @@ -95,7 +95,6 @@ int pubkey_load_ec(std::unique_ptr<ECPublicKey_t>& key, if(curve_name == nullptr) return BOTAN_FFI_ERROR_NULL_POINTER; - Botan::Null_RNG null_rng; Botan::EC_Group grp(curve_name); Botan::PointGFp uncompressed_point(grp.get_curve(), public_x, public_y); key.reset(new ECPublicKey_t(grp, uncompressed_point)); diff --git a/src/lib/tls/tls_handshake_state.cpp b/src/lib/tls/tls_handshake_state.cpp index 9262650e8..5fcfb08c7 100644 --- a/src/lib/tls/tls_handshake_state.cpp +++ b/src/lib/tls/tls_handshake_state.cpp @@ -437,8 +437,6 @@ Handshake_State::choose_sig_format(const Private_Key& key, { // We skip this check for v1.0 since you're stuck with SHA-1 regardless - std::vector<std::string> allowed_hashes = policy.allowed_signature_hashes(); - if(!policy.allowed_signature_hash(hash_algo)) { throw TLS_Exception(Alert::HANDSHAKE_FAILURE, diff --git a/src/lib/x509/name_constraint.cpp b/src/lib/x509/name_constraint.cpp index 98f5e05a7..e27dca9ec 100644 --- a/src/lib/x509/name_constraint.cpp +++ b/src/lib/x509/name_constraint.cpp @@ -67,7 +67,6 @@ void GeneralName::decode_from(class BER_Decoder& ber) else if(tag == 4) { X509_DN dn; - std::multimap<std::string, std::string> nam; BER_Decoder dec(obj.value); std::stringstream ss; diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp index 80d95a8ee..6ee802408 100644 --- a/src/tests/test_bigint.cpp +++ b/src/tests/test_bigint.cpp @@ -269,7 +269,6 @@ class BigInt_Add_Test final : public Text_Based_Test const BigInt a = get_req_bn(vars, "In1"); const BigInt b = get_req_bn(vars, "In2"); const BigInt c = get_req_bn(vars, "Output"); - BigInt d = a + b; result.test_eq("a + b", a + b, c); result.test_eq("b + a", b + a, c); @@ -302,8 +301,6 @@ class BigInt_Sub_Test final : public Text_Based_Test const BigInt b = get_req_bn(vars, "In2"); const BigInt c = get_req_bn(vars, "Output"); - BigInt d = a - b; - result.test_eq("a - b", a - b, c); BigInt e = a; diff --git a/src/tests/test_c25519.cpp b/src/tests/test_c25519.cpp index e7c3cff8a..8c8129a18 100644 --- a/src/tests/test_c25519.cpp +++ b/src/tests/test_c25519.cpp @@ -55,11 +55,11 @@ class Curve25519_Roundtrip_Test final : public Test Botan::Curve25519_PrivateKey a_priv_gen(Test::rng()); Botan::Curve25519_PrivateKey b_priv_gen(Test::rng()); +#if defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_AEAD_GCM) + // Then serialize to encrypted storage + const std::string a_pass = "alice pass"; const std::string b_pass = "bob pass"; - - // Then serialize to encrypted storage -#if defined(BOTAN_HAS_AES) && defined(BOTAN_HAS_GCM) const auto pbe_time = std::chrono::milliseconds(10); const std::string a_priv_pem = Botan::PKCS8::PEM_encode(a_priv_gen, Test::rng(), a_pass, pbe_time); const std::string b_priv_pem = Botan::PKCS8::PEM_encode(b_priv_gen, Test::rng(), b_pass, pbe_time); diff --git a/src/tests/test_cryptobox.cpp b/src/tests/test_cryptobox.cpp index 927c5c379..6d1d22314 100644 --- a/src/tests/test_cryptobox.cpp +++ b/src/tests/test_cryptobox.cpp @@ -49,7 +49,7 @@ class Cryptobox_Tests final : public Test { std::string corrupted = ciphertext; corrupted[corrupted.size()/2]++; - const std::string decrypted = Botan::CryptoBox::decrypt(corrupted, password); + Botan::CryptoBox::decrypt(corrupted, password); result.test_failure("Decrypted corrupted cryptobox message"); } catch(Botan::Decoding_Error) diff --git a/src/tests/test_tpm.cpp b/src/tests/test_tpm.cpp index c29c642a1..4117b8086 100644 --- a/src/tests/test_tpm.cpp +++ b/src/tests/test_tpm.cpp @@ -99,6 +99,7 @@ class UUID_Tests final : public Test result.confirm("UUID copied by binary equals original", random_uuid == binary_copy); std::string uuid_str = random_uuid.to_string(); + result.test_eq("UUID string in expected format", uuid_str.size(), 36); const Botan::UUID string_copy(random_uuid.to_string()); result.confirm("UUID copied by string equals original", random_uuid == string_copy); diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp index f78f6bfd6..74592d0a8 100644 --- a/src/tests/unit_ecc.cpp +++ b/src/tests/unit_ecc.cpp @@ -279,11 +279,11 @@ Test::Result test_coordinates() const Botan::EC_Group secp160r1(Botan::OIDS::lookup("secp160r1")); const Botan::CurveGFp& curve = secp160r1.get_curve(); const Botan::PointGFp& p_G = secp160r1.get_base_point(); - const Botan::PointGFp p0 = p_G; - const Botan::PointGFp p1 = p_G * 2; + const Botan::PointGFp point_exp(curve, exp_affine_x, exp_affine_y); result.confirm("Point is on the curve", point_exp.on_the_curve()); + const Botan::PointGFp p1 = p_G * 2; result.test_eq("Point affine x", p1.get_affine_x(), exp_affine_x); result.test_eq("Point affine y", p1.get_affine_y(), exp_affine_y); return result; |