summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-02-21 13:12:12 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:49 +0100
commitad286a23ba8a542afe0095b97caf52320778c5e6 (patch)
tree9936362bd9e35017d1d68c4258fa1d064ac3cc7c
parent343b77dde196ab2e8ea82e7149b5703a771a9699 (diff)
downloadlibnitrokey-ad286a23ba8a542afe0095b97caf52320778c5e6.tar.gz
libnitrokey-ad286a23ba8a542afe0095b97caf52320778c5e6.tar.bz2
Feature check for 320 bits OTP secret
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NitrokeyManager.cc11
-rw-r--r--include/NitrokeyManager.h6
-rw-r--r--include/log.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 2858a18..62687b3 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -650,11 +650,20 @@ namespace nitrokey{
//authorization command is supported for versions equal or below:
auto m = std::unordered_map<DeviceModel , int, EnumClassHash>({
{DeviceModel::PRO, 7},
- {DeviceModel::STORAGE, 99},
+ {DeviceModel::STORAGE, 999},
});
return get_minor_firmware_version() <= m[device->get_device_model()];
}
+ bool NitrokeyManager::is_320_OTP_secret_supported(){
+ //authorization command is supported for versions equal or below:
+ auto m = std::unordered_map<DeviceModel , int, EnumClassHash>({
+ {DeviceModel::PRO, 8},
+ {DeviceModel::STORAGE, 999},
+ });
+ return get_minor_firmware_version() >= m[device->get_device_model()];
+ }
+
DeviceModel NitrokeyManager::get_connected_device_model() const{
//FIXME throw if no device is connected or return unknown/unconnected value
if (device == nullptr){
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index 7cf55c7..d49941e 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -122,12 +122,14 @@ namespace nitrokey {
std::pair<uint8_t,uint8_t> get_SD_usage_data();
- int get_progress_bar_value();
+ int get_progress_bar_value();
~NitrokeyManager();
bool is_authorization_command_supported();
+ bool is_320_OTP_secret_supported();
- template <typename S, typename A, typename T>
+
+ template <typename S, typename A, typename T>
void authorize_packet(T &package, const char *admin_temporary_password, shared_ptr<Device> device);
int get_minor_firmware_version();
diff --git a/include/log.h b/include/log.h
index 0b0df8c..30fc7fa 100644
--- a/include/log.h
+++ b/include/log.h
@@ -5,7 +5,7 @@
namespace nitrokey {
namespace log {
-
+
#ifdef ERROR
#undef ERROR
#endif