aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_otp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_otp.cpp')
-rw-r--r--src/tests/test_otp.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tests/test_otp.cpp b/src/tests/test_otp.cpp
index dfe01aa93..9bd4c0f18 100644
--- a/src/tests/test_otp.cpp
+++ b/src/tests/test_otp.cpp
@@ -6,6 +6,7 @@
*/
#include "tests.h"
+#include <botan/hash.h>
#if defined(BOTAN_HAS_HOTP)
#include <botan/parsing.h>
@@ -34,6 +35,10 @@ class HOTP_KAT_Tests final : public Text_Based_Test
{
Test::Result result("HOTP " + hash_algo);
+ std::unique_ptr<Botan::HashFunction> hash_test = Botan::HashFunction::create(hash_algo);
+ if(!hash_test)
+ return {result};
+
const std::vector<uint8_t> key = get_req_bin(vars, "Key");
const size_t otp = get_req_sz(vars, "OTP");
const uint64_t counter = get_req_sz(vars, "Counter");
@@ -85,6 +90,10 @@ class TOTP_KAT_Tests final : public Text_Based_Test
{
Test::Result result("TOTP " + hash_algo);
+ std::unique_ptr<Botan::HashFunction> hash_test = Botan::HashFunction::create(hash_algo);
+ if(!hash_test)
+ return {result};
+
const std::vector<uint8_t> key = get_req_bin(vars, "Key");
const size_t otp = get_req_sz(vars, "OTP");
const size_t digits = get_req_sz(vars, "Digits");