diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_ffi.cpp | 4 | ||||
-rw-r--r-- | src/tests/test_otp.cpp | 8 | ||||
-rw-r--r-- | src/tests/test_runner.cpp | 4 | ||||
-rw-r--r-- | src/tests/test_tls.cpp | 5 | ||||
-rw-r--r-- | src/tests/test_tls_messages.cpp | 4 | ||||
-rw-r--r-- | src/tests/test_tss.cpp | 3 | ||||
-rw-r--r-- | src/tests/unit_x509.cpp | 2 |
7 files changed, 16 insertions, 14 deletions
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp index fddc9874d..58b491a9a 100644 --- a/src/tests/test_ffi.cpp +++ b/src/tests/test_ffi.cpp @@ -1902,7 +1902,7 @@ class FFI_Unit_Tests final : public Test TEST_FFI_OK(botan_pk_op_sign_destroy, (signer)); } - botan_pk_op_verify_t verifier; + botan_pk_op_verify_t verifier = nullptr; if(signature.size() > 0 && TEST_FFI_OK(botan_pk_op_verify_create, (&verifier, pub, "EMSA1(SHA-256)", 0))) { @@ -2008,7 +2008,7 @@ class FFI_Unit_Tests final : public Test TEST_FFI_OK(botan_pk_op_sign_destroy, (signer)); } - botan_pk_op_verify_t verifier; + botan_pk_op_verify_t verifier = nullptr; if(signature.size() > 0 && TEST_FFI_OK(botan_pk_op_verify_create, (&verifier, pub, "EMSA1(SHA-384)", 0))) { diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp index 15cd2a9fb..5ded1a74c 100644 --- a/src/tests/test_otp.cpp +++ b/src/tests/test_otp.cpp @@ -41,13 +41,13 @@ class HOTP_KAT_Tests final : public Text_Based_Test return {result}; const std::vector<uint8_t> key = vars.get_req_bin("Key"); - const size_t otp = vars.get_req_sz("OTP"); + const uint32_t otp = static_cast<uint32_t>(vars.get_req_sz("OTP")); const uint64_t counter = vars.get_req_sz("Counter"); const size_t digits = vars.get_req_sz("Digits"); Botan::HOTP hotp(key, hash_algo, digits); - result.test_eq("OTP", hotp.generate_hotp(counter), otp); + result.test_int_eq("OTP", hotp.generate_hotp(counter), otp); std::pair<bool, uint64_t> otp_res = hotp.verify_hotp(otp, counter, 0); result.test_eq("OTP verify result", otp_res.first, true); @@ -96,7 +96,7 @@ class TOTP_KAT_Tests final : public Text_Based_Test return {result}; const std::vector<uint8_t> key = vars.get_req_bin("Key"); - const size_t otp = vars.get_req_sz("OTP"); + const uint32_t otp = static_cast<uint32_t>(vars.get_req_sz("OTP")); const size_t digits = vars.get_req_sz("Digits"); const size_t timestep = vars.get_req_sz("Timestep"); const std::string timestamp = vars.get_req_str("Timestamp"); @@ -107,7 +107,7 @@ class TOTP_KAT_Tests final : public Text_Based_Test std::chrono::system_clock::time_point later_time = time + std::chrono::seconds(timestep); std::chrono::system_clock::time_point too_late = time + std::chrono::seconds(2*timestep); - result.test_eq("TOTP generate", totp.generate_totp(time), otp); + result.test_int_eq("TOTP generate", totp.generate_totp(time), otp); result.test_eq("TOTP verify valid", totp.verify_totp(otp, time, 0), true); result.test_eq("TOTP verify invalid", totp.verify_totp(otp ^ 1, time, 0), false); diff --git a/src/tests/test_runner.cpp b/src/tests/test_runner.cpp index 8d3f9b72c..e7862e90d 100644 --- a/src/tests/test_runner.cpp +++ b/src/tests/test_runner.cpp @@ -71,7 +71,7 @@ class Testsuite_RNG final : public Botan::RandomNumberGenerator for(size_t i = 0; i != ROUNDS; ++i) { - m_a += i; + m_a += static_cast<uint32_t>(i); m_a = Botan::rotl<9>(m_a); m_b ^= m_a; @@ -184,7 +184,7 @@ int Test_Runner::run(const Test_Options& opts) const size_t failed = run_tests(req, i, opts.test_runs()); if(failed > 0) - return failed; + return static_cast<int>(failed); } return 0; diff --git a/src/tests/test_tls.cpp b/src/tests/test_tls.cpp index 8a327b652..9b734bdea 100644 --- a/src/tests/test_tls.cpp +++ b/src/tests/test_tls.cpp @@ -358,11 +358,12 @@ class Test_TLS_Ciphersuites : public Test for(size_t csuite_id = 0; csuite_id <= 0xFFFF; ++csuite_id) { - Botan::TLS::Ciphersuite ciphersuite = Botan::TLS::Ciphersuite::by_id(csuite_id); + const uint16_t csuite_id16 = static_cast<uint16_t>(csuite_id); + Botan::TLS::Ciphersuite ciphersuite = Botan::TLS::Ciphersuite::by_id(csuite_id16); if(ciphersuite.valid()) { - result.test_eq("Valid Ciphersuite is not SCSV", Botan::TLS::Ciphersuite::is_scsv(csuite_id), false); + result.test_eq("Valid Ciphersuite is not SCSV", Botan::TLS::Ciphersuite::is_scsv(csuite_id16), false); if(ciphersuite.cbc_ciphersuite() == false) { diff --git a/src/tests/test_tls_messages.cpp b/src/tests/test_tls_messages.cpp index 038b79085..364fdc0bf 100644 --- a/src/tests/test_tls_messages.cpp +++ b/src/tests/test_tls_messages.cpp @@ -78,7 +78,7 @@ class TLS_Message_Parsing_Test final : public Text_Based_Test std::vector<uint8_t> buf; for(Botan::TLS::Handshake_Extension_Type const& type : message.extension_types()) { - uint16_t u16type = type; + uint16_t u16type = static_cast<uint16_t>(type); buf.push_back(Botan::get_byte(0, u16type)); buf.push_back(Botan::get_byte(1, u16type)); } @@ -107,7 +107,7 @@ class TLS_Message_Parsing_Test final : public Text_Based_Test std::vector<uint8_t> buf; for(Botan::TLS::Handshake_Extension_Type const& type : message.extension_types()) { - uint16_t u16type = type; + uint16_t u16type = static_cast<uint16_t>(type); buf.push_back(Botan::get_byte(0, u16type)); buf.push_back(Botan::get_byte(1, u16type)); } diff --git a/src/tests/test_tss.cpp b/src/tests/test_tss.cpp index a4aed6b47..52c952b3a 100644 --- a/src/tests/test_tss.cpp +++ b/src/tests/test_tss.cpp @@ -118,7 +118,8 @@ class TSS_Generation_Tests final : public Text_Based_Test Fixed_Output_RNG fixed_rng(rng_data); std::vector<Botan::RTSS_Share> shares = - Botan::RTSS_Share::split(M, N, input.data(), input.size(), id, hash, fixed_rng); + Botan::RTSS_Share::split(M, N, input.data(), static_cast<uint16_t>(input.size()), + id, hash, fixed_rng); result.test_eq("Expected number of shares", shares.size(), N); diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp index b0a5da23a..03f5d928c 100644 --- a/src/tests/unit_x509.cpp +++ b/src/tests/unit_x509.cpp @@ -33,7 +33,7 @@ Botan::X509_Time from_date(const int y, const int m, const int d) { const size_t this_year = Botan::calendar_value(std::chrono::system_clock::now()).get_year(); - Botan::calendar_point t(this_year + y, m, d, 0, 0, 0); + Botan::calendar_point t(static_cast<uint32_t>(this_year + y), m, d, 0, 0, 0); return Botan::X509_Time(t.to_std_timepoint()); } |