summaryrefslogtreecommitdiff
path: root/unittest/test_HOTP.cc
diff options
context:
space:
mode:
authorCornelius Kölbel <cornelius.koelbel@netknights.it>2016-04-19 14:10:06 +0200
committerCornelius Kölbel <cornelius.koelbel@netknights.it>2016-04-19 14:10:06 +0200
commitab2658a648acc90d63f453cfbaca2970525e7e71 (patch)
tree8b0800ee681698fdee07ec66cb34e88c25d94433 /unittest/test_HOTP.cc
parentee12d4364ca023f7dcffc39ed231b0ef26055013 (diff)
downloadlibnitrokey-ab2658a648acc90d63f453cfbaca2970525e7e71.tar.gz
libnitrokey-ab2658a648acc90d63f453cfbaca2970525e7e71.tar.bz2
Reset the HOTP counter
If the token was initialized earlier the HOTP counter could be unequal zero resulting in faliing tests. This resets the counter of this slot to 0.
Diffstat (limited to 'unittest/test_HOTP.cc')
-rw-r--r--unittest/test_HOTP.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/unittest/test_HOTP.cc b/unittest/test_HOTP.cc
index b263693..1f54376 100644
--- a/unittest/test_HOTP.cc
+++ b/unittest/test_HOTP.cc
@@ -59,6 +59,8 @@ TEST_CASE("Test HOTP codes according to RFC", "[HOTP]") {
//strcpy(reinterpret_cast<char *>(hwrite.slot_secret), "");
const char* secretHex = "3132333435363738393031323334353637383930";
hexStringToByte(hwrite.slot_secret, secretHex);
+ // reset the HOTP counter
+ memset(hwrite.slot_counter, 0, 8);
//hwrite.slot_config; //TODO check various configs in separate test cases
//strcpy(reinterpret_cast<char *>(hwrite.slot_token_id), "");
//strcpy(reinterpret_cast<char *>(hwrite.slot_counter), "");