From 7b6800f7e2cf890a14e3b49d6fc7405e70d94a1e Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 27 Jul 2016 19:05:18 +0200 Subject: Config options for OTP slots added to command structure Signed-off-by: Szczepan Zalega --- include/stick10_commands.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'include/stick10_commands.h') diff --git a/include/stick10_commands.h b/include/stick10_commands.h index 7a7e2f2..6df8727 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -88,7 +88,14 @@ class WriteToHOTPSlot : Command { uint8_t slot_number; uint8_t slot_name[15]; uint8_t slot_secret[20]; - uint8_t slot_config; + union{ + uint8_t _slot_config; + struct{ + bool use_8_digits : 1; + bool use_enter : 1; + bool use_tokenID : 1; + }; + }; uint8_t slot_token_id[13]; uint64_t slot_counter; @@ -98,7 +105,11 @@ class WriteToHOTPSlot : Command { ss << "slot_number:\t" << (int)(slot_number) << std::endl; ss << "slot_name:\t" << slot_name << std::endl; ss << "slot_secret:\t" << slot_secret << std::endl; - ss << "slot_config:\t" << std::bitset<8>((int)slot_config) << std::endl; + ss << "slot_config:\t" << std::bitset<8>((int)_slot_config) << std::endl; + ss << "\tuse_8_digits(0):\t" << use_8_digits << std::endl; + ss << "\tuse_enter(1):\t" << use_enter << std::endl; + ss << "\tuse_tokenID(2):\t" << use_tokenID << std::endl; + ss << "slot_token_id:\t"; for (auto i : slot_token_id) ss << std::hex << std::setw(2) << std::setfill('0')<< (int) i << " " ; @@ -118,7 +129,14 @@ class WriteToTOTPSlot : Command { uint8_t slot_number; uint8_t slot_name[15]; uint8_t slot_secret[20]; - uint8_t slot_config; + union{ + uint8_t _slot_config; + struct{ + bool use_8_digits : 1; + bool use_enter : 1; + bool use_tokenID : 1; + }; + }; uint8_t slot_token_id[13]; uint16_t slot_interval; @@ -128,7 +146,7 @@ class WriteToTOTPSlot : Command { ss << "slot_number:\t" << (int)(slot_number) << std::endl; ss << "slot_name:\t" << slot_name << std::endl; ss << "slot_secret:\t" << slot_secret << std::endl; - ss << "slot_config:\t" << std::bitset<8>((int)slot_config) << std::endl; + ss << "slot_config:\t" << std::bitset<8>((int)_slot_config) << std::endl; ss << "slot_token_id:\t"; for (auto i : slot_token_id) ss << std::hex << std::setw(2) << std::setfill('0')<< (int) i << " " ; -- cgit v1.2.1