diff options
author | Jack Lloyd <[email protected]> | 2022-02-13 07:43:52 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2022-02-13 07:43:52 -0500 |
commit | 1c5de2e616bdc024072b9552f47e5488644be562 (patch) | |
tree | acbeb681d54c9ef9692b08c4810c5349041cc1f4 | |
parent | 6aead9863dc8dc902ba9682cee2cff14de2bf974 (diff) | |
parent | f2bc40cd43d854d3dbace42b5475d9a67dbe28a5 (diff) |
Merge GH #2912 Make various member functions static
38 files changed, 221 insertions, 211 deletions
diff --git a/src/cli/asn1.cpp b/src/cli/asn1.cpp index 32cec2c25..1fa158920 100644 --- a/src/cli/asn1.cpp +++ b/src/cli/asn1.cpp @@ -32,7 +32,7 @@ class ASN1_Printer final : public Command return "Decode and print file with ASN.1 Basic Encoding Rules (BER)"; } - bool first_n(const std::vector<uint8_t>& data, size_t n, uint8_t b) + static bool first_n(const std::vector<uint8_t>& data, size_t n, uint8_t b) { if(data.size() < n) return false; diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 942806868..e58f1a68d 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -198,7 +198,7 @@ std::string Command::slurp_file_as_str(const std::string& input_file, void Command::read_file(const std::string& input_file, const std::function<void (uint8_t[], size_t)>& consumer_fn, - size_t buf_size) const + size_t buf_size) { if(input_file == "-") { diff --git a/src/cli/cli.h b/src/cli/cli.h index d7fe5013f..b7f81277d 100644 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -166,10 +166,9 @@ class Command /* * Read a file calling consumer_fn() with the inputs */ - void read_file(const std::string& input_file, - const std::function<void (uint8_t[], size_t)>& consumer_fn, - size_t buf_size = 0) const; - + static void read_file(const std::string& input_file, + const std::function<void (uint8_t[], size_t)>& consumer_fn, + size_t buf_size = 0); static void do_read_file(std::istream& in, const std::function<void (uint8_t[], size_t)>& consumer_fn, diff --git a/src/cli/math.cpp b/src/cli/math.cpp index 7701aafed..4bad8837d 100644 --- a/src/cli/math.cpp +++ b/src/cli/math.cpp @@ -171,7 +171,7 @@ class Factor final : public Command * Pollard's Rho algorithm, as described in the MIT algorithms book. * Uses Brent's cycle finding */ - Botan::BigInt rho(const Botan::BigInt& n, Botan::RandomNumberGenerator& rng) + static Botan::BigInt rho(const Botan::BigInt& n, Botan::RandomNumberGenerator& rng) { auto monty_n = std::make_shared<Botan::Montgomery_Params>(n); @@ -231,7 +231,7 @@ class Factor final : public Command } // Remove (and return) any small (< 2^16) factors - std::vector<Botan::BigInt> remove_small_factors(Botan::BigInt& n) + static std::vector<Botan::BigInt> remove_small_factors(Botan::BigInt& n) { std::vector<Botan::BigInt> factors; diff --git a/src/cli/sandbox.h b/src/cli/sandbox.h index 2d6f5c4df..ced30dd83 100644 --- a/src/cli/sandbox.h +++ b/src/cli/sandbox.h @@ -17,7 +17,7 @@ class Sandbox explicit Sandbox(); virtual ~Sandbox(); - bool init(); + static bool init(); const std::string& name() const { diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 10f66e2c6..1463c9f54 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -328,7 +328,7 @@ class Speed final : public Command Speed() : Command("speed --msec=500 --format=default --ecc-groups= --provider= --buf-size=1024 --clear-cpuid= --cpu-clock-speed=0 --cpu-clock-ratio=1.0 *algos") {} - std::vector<std::string> default_benchmark_list() + static std::vector<std::string> default_benchmark_list() { /* This is not intended to be exhaustive: it just hits the high diff --git a/src/cli/tls_client.cpp b/src/cli/tls_client.cpp index 74c9837ef..279549a9a 100644 --- a/src/cli/tls_client.cpp +++ b/src/cli/tls_client.cpp @@ -224,7 +224,7 @@ class TLS_Client final : public Command, public Botan::TLS::Callbacks } private: - socket_type connect_to_host(const std::string& host, uint16_t port, bool tcp) + static socket_type connect_to_host(const std::string& host, uint16_t port, bool tcp) { addrinfo hints; Botan::clear_mem(&hints, 1); diff --git a/src/cli/tls_utils.cpp b/src/cli/tls_utils.cpp index 956815974..eb1740926 100644 --- a/src/cli/tls_utils.cpp +++ b/src/cli/tls_utils.cpp @@ -151,7 +151,7 @@ class TLS_Client_Hello_Reader final : public Command } private: - std::string format_hello(const Botan::TLS::Client_Hello& hello) + static std::string format_hello(const Botan::TLS::Client_Hello& hello) { std::ostringstream oss; oss << "Version: " << hello.version().to_string() << "\n" diff --git a/src/scripts/run_clang_tidy.py b/src/scripts/run_clang_tidy.py index 049e569f1..978815fa9 100755 --- a/src/scripts/run_clang_tidy.py +++ b/src/scripts/run_clang_tidy.py @@ -18,7 +18,8 @@ enabled_checks = [ 'portability-*', 'readability-container-size-empty', 'readability-static-definition-in-anonymous-namespace', - 'hicpp-special-member-functions' + 'readability-convert-member-functions-to-static', + 'hicpp-special-member-functions', # 'cppcoreguidelines-*', # 'hicpp-*', diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp index 36e0d7850..086b0721b 100644 --- a/src/tests/test_aead.cpp +++ b/src/tests/test_aead.cpp @@ -22,9 +22,12 @@ class AEAD_Tests final : public Text_Based_Test public: AEAD_Tests() : Text_Based_Test("aead", "Key,In,Out", "Nonce,AD") {} - Test::Result test_enc(const std::vector<uint8_t>& key, const std::vector<uint8_t>& nonce, - const std::vector<uint8_t>& input, const std::vector<uint8_t>& expected, - const std::vector<uint8_t>& ad, const std::string& algo) + static Test::Result test_enc(const std::vector<uint8_t>& key, + const std::vector<uint8_t>& nonce, + const std::vector<uint8_t>& input, + const std::vector<uint8_t>& expected, + const std::vector<uint8_t>& ad, + const std::string& algo) { const bool is_siv = algo.find("/SIV") != std::string::npos; @@ -186,9 +189,12 @@ class AEAD_Tests final : public Text_Based_Test return result; } - Test::Result test_dec(const std::vector<uint8_t>& key, const std::vector<uint8_t>& nonce, - const std::vector<uint8_t>& input, const std::vector<uint8_t>& expected, - const std::vector<uint8_t>& ad, const std::string& algo) + static Test::Result test_dec(const std::vector<uint8_t>& key, + const std::vector<uint8_t>& nonce, + const std::vector<uint8_t>& input, + const std::vector<uint8_t>& expected, + const std::vector<uint8_t>& ad, + const std::string& algo) { const bool is_siv = algo.find("/SIV") != std::string::npos; diff --git a/src/tests/test_bigint.cpp b/src/tests/test_bigint.cpp index bec9ba14b..515c7620b 100644 --- a/src/tests/test_bigint.cpp +++ b/src/tests/test_bigint.cpp @@ -40,7 +40,7 @@ class BigInt_Unit_Tests final : public Test return results; } private: - Test::Result test_bigint_sizes() + static Test::Result test_bigint_sizes() { Test::Result result("BigInt size functions"); @@ -86,7 +86,7 @@ class BigInt_Unit_Tests final : public Test return result; } - Test::Result test_random_prime() + static Test::Result test_random_prime() { Test::Result result("BigInt prime generation"); @@ -125,7 +125,7 @@ class BigInt_Unit_Tests final : public Test return result; } - Test::Result test_encode() + static Test::Result test_encode() { Test::Result result("BigInt encoding functions"); @@ -151,7 +151,7 @@ class BigInt_Unit_Tests final : public Test return result; } - Test::Result test_get_substring() + static Test::Result test_get_substring() { Test::Result result("BigInt get_substring"); @@ -177,7 +177,7 @@ class BigInt_Unit_Tests final : public Test return result; } - Test::Result test_bigint_io() + static Test::Result test_bigint_io() { Test::Result result("BigInt IO operators"); diff --git a/src/tests/test_dl_group.cpp b/src/tests/test_dl_group.cpp index dd29372d1..453645751 100644 --- a/src/tests/test_dl_group.cpp +++ b/src/tests/test_dl_group.cpp @@ -31,7 +31,7 @@ class DL_Group_Tests final : public Test } private: - Test::Result test_dl_errors() + static Test::Result test_dl_errors() { Test::Result result("DL_Group errors"); result.test_throws("Uninitialized", @@ -50,7 +50,7 @@ class DL_Group_Tests final : public Test return result; } - Test::Result test_dl_encoding() + static Test::Result test_dl_encoding() { Test::Result result("DL_Group encoding"); diff --git a/src/tests/test_ec_group.cpp b/src/tests/test_ec_group.cpp index 2ad107b98..5e8d778c8 100644 --- a/src/tests/test_ec_group.cpp +++ b/src/tests/test_ec_group.cpp @@ -221,9 +221,9 @@ class NIST_Curve_Reduction_Tests final : public Test return results; } - Test::Result random_redc_test(const std::string& prime_name, - const Botan::BigInt& p, - const reducer_fn& redc_fn) + static Test::Result random_redc_test(const std::string& prime_name, + const Botan::BigInt& p, + const reducer_fn& redc_fn) { const Botan::BigInt p2 = p * p; const size_t p_bits = p.bits(); @@ -338,7 +338,7 @@ class EC_Group_Tests : public Test } private: - void test_ser_der(Test::Result& result, const Botan::EC_Group& group) + static void test_ser_der(Test::Result& result, const Botan::EC_Group& group) { // generate point const Botan::PointGFp pt = create_random_point(Test::rng(), group); @@ -353,7 +353,7 @@ class EC_Group_Tests : public Test } } - void test_basic_math(Test::Result& result, const Botan::EC_Group& group) + static void test_basic_math(Test::Result& result, const Botan::EC_Group& group) { const Botan::PointGFp& G = group.get_base_point(); @@ -371,7 +371,7 @@ class EC_Group_Tests : public Test result.confirm("point (0,0) is not on the curve", !zero_coords.on_the_curve()); } - void test_point_swap(Test::Result& result, const Botan::EC_Group& group) + static void test_point_swap(Test::Result& result, const Botan::EC_Group& group) { Botan::PointGFp a(create_random_point(Test::rng(), group)); Botan::PointGFp b(create_random_point(Test::rng(), group)); @@ -385,7 +385,7 @@ class EC_Group_Tests : public Test result.test_eq("swap correct", b, c); } - void test_zeropoint(Test::Result& result, const Botan::EC_Group& group) + static void test_zeropoint(Test::Result& result, const Botan::EC_Group& group) { Botan::PointGFp zero = group.zero_point(); diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp index 4c93d21c8..771bf0061 100644 --- a/src/tests/test_ffi.cpp +++ b/src/tests/test_ffi.cpp @@ -149,7 +149,7 @@ class FFI_Unit_Tests final : public Test private: - Test::Result ffi_test_utils() + static Test::Result ffi_test_utils() { Test::Result result("FFI"); result.test_is_eq("FFI API version", botan_ffi_api_version(), uint32_t(BOTAN_HAS_FFI)); @@ -191,7 +191,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_rng() + static Test::Result ffi_test_rng() { Test::Result result("FFI RNG"); @@ -299,7 +299,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_rsa_cert() + static Test::Result ffi_test_rsa_cert() { Test::Result result("FFI RSA cert"); @@ -326,7 +326,7 @@ class FFI_Unit_Tests final : public Test } - Test::Result ffi_test_crl() + static Test::Result ffi_test_crl() { Test::Result result("FFI CRL"); @@ -374,7 +374,7 @@ class FFI_Unit_Tests final : public Test } - Test::Result ffi_test_cert_validation() + static Test::Result ffi_test_cert_validation() { Test::Result result("FFI Cert validation"); #if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_EMSA_PKCS1) @@ -449,7 +449,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ecdsa_cert() + static Test::Result ffi_test_ecdsa_cert() { Test::Result result("FFI ECDSA cert"); @@ -563,7 +563,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_pkcs_hash_id() + static Test::Result ffi_test_pkcs_hash_id() { Test::Result result("FFI PKCS hash id"); @@ -589,7 +589,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ciphers_cbc() + static Test::Result ffi_test_ciphers_cbc() { Test::Result result("FFI CBC cipher"); @@ -665,7 +665,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ciphers_aead_gcm() + static Test::Result ffi_test_ciphers_aead_gcm() { Test::Result result("FFI GCM"); @@ -774,7 +774,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ciphers_aead_eax() + static Test::Result ffi_test_ciphers_aead_eax() { Test::Result result("FFI EAX"); @@ -865,7 +865,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_stream_ciphers() + static Test::Result ffi_test_stream_ciphers() { Test::Result result("FFI stream ciphers"); @@ -914,7 +914,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_hash() + static Test::Result ffi_test_hash() { Test::Result result("FFI hash"); @@ -990,7 +990,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_mac() + static Test::Result ffi_test_mac() { Test::Result result("FFI MAC"); @@ -1054,7 +1054,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_scrypt() + static Test::Result ffi_test_scrypt() { Test::Result result("FFI Scrypt"); @@ -1083,7 +1083,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_kdf(botan_rng_t rng) + static Test::Result ffi_test_kdf(botan_rng_t rng) { Test::Result result("FFI KDF"); std::vector<uint8_t> outbuf; @@ -1156,7 +1156,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_block_ciphers() + static Test::Result ffi_test_block_ciphers() { Test::Result result("FFI block ciphers"); @@ -1220,7 +1220,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_errors() + static Test::Result ffi_test_errors() { // Test some error handling situations Test::Result result("FFI error handling"); @@ -1254,7 +1254,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_base64() + static Test::Result ffi_test_base64() { Test::Result result("FFI base64"); @@ -1291,7 +1291,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_hex() + static Test::Result ffi_test_hex() { Test::Result result("FFI hex"); @@ -1320,7 +1320,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_mp(botan_rng_t rng) + static Test::Result ffi_test_mp(botan_rng_t rng) { Test::Result result("FFI MP"); @@ -1543,7 +1543,7 @@ class FFI_Unit_Tests final : public Test return result; } - void ffi_test_pubkey_export(Test::Result& result, botan_pubkey_t pub, botan_privkey_t priv, botan_rng_t rng) + static void ffi_test_pubkey_export(Test::Result& result, botan_pubkey_t pub, botan_privkey_t priv, botan_rng_t rng) { // export public key size_t pubkey_len = 0; @@ -1676,7 +1676,7 @@ class FFI_Unit_Tests final : public Test TEST_FFI_OK(botan_pubkey_fingerprint, (pub, "SHA-512", fingerprint.data(), &fingerprint_len)); } - Test::Result ffi_test_fpe() + static Test::Result ffi_test_fpe() { Test::Result result("FFI FPE"); @@ -1713,7 +1713,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_totp() + static Test::Result ffi_test_totp() { Test::Result result("FFI TOTP"); @@ -1740,7 +1740,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_hotp() + static Test::Result ffi_test_hotp() { Test::Result result("FFI HOTP"); @@ -1775,7 +1775,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_keywrap() + static Test::Result ffi_test_keywrap() { Test::Result result("FFI keywrap"); @@ -1808,7 +1808,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_rsa(botan_rng_t rng) + static Test::Result ffi_test_rsa(botan_rng_t rng) { Test::Result result("FFI RSA"); @@ -1964,8 +1964,8 @@ class FFI_Unit_Tests final : public Test return result; } - void do_dsa_test(botan_privkey_t priv, botan_rng_t rng, Test::Result &result) - { + static void do_dsa_test(botan_privkey_t priv, botan_rng_t rng, Test::Result &result) + { TEST_FFI_OK(botan_privkey_check_key, (priv, rng, 0)); botan_pubkey_t pub; @@ -2070,7 +2070,7 @@ class FFI_Unit_Tests final : public Test TEST_FFI_OK(botan_privkey_destroy, (priv)); } - Test::Result ffi_test_dsa(botan_rng_t rng) + static Test::Result ffi_test_dsa(botan_rng_t rng) { Test::Result result("FFI DSA"); botan_privkey_t priv; @@ -2087,7 +2087,8 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ecdsa(botan_rng_t rng) + + static Test::Result ffi_test_ecdsa(botan_rng_t rng) { Test::Result result("FFI ECDSA"); static const char* kCurve = "secp384r1"; @@ -2185,7 +2186,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_sm2(botan_rng_t rng) + static Test::Result ffi_test_sm2(botan_rng_t rng) { Test::Result result("FFI SM2 Sig"); static const char* kCurve = "sm2p256v1"; @@ -2280,7 +2281,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_sm2_enc(botan_rng_t rng) + static Test::Result ffi_test_sm2_enc(botan_rng_t rng) { Test::Result result("FFI SM2 Enc"); static const char* kCurve = "sm2p256v1"; @@ -2358,7 +2359,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ecdh(botan_rng_t rng) + static Test::Result ffi_test_ecdh(botan_rng_t rng) { Test::Result result("FFI ECDH"); @@ -2440,7 +2441,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_mceliece(botan_rng_t rng) + static Test::Result ffi_test_mceliece(botan_rng_t rng) { Test::Result result("FFI McEliece"); @@ -2473,7 +2474,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_ed25519(botan_rng_t rng) + static Test::Result ffi_test_ed25519(botan_rng_t rng) { Test::Result result("FFI Ed25519"); @@ -2545,7 +2546,7 @@ class FFI_Unit_Tests final : public Test return result; } - Test::Result ffi_test_x25519() + static Test::Result ffi_test_x25519() { Test::Result result("FFI X25519"); @@ -2691,7 +2692,7 @@ class FFI_Unit_Tests final : public Test } - Test::Result ffi_test_dh(botan_rng_t rng) + static Test::Result ffi_test_dh(botan_rng_t rng) { Test::Result result("FFI DH"); diff --git a/src/tests/test_filters.cpp b/src/tests/test_filters.cpp index 91c2058be..5709b5cf2 100644 --- a/src/tests/test_filters.cpp +++ b/src/tests/test_filters.cpp @@ -61,7 +61,7 @@ class Filter_Tests final : public Test } private: - Test::Result test_secqueue() + static Test::Result test_secqueue() { Test::Result result("SecureQueue"); @@ -100,7 +100,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_data_src_sink() + static Test::Result test_data_src_sink() { Test::Result result("DataSink"); @@ -128,7 +128,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_data_src_sink_flush() + static Test::Result test_data_src_sink_flush() { Test::Result result("DataSinkFlush"); @@ -167,7 +167,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_io() + static Test::Result test_pipe_io() { Test::Result result("Pipe I/O operators"); @@ -193,7 +193,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_errors() + static Test::Result test_pipe_errors() { Test::Result result("Pipe"); @@ -269,7 +269,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_mac() + static Test::Result test_pipe_mac() { Test::Result result("Pipe"); @@ -298,7 +298,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_hash() + static Test::Result test_pipe_hash() { Test::Result result("Pipe"); @@ -352,7 +352,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_cfb() + static Test::Result test_pipe_cfb() { Test::Result result("Pipe CFB"); @@ -417,7 +417,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_cbc() + static Test::Result test_pipe_cbc() { Test::Result result("Pipe CBC"); @@ -482,7 +482,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_compress() + static Test::Result test_pipe_compress() { Test::Result result("Pipe compress zlib"); @@ -517,7 +517,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_compress_bzip2() + static Test::Result test_pipe_compress_bzip2() { Test::Result result("Pipe compress bzip2"); @@ -551,7 +551,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_codec() + static Test::Result test_pipe_codec() { Test::Result result("Pipe"); @@ -626,7 +626,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_stream() + static Test::Result test_pipe_stream() { Test::Result result("Pipe CTR"); @@ -651,7 +651,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_fork() + static Test::Result test_fork() { Test::Result result("Filter Fork"); @@ -670,7 +670,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_chain() + static Test::Result test_chain() { Test::Result result("Filter Chain"); @@ -706,7 +706,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_pipe_fd_io() + static Test::Result test_pipe_fd_io() { Test::Result result("Pipe file descriptor IO"); @@ -735,7 +735,7 @@ class Filter_Tests final : public Test return result; } - Test::Result test_threaded_fork() + static Test::Result test_threaded_fork() { Test::Result result("Threaded_Fork"); diff --git a/src/tests/test_gf2m.cpp b/src/tests/test_gf2m.cpp index 85999e4d3..1647f607b 100644 --- a/src/tests/test_gf2m.cpp +++ b/src/tests/test_gf2m.cpp @@ -29,7 +29,7 @@ class GF2m_Tests final : public Test } private: - Test::Result test_gf_overflow() + static Test::Result test_gf_overflow() { Test::Result result("GF2m"); diff --git a/src/tests/test_hash.cpp b/src/tests/test_hash.cpp index 81cbeeba6..24ae276a1 100644 --- a/src/tests/test_hash.cpp +++ b/src/tests/test_hash.cpp @@ -33,9 +33,9 @@ class Invalid_Hash_Name_Tests final : public Test } private: - void test_invalid_name(Result& result, + static void test_invalid_name(Result& result, const std::string& name, - const std::string& expected_msg = "") const + const std::string& expected_msg = "") { try { diff --git a/src/tests/test_kyber.cpp b/src/tests/test_kyber.cpp index 3c13e8da5..1b0347604 100644 --- a/src/tests/test_kyber.cpp +++ b/src/tests/test_kyber.cpp @@ -32,7 +32,7 @@ namespace Botan_Tests { class KYBER_Tests final : public Test { public: - Test::Result run_kyber_test(const char* test_name, Botan::KyberMode mode, size_t strength) + static Test::Result run_kyber_test(const char* test_name, Botan::KyberMode mode, size_t strength) { Test::Result result(test_name); @@ -188,7 +188,7 @@ class Kyber_Encoding_Test : public Text_Based_Test } private: - Botan::KyberMode name_to_mode(const std::string& algo_name) + static Botan::KyberMode name_to_mode(const std::string& algo_name) { if(algo_name == "Kyber-512-r3") { return Botan::KyberMode::Kyber512; } diff --git a/src/tests/test_mceliece.cpp b/src/tests/test_mceliece.cpp index 66605c06d..de8af9c33 100644 --- a/src/tests/test_mceliece.cpp +++ b/src/tests/test_mceliece.cpp @@ -91,7 +91,7 @@ class McEliece_Keygen_Encrypt_Test final : public Text_Based_Test } private: - std::vector<uint8_t> hash_bytes(const uint8_t b[], size_t len, const std::string& hash_fn = "SHA-256") + static std::vector<uint8_t> hash_bytes(const uint8_t b[], size_t len, const std::string& hash_fn = "SHA-256") { std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(hash_fn)); hash->update(b, len); @@ -118,7 +118,7 @@ class McEliece_Tests final : public Test { public: - std::string fingerprint(const Botan::Private_Key& key, const std::string& hash_algo = "SHA-256") + static std::string fingerprint(const Botan::Private_Key& key, const std::string& hash_algo = "SHA-256") { std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(hash_algo)); if(!hash) @@ -130,7 +130,7 @@ class McEliece_Tests final : public Test return Botan::hex_encode(hash->final()); } - std::string fingerprint(const Botan::Public_Key& key, const std::string& hash_algo = "SHA-256") + static std::string fingerprint(const Botan::Public_Key& key, const std::string& hash_algo = "SHA-256") { std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(hash_algo)); if(!hash) @@ -198,7 +198,7 @@ class McEliece_Tests final : public Test } private: - Test::Result test_kem(const Botan::McEliece_PrivateKey& sk, + static Test::Result test_kem(const Botan::McEliece_PrivateKey& sk, const Botan::McEliece_PublicKey& pk) { Test::Result result("McEliece KEM"); diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp index b4a2c2eb8..cf4ef4669 100644 --- a/src/tests/test_modes.cpp +++ b/src/tests/test_modes.cpp @@ -88,7 +88,7 @@ class Cipher_Mode_Tests final : public Text_Based_Test } private: - void test_mode(Test::Result& result, + static void test_mode(Test::Result& result, const std::string& algo, const std::string& provider, const std::string& direction, @@ -267,7 +267,7 @@ class Cipher_Mode_IV_Carry_Tests final : public Test } private: - Test::Result test_cbc_iv_carry() + static Test::Result test_cbc_iv_carry() { Test::Result result("CBC IV carry"); @@ -321,7 +321,7 @@ class Cipher_Mode_IV_Carry_Tests final : public Test return result; } - Test::Result test_cfb_iv_carry() + static Test::Result test_cfb_iv_carry() { Test::Result result("CFB IV carry"); #if defined(BOTAN_HAS_MODE_CFB) && defined(BOTAN_HAS_AES) @@ -369,7 +369,7 @@ class Cipher_Mode_IV_Carry_Tests final : public Test return result; } - Test::Result test_ctr_iv_carry() + static Test::Result test_ctr_iv_carry() { Test::Result result("CTR IV carry"); #if defined(BOTAN_HAS_CTR_BE) && defined(BOTAN_HAS_AES) diff --git a/src/tests/test_mp.cpp b/src/tests/test_mp.cpp index cfae304d4..74de28a5f 100644 --- a/src/tests/test_mp.cpp +++ b/src/tests/test_mp.cpp @@ -31,7 +31,7 @@ class MP_Unit_Tests final : public Test return results; } private: - Result test_cnd_add() + static Result test_cnd_add() { Result result("bigint_cnd_add"); @@ -53,7 +53,7 @@ class MP_Unit_Tests final : public Test return result; } - Result test_cnd_sub() + static Result test_cnd_sub() { Result result("bigint_cnd_sub"); @@ -72,7 +72,7 @@ class MP_Unit_Tests final : public Test return result; } - Result test_cnd_abs() + static Result test_cnd_abs() { Result result("bigint_cnd_abs"); @@ -101,7 +101,7 @@ class MP_Unit_Tests final : public Test return result; } - Result test_cnd_swap() + static Result test_cnd_swap() { Result result("bigint_cnd_swap"); diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp index c55ec6c0b..b737db111 100644 --- a/src/tests/test_ocb.cpp +++ b/src/tests/test_ocb.cpp @@ -248,7 +248,7 @@ class OCB_Wide_Long_KAT_Tests final : public Text_Based_Test } private: - void ocb_encrypt(Test::Result& /*result*/, + static void ocb_encrypt(Test::Result& /*result*/, std::vector<uint8_t>& output_to, Botan::OCB_Encryption& enc, const std::vector<uint8_t>& nonce, @@ -323,7 +323,7 @@ class OCB_Long_KAT_Tests final : public Text_Based_Test return result; } private: - void ocb_encrypt(Test::Result& result, + static void ocb_encrypt(Test::Result& result, std::vector<uint8_t>& output_to, Botan::AEAD_Mode& enc, Botan::AEAD_Mode& dec, diff --git a/src/tests/test_ocsp.cpp b/src/tests/test_ocsp.cpp index a507045f5..825e795e2 100644 --- a/src/tests/test_ocsp.cpp +++ b/src/tests/test_ocsp.cpp @@ -21,17 +21,17 @@ namespace Botan_Tests { class OCSP_Tests final : public Test { private: - Botan::X509_Certificate load_test_X509_cert(const std::string& path) + static Botan::X509_Certificate load_test_X509_cert(const std::string& path) { return Botan::X509_Certificate(Test::data_file(path)); } - Botan::OCSP::Response load_test_OCSP_resp(const std::string& path) + static Botan::OCSP::Response load_test_OCSP_resp(const std::string& path) { return Botan::OCSP::Response(Test::read_binary_data_file(path)); } - Test::Result test_response_parsing() + static Test::Result test_response_parsing() { Test::Result result("OCSP response parsing"); @@ -63,7 +63,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_certificate_access() + static Test::Result test_response_certificate_access() { Test::Result result("OCSP response certificate access"); @@ -93,7 +93,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_request_encoding() + static Test::Result test_request_encoding() { Test::Result result("OCSP request encoding"); @@ -127,7 +127,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_verification_with_next_update_without_max_age() + static Test::Result test_response_verification_with_next_update_without_max_age() { Test::Result result("OCSP request check with next_update w/o max_age"); @@ -165,7 +165,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_verification_with_next_update_with_max_age() + static Test::Result test_response_verification_with_next_update_with_max_age() { Test::Result result("OCSP request check with next_update with max_age"); @@ -206,7 +206,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_verification_without_next_update_with_max_age() + static Test::Result test_response_verification_without_next_update_with_max_age() { Test::Result result("OCSP request check w/o next_update with max_age"); @@ -245,7 +245,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_verification_without_next_update_without_max_age() + static Test::Result test_response_verification_without_next_update_without_max_age() { Test::Result result("OCSP request check w/o next_update w/o max_age"); @@ -281,7 +281,7 @@ class OCSP_Tests final : public Test return result; } - Test::Result test_response_verification_softfail() + static Test::Result test_response_verification_softfail() { Test::Result result("OCSP request softfail check"); @@ -312,7 +312,7 @@ class OCSP_Tests final : public Test } #if defined(BOTAN_HAS_ONLINE_REVOCATION_CHECKS) - Test::Result test_online_request() + static Test::Result test_online_request() { Test::Result result("OCSP online check"); diff --git a/src/tests/test_os_utils.cpp b/src/tests/test_os_utils.cpp index ad83c95b1..a2c7b5e25 100644 --- a/src/tests/test_os_utils.cpp +++ b/src/tests/test_os_utils.cpp @@ -47,7 +47,7 @@ class OS_Utils_Tests final : public Test private: - Test::Result test_get_process_id() + static Test::Result test_get_process_id() { Test::Result result("OS::get_process_id"); @@ -65,7 +65,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_get_cpu_cycle_counter() + static Test::Result test_get_cpu_cycle_counter() { const size_t max_trials = 1024; const size_t max_repeats = 32; @@ -90,7 +90,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_get_high_resolution_clock() + static Test::Result test_get_high_resolution_clock() { const size_t max_trials = 1024; const size_t max_repeats = 128; @@ -110,7 +110,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_get_cpu_numbers() + static Test::Result test_get_cpu_numbers() { Test::Result result("OS::get_cpu_available"); @@ -121,7 +121,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_get_system_timestamp() + static Test::Result test_get_system_timestamp() { // TODO better tests Test::Result result("OS::get_system_timestamp_ns"); @@ -139,7 +139,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_memory_locking() + static Test::Result test_memory_locking() { Test::Result result("OS memory locked pages"); @@ -148,7 +148,7 @@ class OS_Utils_Tests final : public Test return result; } - Test::Result test_cpu_instruction_probe() + static Test::Result test_cpu_instruction_probe() { Test::Result result("OS::run_cpu_instruction_probe"); diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp index 282794620..e8aff33eb 100644 --- a/src/tests/test_otp.cpp +++ b/src/tests/test_otp.cpp @@ -109,7 +109,7 @@ class TOTP_KAT_Tests final : public Text_Based_Test } private: - std::chrono::system_clock::time_point from_timestring(const std::string& time_str) + static std::chrono::system_clock::time_point from_timestring(const std::string& time_str) { if(time_str.size() != 19) throw Test_Error("Invalid TOTP timestamp string " + time_str); diff --git a/src/tests/test_psk_db.cpp b/src/tests/test_psk_db.cpp index 21f9011ab..946187d39 100644 --- a/src/tests/test_psk_db.cpp +++ b/src/tests/test_psk_db.cpp @@ -99,7 +99,7 @@ class PSK_DB_Tests final : public Test private: - Test::Result test_psk_db() + static Test::Result test_psk_db() { Test::Result result("PSK_DB"); diff --git a/src/tests/test_rng.cpp b/src/tests/test_rng.cpp index 4273f5c4b..c8a3c1f55 100644 --- a/src/tests/test_rng.cpp +++ b/src/tests/test_rng.cpp @@ -662,7 +662,7 @@ BOTAN_REGISTER_TEST("rng", "chacha_rng_unit", ChaCha_RNG_Unit_Tests); class AutoSeeded_RNG_Tests final : public Test { private: - Test::Result auto_rng_tests() + static Test::Result auto_rng_tests() { Test::Result result("AutoSeeded_RNG"); diff --git a/src/tests/test_roughtime.cpp b/src/tests/test_roughtime.cpp index 3e121a38a..2c4e38d5e 100644 --- a/src/tests/test_roughtime.cpp +++ b/src/tests/test_roughtime.cpp @@ -128,7 +128,7 @@ BOTAN_REGISTER_TEST("roughtime", "roughtime_nonce_from_blind", Roughtime_nonce_f class Roughtime final : public Test { - Test::Result test_nonce() + static Test::Result test_nonce() { Test::Result result("roughtime nonce"); @@ -147,7 +147,7 @@ class Roughtime final : public Test return result; } - Test::Result test_chain() + static Test::Result test_chain() { Test::Result result("roughtime chain"); @@ -184,7 +184,7 @@ class Roughtime final : public Test return result; } - Test::Result test_server_information() + static Test::Result test_server_information() { Test::Result result("roughtime server_information"); @@ -216,7 +216,7 @@ class Roughtime final : public Test return result; } - Test::Result test_request_online() + static Test::Result test_request_online() { Test::Result result("roughtime request online"); diff --git a/src/tests/test_simd.cpp b/src/tests/test_simd.cpp index eefe77b6e..05f568b9e 100644 --- a/src/tests/test_simd.cpp +++ b/src/tests/test_simd.cpp @@ -136,7 +136,7 @@ class SIMD_32_Tests final : public Test } private: - void test_eq(Test::Result& result, const std::string& op, + static void test_eq(Test::Result& result, const std::string& op, const Botan::SIMD_4x32& simd, uint32_t exp0, uint32_t exp1, uint32_t exp2, uint32_t exp3) { diff --git a/src/tests/test_sodium.cpp b/src/tests/test_sodium.cpp index 6b32385c7..ea28f49b3 100644 --- a/src/tests/test_sodium.cpp +++ b/src/tests/test_sodium.cpp @@ -49,7 +49,7 @@ class Sodium_API_Tests : public Test private: - Test::Result sodium_malloc() + static Test::Result sodium_malloc() { Test::Result result("sodium_malloc"); @@ -64,7 +64,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result sodium_utils() + static Test::Result sodium_utils() { Test::Result result("sodium math utils"); @@ -103,7 +103,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result randombytes_buf_deterministic() + static Test::Result randombytes_buf_deterministic() { Test::Result result("randombytes_buf_deterministic"); @@ -117,7 +117,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result hash_sha512() + static Test::Result hash_sha512() { Test::Result result("crypto_hash_sha512"); @@ -130,7 +130,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result hash_sha256() + static Test::Result hash_sha256() { Test::Result result("crypto_hash_sha256"); @@ -143,7 +143,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result box_curve25519xsalsa20poly1305() + static Test::Result box_curve25519xsalsa20poly1305() { Test::Result result("crypto_box_curve25519xsalsa20poly1305"); @@ -193,7 +193,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result aead_chacha20poly1305() + static Test::Result aead_chacha20poly1305() { Test::Result result("crypto_aead_chacha20poly1305"); @@ -247,7 +247,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result aead_chacha20poly1305_ietf() + static Test::Result aead_chacha20poly1305_ietf() { Test::Result result("crypto_aead_chacha20poly1305_ietf"); @@ -301,7 +301,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result aead_xchacha20poly1305() + static Test::Result aead_xchacha20poly1305() { Test::Result result("crypto_aead_xchacha20poly1305"); @@ -356,7 +356,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result auth_hmacsha512() + static Test::Result auth_hmacsha512() { Test::Result result("crypto_auth_hmacsha512"); @@ -381,7 +381,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result auth_hmacsha512256() + static Test::Result auth_hmacsha512256() { Test::Result result("crypto_auth_hmacsha512256"); @@ -404,7 +404,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result auth_hmacsha256() + static Test::Result auth_hmacsha256() { Test::Result result("crypto_auth_hmacsha256"); @@ -427,7 +427,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result auth_poly1305() + static Test::Result auth_poly1305() { Test::Result result("crypto_onetimeauth_poly1305"); @@ -451,7 +451,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result shorthash_siphash24() + static Test::Result shorthash_siphash24() { Test::Result result("crypto_shorthash_siphash24"); @@ -466,7 +466,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result secretbox_xsalsa20poly1305() + static Test::Result secretbox_xsalsa20poly1305() { Test::Result result("secretbox_xsalsa20poly1305"); @@ -498,7 +498,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result secretbox_xsalsa20poly1305_detached() + static Test::Result secretbox_xsalsa20poly1305_detached() { Test::Result result("secretbox_xsalsa20poly1305"); @@ -534,7 +534,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result sign_ed25519() + static Test::Result sign_ed25519() { Test::Result result("crypto_sign_ed25519"); @@ -563,7 +563,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result stream_salsa20() + static Test::Result stream_salsa20() { Test::Result result("crypto_stream_salsa20"); @@ -583,7 +583,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result stream_xsalsa20() + static Test::Result stream_xsalsa20() { Test::Result result("crypto_stream_xsalsa20"); @@ -603,7 +603,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result stream_chacha20() + static Test::Result stream_chacha20() { Test::Result result("crypto_stream_chacha20"); @@ -623,7 +623,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result stream_chacha20_ietf() + static Test::Result stream_chacha20_ietf() { Test::Result result("crypto_stream_chacha20"); @@ -643,7 +643,7 @@ class Sodium_API_Tests : public Test return result; } - Test::Result stream_xchacha20() + static Test::Result stream_xchacha20() { Test::Result result("crypto_stream_xchacha20"); diff --git a/src/tests/test_tests.cpp b/src/tests/test_tests.cpp index dce916008..66babbbc1 100644 --- a/src/tests/test_tests.cpp +++ b/src/tests/test_tests.cpp @@ -183,7 +183,7 @@ class Test_Tests final : public Test } private: - Test::Result test_testsuite_rng() + static Test::Result test_testsuite_rng() { Test::Result result("Testsuite_RNG"); @@ -207,7 +207,7 @@ class Test_Tests final : public Test return result; } - void verify_failure(const std::string& what, + static void verify_failure(const std::string& what, Test::Result& result, const Test::Result& test_result) { diff --git a/src/tests/test_tls.cpp b/src/tests/test_tls.cpp index b460f84fd..f0340096c 100644 --- a/src/tests/test_tls.cpp +++ b/src/tests/test_tls.cpp @@ -333,7 +333,7 @@ class Test_TLS_Policy_Text : public Test } private: - std::string read_tls_policy(const std::string& policy_str) + static std::string read_tls_policy(const std::string& policy_str) { const std::string fspath = Test::data_file("tls-policy/" + policy_str + ".txt"); @@ -347,7 +347,7 @@ class Test_TLS_Policy_Text : public Test return policy.to_string(); } - std::string tls_policy_string(const std::string& policy_str) + static std::string tls_policy_string(const std::string& policy_str) { std::unique_ptr<Botan::TLS::Policy> policy; if(policy_str == "default") @@ -436,7 +436,7 @@ class Test_TLS_Algo_Strings : public Test } private: - Test::Result test_tls_sig_method_strings() + static Test::Result test_tls_sig_method_strings() { Test::Result result("TLS::Signature_Scheme"); @@ -455,7 +455,7 @@ class Test_TLS_Algo_Strings : public Test return result; } - Test::Result test_auth_method_strings() + static Test::Result test_auth_method_strings() { Test::Result result("TLS::Auth_Method"); @@ -476,7 +476,7 @@ class Test_TLS_Algo_Strings : public Test return result; } - Test::Result test_kex_algo_strings() + static Test::Result test_kex_algo_strings() { Test::Result result("TLS::Kex_Algo"); diff --git a/src/tests/test_uri.cpp b/src/tests/test_uri.cpp index 243b9d581..f75abc50d 100644 --- a/src/tests/test_uri.cpp +++ b/src/tests/test_uri.cpp @@ -14,7 +14,7 @@ namespace Botan_Tests { class URI_Tests final : public Test { - void test_uri_ctor(std::vector<Test::Result>& results) + static void test_uri_ctor(std::vector<Test::Result>& results) { Test::Result result("uri constructors"); Botan::URI uri(Botan::URI::Type::Domain, "localhost", 80); @@ -24,7 +24,7 @@ class URI_Tests final : public Test results.push_back(result); } - void test_uri_tostring(std::vector<Test::Result>& results) + static void test_uri_tostring(std::vector<Test::Result>& results) { Test::Result result("uri to_string"); @@ -37,7 +37,7 @@ class URI_Tests final : public Test results.push_back(result); } - void test_uri_factories(std::vector<Test::Result>& results) + static void test_uri_factories(std::vector<Test::Result>& results) { Test::Result result("uri factories"); diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp index 11becee12..7886febd4 100644 --- a/src/tests/test_utils.cpp +++ b/src/tests/test_utils.cpp @@ -75,7 +75,7 @@ class Utility_Function_Tests final : public Text_Based_Test return results; } - Test::Result test_loadstore() + static Test::Result test_loadstore() { Test::Result result("Util load/store"); @@ -438,7 +438,7 @@ class Date_Format_Tests final : public Text_Based_Test public: Date_Format_Tests() : Text_Based_Test("dates.vec", "Date") {} - std::vector<uint32_t> parse_date(const std::string& s) + static std::vector<uint32_t> parse_date(const std::string& s) { const std::vector<std::string> parts = Botan::split_on(s, ','); if(parts.size() != 6) @@ -606,7 +606,7 @@ class ReadKV_Tests final : public Text_Based_Test private: - std::vector<std::string> split_group(const std::string& str) + static std::vector<std::string> split_group(const std::string& str) { std::vector<std::string> elems; if(str.empty()) return elems; @@ -631,7 +631,7 @@ class ReadKV_Tests final : public Text_Based_Test return elems; } - void confirm_kv(Test::Result& result, + static void confirm_kv(Test::Result& result, const std::map<std::string, std::string>& kv, const std::vector<std::string>& expected) { diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp index c09354e19..3151ecf77 100644 --- a/src/tests/test_x509_path.cpp +++ b/src/tests/test_x509_path.cpp @@ -163,7 +163,7 @@ class X509test_Path_Validation_Tests final : public Test private: - std::vector<Botan::X509_Certificate> load_cert_file(const std::string& filename) + static std::vector<Botan::X509_Certificate> load_cert_file(const std::string& filename) { Botan::DataSource_Stream in(filename); @@ -913,17 +913,17 @@ BOTAN_REGISTER_TEST("x509", "x509_path_bsi", BSI_Path_Validation_Tests); class Path_Validation_With_OCSP_Tests final : public Test { public: - Botan::X509_Certificate load_test_X509_cert(const std::string& path) + static Botan::X509_Certificate load_test_X509_cert(const std::string& path) { return Botan::X509_Certificate(Test::data_file(path)); } - std::optional<Botan::OCSP::Response> load_test_OCSP_resp(const std::string& path) + static std::optional<Botan::OCSP::Response> load_test_OCSP_resp(const std::string& path) { return Botan::OCSP::Response(Test::read_binary_data_file(path)); } - Test::Result validate_with_ocsp_with_next_update_without_max_age() + static Test::Result validate_with_ocsp_with_next_update_without_max_age() { Test::Result result("path check with ocsp with next_update w/o max_age"); Botan::Certificate_Store_In_Memory trusted; @@ -962,7 +962,7 @@ class Path_Validation_With_OCSP_Tests final : public Test return result; } - Test::Result validate_with_ocsp_with_next_update_with_max_age() + static Test::Result validate_with_ocsp_with_next_update_with_max_age() { Test::Result result("path check with ocsp with next_update with max_age"); Botan::Certificate_Store_In_Memory trusted; @@ -1002,7 +1002,7 @@ class Path_Validation_With_OCSP_Tests final : public Test return result; } - Test::Result validate_with_ocsp_without_next_update_without_max_age() + static Test::Result validate_with_ocsp_without_next_update_without_max_age() { Test::Result result("path check with ocsp w/o next_update w/o max_age"); Botan::Certificate_Store_In_Memory trusted; @@ -1040,7 +1040,7 @@ class Path_Validation_With_OCSP_Tests final : public Test return result; } - Test::Result validate_with_ocsp_without_next_update_with_max_age() + static Test::Result validate_with_ocsp_without_next_update_with_max_age() { Test::Result result("path check with ocsp w/o next_update with max_age"); Botan::Certificate_Store_In_Memory trusted; @@ -1156,7 +1156,7 @@ BOTAN_REGISTER_TEST("x509", "x509_cve_2020_0601", CVE_2020_0601_Tests); class XMSS_Path_Validation_Tests final : public Test { public: - Test::Result validate_self_signed(const std::string& name, const std::string& file) + static Test::Result validate_self_signed(const std::string& name, const std::string& file) { Test::Result result(name); diff --git a/src/tests/unit_ecdh.cpp b/src/tests/unit_ecdh.cpp index ebcab4374..979fbc96e 100644 --- a/src/tests/unit_ecdh.cpp +++ b/src/tests/unit_ecdh.cpp @@ -32,7 +32,7 @@ class ECDH_Unit_Tests final : public Test } private: - Test::Result test_ecdh_normal_derivation() + static Test::Result test_ecdh_normal_derivation() { Test::Result result("ECDH key exchange"); diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp index 2885db3ec..e149ada3b 100644 --- a/src/tests/unit_tls.cpp +++ b/src/tests/unit_tls.cpp @@ -636,7 +636,7 @@ class Test_Policy final : public Botan::TLS::Text_Policy class TLS_Unit_Tests final : public Test { private: - void test_with_policy(const std::string& test_descr, + static void test_with_policy(const std::string& test_descr, std::vector<Test::Result>& results, Botan::TLS::Session_Manager& client_ses, Botan::TLS::Session_Manager& server_ses, @@ -670,16 +670,17 @@ class TLS_Unit_Tests final : public Test } } - void test_all_versions(const std::string& test_descr, - std::vector<Test::Result>& results, - Botan::TLS::Session_Manager& client_ses, - Botan::TLS::Session_Manager& server_ses, - Botan::Credentials_Manager& creds, - const std::string& kex_policy, - const std::string& cipher_policy, - const std::string& mac_policy, - const std::string& etm_policy, - bool client_auth = false) + static void test_all_versions( + const std::string& test_descr, + std::vector<Test::Result>& results, + Botan::TLS::Session_Manager& client_ses, + Botan::TLS::Session_Manager& server_ses, + Botan::Credentials_Manager& creds, + const std::string& kex_policy, + const std::string& cipher_policy, + const std::string& mac_policy, + const std::string& etm_policy, + bool client_auth = false) { Test_Policy policy; policy.set("ciphers", cipher_policy); @@ -704,31 +705,33 @@ class TLS_Unit_Tests final : public Test return test_with_policy(test_descr, results, client_ses, server_ses, creds, versions, policy, client_auth); } - void test_modern_versions(const std::string& test_descr, - std::vector<Test::Result>& results, - Botan::TLS::Session_Manager& client_ses, - Botan::TLS::Session_Manager& server_ses, - Botan::Credentials_Manager& creds, - const std::string& kex_policy, - const std::string& cipher_policy, - const std::string& mac_policy = "AEAD", - bool client_auth = false) + static void test_modern_versions( + const std::string& test_descr, + std::vector<Test::Result>& results, + Botan::TLS::Session_Manager& client_ses, + Botan::TLS::Session_Manager& server_ses, + Botan::Credentials_Manager& creds, + const std::string& kex_policy, + const std::string& cipher_policy, + const std::string& mac_policy = "AEAD", + bool client_auth = false) { std::map<std::string, std::string> no_extra_policies; return test_modern_versions(test_descr, results, client_ses, server_ses, creds, kex_policy, cipher_policy, mac_policy, no_extra_policies, client_auth); } - void test_modern_versions(const std::string& test_descr, - std::vector<Test::Result>& results, - Botan::TLS::Session_Manager& client_ses, - Botan::TLS::Session_Manager& server_ses, - Botan::Credentials_Manager& creds, - const std::string& kex_policy, - const std::string& cipher_policy, - const std::string& mac_policy, - const std::map<std::string, std::string>& extra_policies, - bool client_auth = false) + static void test_modern_versions( + const std::string& test_descr, + std::vector<Test::Result>& results, + Botan::TLS::Session_Manager& client_ses, + Botan::TLS::Session_Manager& server_ses, + Botan::Credentials_Manager& creds, + const std::string& kex_policy, + const std::string& cipher_policy, + const std::string& mac_policy, + const std::map<std::string, std::string>& extra_policies, + bool client_auth = false) { Test_Policy policy; policy.set("ciphers", cipher_policy); diff --git a/src/tests/unit_tls_policy.cpp b/src/tests/unit_tls_policy.cpp index d92c5f591..6acb1d39f 100644 --- a/src/tests/unit_tls_policy.cpp +++ b/src/tests/unit_tls_policy.cpp @@ -49,7 +49,7 @@ class TLS_Policy_Unit_Tests final : public Test return results; } private: - Test::Result test_peer_key_acceptable_rsa() + static Test::Result test_peer_key_acceptable_rsa() { Test::Result result("TLS Policy RSA key verification"); #if defined(BOTAN_HAS_RSA) @@ -73,7 +73,7 @@ class TLS_Policy_Unit_Tests final : public Test return result; } - Test::Result test_peer_key_acceptable_ecdh() + static Test::Result test_peer_key_acceptable_ecdh() { Test::Result result("TLS Policy ECDH key verification"); #if defined(BOTAN_HAS_ECDH) @@ -99,7 +99,7 @@ class TLS_Policy_Unit_Tests final : public Test return result; } - Test::Result test_peer_key_acceptable_ecdsa() + static Test::Result test_peer_key_acceptable_ecdsa() { Test::Result result("TLS Policy ECDSA key verification"); #if defined(BOTAN_HAS_ECDSA) @@ -125,7 +125,7 @@ class TLS_Policy_Unit_Tests final : public Test return result; } - Test::Result test_peer_key_acceptable_dh() + static Test::Result test_peer_key_acceptable_dh() { Test::Result result("TLS Policy DH key verification"); #if defined(BOTAN_HAS_DIFFIE_HELLMAN) |