diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-02-23 14:02:06 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-02-23 15:42:39 +0100 |
commit | a262472826830ea0a98a4da2fa8f665d359b8789 (patch) | |
tree | 7f2df53da4c018fbfa6ec57809bcd2fcefaf0624 /NitrokeyManager.cc | |
parent | bca1d0c3e458b3a12fe0117d1c7bd50548bef777 (diff) | |
download | libnitrokey-a262472826830ea0a98a4da2fa8f665d359b8789.tar.gz libnitrokey-a262472826830ea0a98a4da2fa8f665d359b8789.tar.bz2 |
Handle getting firmware version internally
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index f912c7c..d563b26 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -838,7 +838,7 @@ using nitrokey::misc::strcpyT; void NitrokeyManager::set_unencrypted_read_only_admin(const char* admin_pin) { //from v0.49, v0.51+ it needs Admin PIN - if (set_unencrypted_volume_rorw_pin_type_user(get_minor_firmware_version())){ + if (set_unencrypted_volume_rorw_pin_type_user()){ LOG("set_unencrypted_read_only_admin is not supported for this version of Storage device. " "Please update firmware to v0.51+", nitrokey::log::Loglevel::WARNING); return; @@ -850,7 +850,7 @@ using nitrokey::misc::strcpyT; //until v0.48 (incl. v0.50) User PIN was sufficient LOG("set_unencrypted_read_only is deprecated. Use set_unencrypted_read_only_admin instead.", nitrokey::log::Loglevel::WARNING); - if (!set_unencrypted_volume_rorw_pin_type_user(get_minor_firmware_version())){ + if (!set_unencrypted_volume_rorw_pin_type_user()){ LOG("set_unencrypted_read_only is not supported for this version of Storage device. Doing nothing.", nitrokey::log::Loglevel::WARNING); return; @@ -860,7 +860,7 @@ using nitrokey::misc::strcpyT; void NitrokeyManager::set_unencrypted_read_write_admin(const char* admin_pin) { //from v0.49, v0.51+ it needs Admin PIN - if (set_unencrypted_volume_rorw_pin_type_user(get_minor_firmware_version())){ + if (set_unencrypted_volume_rorw_pin_type_user()){ LOG("set_unencrypted_read_write_admin is not supported for this version of Storage device. " "Please update firmware to v0.51+.", nitrokey::log::Loglevel::WARNING); return; @@ -872,7 +872,7 @@ using nitrokey::misc::strcpyT; //until v0.48 (incl. v0.50) User PIN was sufficient LOG("set_unencrypted_read_write is deprecated. Use set_unencrypted_read_write_admin instead.", nitrokey::log::Loglevel::WARNING); - if (!set_unencrypted_volume_rorw_pin_type_user(get_minor_firmware_version())){ + if (!set_unencrypted_volume_rorw_pin_type_user()){ LOG("set_unencrypted_read_write is not supported for this version of Storage device. Doing nothing.", nitrokey::log::Loglevel::WARNING); return; @@ -880,7 +880,8 @@ using nitrokey::misc::strcpyT; misc::execute_password_command<stick20::SendSetReadwriteToUncryptedVolume>(device, user_pin); } - bool NitrokeyManager::set_unencrypted_volume_rorw_pin_type_user(const int minor_firmware_version) const { + bool NitrokeyManager::set_unencrypted_volume_rorw_pin_type_user(){ + auto minor_firmware_version = get_minor_firmware_version(); return minor_firmware_version <= 48 || minor_firmware_version == 50; } |