diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-08 17:08:53 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-09 18:32:27 +0200 |
commit | 8bb22cbc88d930f4e88989bfbce0d19dcd0887e2 (patch) | |
tree | c291e1b0ba50741ca4ac0ffc0f6181c8244b0f99 | |
parent | 1eb3c410bfaedc675da6256276d2481b13a8eef2 (diff) | |
download | libnitrokey-8bb22cbc88d930f4e88989bfbce0d19dcd0887e2.tar.gz libnitrokey-8bb22cbc88d930f4e88989bfbce0d19dcd0887e2.tar.bz2 |
Replace Authorization commands with shorter version
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | NitrokeyManager.cc | 15 |
1 files 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<EraseSlot>(); p.slot_number = slot_number; - auto auth = get_payload<Authorize>(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = EraseSlot::CommandTransaction::getCRC(p); - Authorize::CommandTransaction::run(*device, auth); + auth_package<EraseSlot, Authorize>(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<Authorize>(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = WriteToHOTPSlot::CommandTransaction::getCRC(payload); - Authorize::CommandTransaction::run(*device, auth); + auth_package<WriteToHOTPSlot, Authorize>(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<Authorize>(); - strcpyT(auth.temporary_password, temporary_password); - auth.crc_to_authorize = WriteToTOTPSlot::CommandTransaction::getCRC(payload); - Authorize::CommandTransaction::run(*device, auth); + auth_package<WriteToTOTPSlot, Authorize>(payload, temporary_password, device); auto resp = WriteToTOTPSlot::CommandTransaction::run(*device, payload); return true; |