From b44b15f5c69c0cebdf2ce3a7005ed044d67de56b Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 15 Apr 2017 15:37:04 +0200 Subject: Catch invalid CRC on factory reset Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 9a9d106..cb2d14a 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -652,7 +652,12 @@ using nitrokey::misc::strcpyT; void NitrokeyManager::factory_reset(const char *admin_password) { auto p = get_payload(); strcpyT(p.admin_password, admin_password); + try{ FactoryReset::CommandTransaction::run(device, p); + } + catch(InvalidCRCReceived){ + LOG("Invalid CRC in received packet for " + std::string(__FUNCTION__), Loglevel::WARNING); + } } void NitrokeyManager::unlock_user_password(const char *admin_password, const char *new_user_password) { -- cgit v1.2.3