diff options
author | Jack Lloyd <[email protected]> | 2017-05-22 12:43:10 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-05-22 12:43:10 -0400 |
commit | 9761cd53a695c17ad444ada6f0a00fb9ad5a1256 (patch) | |
tree | 2c37f9057c38bae0ad8cad8f8c4189a56ef97745 /src/tests/test_otp.cpp | |
parent | ef2c04db178d0610352a27219e7b61b5169b826b (diff) |
Doc and 32-bit build fixes
Diffstat (limited to 'src/tests/test_otp.cpp')
-rw-r--r-- | src/tests/test_otp.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp index aa899f764..480065194 100644 --- a/src/tests/test_otp.cpp +++ b/src/tests/test_otp.cpp @@ -35,7 +35,7 @@ class HOTP_KAT_Tests : public Text_Based_Test const std::vector<uint8_t> key = get_req_bin(vars, "Key"); const size_t otp = get_req_sz(vars, "OTP"); - const size_t counter = get_req_sz(vars, "Counter"); + const uint64_t counter = get_req_sz(vars, "Counter"); const size_t digits = get_req_sz(vars, "Digits"); Botan::HOTP hotp(key, hash_algo, digits); @@ -44,28 +44,28 @@ class HOTP_KAT_Tests : public Text_Based_Test std::pair<bool, uint64_t> otp_res = hotp.verify_hotp(otp, counter, 0); result.test_eq("OTP verify result", otp_res.first, true); - result.test_eq("OTP verify next counter", otp_res.second, counter + 1); + result.confirm("OTP verify next counter", otp_res.second == counter + 1); // Test invalid OTP otp_res = hotp.verify_hotp(otp + 1, counter, 0); result.test_eq("OTP verify result", otp_res.first, false); - result.test_eq("OTP verify next counter", otp_res.second, counter); + result.confirm("OTP verify next counter", otp_res.second == counter); // Test invalid OTP with long range otp_res = hotp.verify_hotp(otp + 1, counter, 100); result.test_eq("OTP verify result", otp_res.first, false); - result.test_eq("OTP verify next counter", otp_res.second, counter); + result.confirm("OTP verify next counter", otp_res.second == counter); // Test valid OTP with long range otp_res = hotp.verify_hotp(otp, counter - 90, 100); result.test_eq("OTP verify result", otp_res.first, true); - result.test_eq("OTP verify next counter", otp_res.second, counter + 1); + result.confirm("OTP verify next counter", otp_res.second == counter + 1); return result; } }; -BOTAN_REGISTER_TEST("hotp", HOTP_KAT_Tests); +BOTAN_REGISTER_TEST("otp_hotp", HOTP_KAT_Tests); #endif @@ -124,7 +124,7 @@ class TOTP_KAT_Tests : public Text_Based_Test } }; -BOTAN_REGISTER_TEST("totp", TOTP_KAT_Tests); +BOTAN_REGISTER_TEST("otp_totp", TOTP_KAT_Tests); #endif } |