From 5bca595410d5f91473b4ded90a6ac923e46ea97c Mon Sep 17 00:00:00 2001 From: Nuno Goncalves Date: Sun, 20 Oct 2019 11:58:19 +0200 Subject: silence trivial warnings Signed-off-by: Nuno Goncalves --- src/cli/tls_helpers.h | 2 ++ src/lib/misc/roughtime/roughtime.cpp | 2 +- src/lib/pubkey/rsa/rsa.cpp | 4 ++-- src/lib/tls/msg_cert_verify.cpp | 1 + src/lib/tls/msg_server_kex.cpp | 1 + src/lib/tls/tls_record.cpp | 1 + src/lib/utils/cpuid/cpuid_arm.cpp | 2 ++ src/lib/utils/os_utils.cpp | 1 + src/lib/utils/socket/socket.cpp | 3 +++ src/lib/utils/socket/socket_udp.cpp | 3 +++ src/lib/utils/socket/uri.cpp | 1 + src/tests/test_modes.cpp | 4 ++-- src/tests/test_pubkey.cpp | 2 ++ 13 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cli/tls_helpers.h b/src/cli/tls_helpers.h index 9a8517e45..653a106e0 100644 --- a/src/cli/tls_helpers.h +++ b/src/cli/tls_helpers.h @@ -50,6 +50,8 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager { m_certstores.push_back(std::make_shared()); } +#else + BOTAN_UNUSED(use_system_store); #endif } diff --git a/src/lib/misc/roughtime/roughtime.cpp b/src/lib/misc/roughtime/roughtime.cpp index 435308cd0..671b78cb4 100644 --- a/src/lib/misc/roughtime/roughtime.cpp +++ b/src/lib/misc/roughtime/roughtime.cpp @@ -162,7 +162,7 @@ Nonce::Nonce(RandomNumberGenerator& rng) std::array encode_request(const Nonce& nonce) { - std::array buf = {2, 0, 0, 0, 64, 0, 0, 0, 'N', 'O', 'N', 'C', 'P', 'A', 'D', 0xff}; + std::array buf = {{2, 0, 0, 0, 64, 0, 0, 0, 'N', 'O', 'N', 'C', 'P', 'A', 'D', 0xff}}; std::memcpy(buf.data() + 16, nonce.get_nonce().data(), nonce.get_nonce().size()); std::memset(buf.data() + 16 + nonce.get_nonce().size(), 0, buf.size() - 16 - nonce.get_nonce().size()); return buf; diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp index 830b1a5e8..fa88b497f 100644 --- a/src/lib/pubkey/rsa/rsa.cpp +++ b/src/lib/pubkey/rsa/rsa.cpp @@ -396,7 +396,7 @@ class RSA_Private_Operation the "Smooth RSA-CRT" method. https://eprint.iacr.org/2007/039.pdf */ - const size_t powm_window = 4; + static constexpr size_t powm_window = 4; // Compute this in main thread to avoid racing on the rng const BigInt d1_mask(m_blinder.rng(), m_blinding_bits); @@ -413,7 +413,7 @@ class RSA_Private_Operation */ m.sig_words(); - auto future_j1 = std::async(std::launch::async, [this, &m, &d1_mask, powm_window]() { + auto future_j1 = std::async(std::launch::async, [this, &m, &d1_mask]() { #endif const BigInt masked_d1 = m_private->get_d1() + (d1_mask * (m_private->get_p() - 1)); auto powm_d1_p = monty_precompute(m_private->m_monty_p, m_private->m_mod_p.reduce(m), powm_window); diff --git a/src/lib/tls/msg_cert_verify.cpp b/src/lib/tls/msg_cert_verify.cpp index 021185003..711566bd0 100644 --- a/src/lib/tls/msg_cert_verify.cpp +++ b/src/lib/tls/msg_cert_verify.cpp @@ -98,6 +98,7 @@ bool Certificate_Verify::verify(const X509_Certificate& cert, state.hash().get_contents(), m_signature); #if defined(BOTAN_UNSAFE_FUZZER_MODE) + BOTAN_UNUSED(signature_valid); return true; #else return signature_valid; diff --git a/src/lib/tls/msg_server_kex.cpp b/src/lib/tls/msg_server_kex.cpp index 1b42cba99..797907ed8 100644 --- a/src/lib/tls/msg_server_kex.cpp +++ b/src/lib/tls/msg_server_kex.cpp @@ -316,6 +316,7 @@ bool Server_Key_Exchange::verify(const Public_Key& server_key, buf, m_signature); #if defined(BOTAN_UNSAFE_FUZZER_MODE) + BOTAN_UNUSED(signature_valid); return true; #else return signature_valid; diff --git a/src/lib/tls/tls_record.cpp b/src/lib/tls/tls_record.cpp index 71f942bc4..c662d1fe5 100644 --- a/src/lib/tls/tls_record.cpp +++ b/src/lib/tls/tls_record.cpp @@ -71,6 +71,7 @@ Connection_Cipher_State::Connection_Cipher_State(Protocol_Version version, } #else + BOTAN_UNUSED(uses_encrypt_then_mac); throw Internal_Error("Negotiated disabled TLS CBC+HMAC ciphersuite"); #endif } diff --git a/src/lib/utils/cpuid/cpuid_arm.cpp b/src/lib/utils/cpuid/cpuid_arm.cpp index bc9ac5daa..6c947c62b 100644 --- a/src/lib/utils/cpuid/cpuid_arm.cpp +++ b/src/lib/utils/cpuid/cpuid_arm.cpp @@ -145,6 +145,8 @@ uint64_t CPUID::CPUID_Data::detect_cpu_features(size_t* cache_line_size) // plausibility check if(dcache_line == 32 || dcache_line == 64 || dcache_line == 128) *cache_line_size = static_cast(dcache_line); +#else + BOTAN_UNUSED(cache_line_size); #endif const unsigned long hwcap_neon = OS::get_auxval(ARM_hwcap_bit::ARCH_hwcap_neon); diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp index 84a2d0ebe..72de063e8 100644 --- a/src/lib/utils/os_utils.cpp +++ b/src/lib/utils/os_utils.cpp @@ -315,6 +315,7 @@ size_t OS::system_page_size() else return default_page_size; #elif defined(BOTAN_TARGET_OS_HAS_VIRTUAL_LOCK) + BOTAN_UNUSED(default_page_size); SYSTEM_INFO sys_info; ::GetSystemInfo(&sys_info); return sys_info.dwPageSize; diff --git a/src/lib/utils/socket/socket.cpp b/src/lib/utils/socket/socket.cpp index 54033bc55..3c742c3ca 100644 --- a/src/lib/utils/socket/socket.cpp +++ b/src/lib/utils/socket/socket.cpp @@ -358,6 +358,9 @@ OS::open_socket(const std::string& hostname, return std::unique_ptr(new BSD_Socket(hostname, service, timeout)); #else + BOTAN_UNUSED(hostname); + BOTAN_UNUSED(service); + BOTAN_UNUSED(timeout); // No sockets for you return std::unique_ptr(); #endif diff --git a/src/lib/utils/socket/socket_udp.cpp b/src/lib/utils/socket/socket_udp.cpp index 651fe1b0c..6e7cb1f11 100644 --- a/src/lib/utils/socket/socket_udp.cpp +++ b/src/lib/utils/socket/socket_udp.cpp @@ -320,6 +320,9 @@ OS::open_socket_udp(const std::string& hostname, #elif defined(BOTAN_TARGET_OS_HAS_SOCKETS) || defined(BOTAN_TARGET_OS_HAS_WINSOCK2) return std::unique_ptr(new BSD_SocketUDP(hostname, service, timeout)); #else + BOTAN_UNUSED(hostname); + BOTAN_UNUSED(service); + BOTAN_UNUSED(timeout); return std::unique_ptr(); #endif } diff --git a/src/lib/utils/socket/uri.cpp b/src/lib/utils/socket/uri.cpp index f8506d0e7..05bd8647d 100644 --- a/src/lib/utils/socket/uri.cpp +++ b/src/lib/utils/socket/uri.cpp @@ -28,6 +28,7 @@ bool isDomain(const std::string& domain) { #if defined(__GLIBCXX__) && (__GLIBCXX__ < 20160726) // GCC 4.8 does not support regex + BOTAN_UNUSED(domain); return true; #else std::regex re( diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp index b371c476b..9f6f493c0 100644 --- a/src/tests/test_modes.cpp +++ b/src/tests/test_modes.cpp @@ -145,10 +145,10 @@ class Cipher_Mode_Tests final : public Text_Based_Test mode.valid_nonce_length(mode.default_nonce_length())); // Test that disallowed nonce sizes result in an exception - const size_t large_nonce_size = 65000; + static constexpr size_t large_nonce_size = 65000; result.test_eq("Large nonce not allowed", mode.valid_nonce_length(large_nonce_size), false); result.test_throws("Large nonce causes exception", - [&mode,large_nonce_size]() { mode.start(nullptr, large_nonce_size); }); + [&mode]() { mode.start(nullptr, large_nonce_size); }); Botan::secure_vector garbage = Test::rng().random_vec(update_granularity); diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index c3a44a57d..6e1f331c7 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -539,6 +539,7 @@ std::vector PK_Key_Generation_Test::possible_providers( namespace { +#if defined(BOTAN_HAS_PKCS5_PBES2) && defined(BOTAN_HAS_AES) && (defined(BOTAN_HAS_SHA2_32) || defined(BOTAN_HAS_SCRYPT)) void test_pbe_roundtrip(Test::Result& result, const Botan::Private_Key& key, const std::string& pbe_algo, @@ -591,6 +592,7 @@ void test_pbe_roundtrip(Test::Result& result, result.test_failure("roundtrip encrypted BER private key", e.what()); } } +#endif } -- cgit v1.2.3