From 8bb22cbc88d930f4e88989bfbce0d19dcd0887e2 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 8 Aug 2016 17:08:53 +0200 Subject: Replace Authorization commands with shorter version Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index a230721..93b11fa 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -134,10 +134,7 @@ namespace nitrokey{ auto p = get_payload(); p.slot_number = slot_number; - auto auth = get_payload(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = EraseSlot::CommandTransaction::getCRC(p); - Authorize::CommandTransaction::run(*device, auth); + auth_package(p, temporary_password, device); auto resp = EraseSlot::CommandTransaction::run(*device,p); return true; @@ -174,10 +171,7 @@ namespace nitrokey{ payload.use_enter = use_enter; payload.use_tokenID = use_tokenID; - auto auth = get_payload(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = WriteToHOTPSlot::CommandTransaction::getCRC(payload); - Authorize::CommandTransaction::run(*device, auth); + auth_package(payload, temporary_password, device); auto resp = WriteToHOTPSlot::CommandTransaction::run(*device, payload); return true; @@ -201,10 +195,7 @@ namespace nitrokey{ payload.use_enter = use_enter; payload.use_tokenID = use_tokenID; - auto auth = get_payload(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = WriteToTOTPSlot::CommandTransaction::getCRC(payload); - Authorize::CommandTransaction::run(*device, auth); + auth_package(payload, temporary_password, device); auto resp = WriteToTOTPSlot::CommandTransaction::run(*device, payload); return true; -- cgit v1.2.3