From 08e0a45a8f10ae4fbe294a903b3a6264aa3c4333 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 12 Dec 2017 17:45:35 +0100 Subject: Correct variable name for unencrypted ro/rw switch Signed-off-by: Szczepan Zalega --- NK_C_API.cc | 8 ++++---- NK_C_API.h | 10 ++++++---- NitrokeyManager.cc | 12 ++++++------ include/NitrokeyManager.h | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NK_C_API.cc b/NK_C_API.cc index 9b53b49..8ce318f 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -495,17 +495,17 @@ extern "C" { }); } - NK_C_API int NK_set_unencrypted_read_only(const char* user_pin) { + NK_C_API int NK_set_unencrypted_read_only(const char* user_admin_pin) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { - m->set_unencrypted_read_only(user_pin); + m->set_unencrypted_read_only(user_admin_pin); }); } - NK_C_API int NK_set_unencrypted_read_write(const char* user_pin) { + NK_C_API int NK_set_unencrypted_read_write(const char* user_admin_pin) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { - m->set_unencrypted_read_write(user_pin); + m->set_unencrypted_read_write(user_admin_pin); }); } diff --git a/NK_C_API.h b/NK_C_API.h index bd7130f..9ab29b5 100644 --- a/NK_C_API.h +++ b/NK_C_API.h @@ -428,21 +428,23 @@ extern "C" { * Make unencrypted volume read-only. * Device hides unencrypted volume for a second therefore make sure * buffers are flushed before running. + * Accepts: User PIN for Storage v0.48 and below, Admin PIN for Storage v0.49+ * Storage only - * @param user_pin 20 characters + * @param user_admin_pin 20 characters * @return command processing error code */ - NK_C_API int NK_set_unencrypted_read_only(const char* user_pin); + NK_C_API int NK_set_unencrypted_read_only(const char* user_admin_pin); /** * Make unencrypted volume read-write. * Device hides unencrypted volume for a second therefore make sure * buffers are flushed before running. + * Accepts: User PIN for Storage v0.48 and below, Admin PIN for Storage v0.49+ * Storage only - * @param user_pin 20 characters + * @param user_admin_pin 20 characters * @return command processing error code */ - NK_C_API int NK_set_unencrypted_read_write(const char* user_pin); + NK_C_API int NK_set_unencrypted_read_write(const char* user_admin_pin); /** * Make encrypted volume read-only. diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index de52e25..d4a13d1 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -824,20 +824,20 @@ using nitrokey::misc::strcpyT; stick20::SetupHiddenVolume::CommandTransaction::run(device, p); } - void NitrokeyManager::set_unencrypted_read_only(const char* user_pin) { + void NitrokeyManager::set_unencrypted_read_only(const char* user_admin_pin) { //until 0.48 User PIN was sufficient, from 0.49 it needs Admin PIN if (get_minor_firmware_version()<=48) - misc::execute_password_command(device, user_pin); + misc::execute_password_command(device, user_admin_pin); else - misc::execute_password_command(device, user_pin); + misc::execute_password_command(device, user_admin_pin); } - void NitrokeyManager::set_unencrypted_read_write(const char* user_pin) { + void NitrokeyManager::set_unencrypted_read_write(const char* user_admin_pin) { //until 0.48 User PIN was sufficient, from 0.49 it needs Admin PIN if (get_minor_firmware_version()<=48) - misc::execute_password_command(device, user_pin); + misc::execute_password_command(device, user_admin_pin); else - misc::execute_password_command(device, user_pin); + misc::execute_password_command(device, user_admin_pin); } void NitrokeyManager::export_firmware(const char* admin_pin) { diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h index e0aa59f..67dd128 100644 --- a/include/NitrokeyManager.h +++ b/include/NitrokeyManager.h @@ -126,9 +126,9 @@ char * strndup(const char* str, size_t maxlen); void unlock_hidden_volume(const char *hidden_volume_password); void lock_hidden_volume(); - void set_unencrypted_read_only(const char *user_pin); + void set_unencrypted_read_only(const char *user_admin_pin); - void set_unencrypted_read_write(const char *user_pin); + void set_unencrypted_read_write(const char *user_admin_pin); void export_firmware(const char *admin_pin); void enable_firmware_update(const char *firmware_pin); -- cgit v1.2.1