aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NK_C_API.cc4
-rw-r--r--NK_C_API.h4
-rw-r--r--unittest/test_C_API.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 05102cc..262a0a4 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -279,14 +279,14 @@ NK_C_API int NK_totp_get_time(){
});
}
-NK_C_API int NK_change_admin_PIN(char *current_PIN, char *new_PIN){
+NK_C_API int NK_change_admin_PIN(const char *current_PIN, const char *new_PIN){
auto m = NitrokeyManager::instance();
return get_without_result([&](){
m->change_admin_PIN(current_PIN, new_PIN);
});
}
-NK_C_API int NK_change_user_PIN(char *current_PIN, char *new_PIN){
+NK_C_API int NK_change_user_PIN(const char *current_PIN, const char *new_PIN){
auto m = NitrokeyManager::instance();
return get_without_result([&](){
m->change_user_PIN(current_PIN, new_PIN);
diff --git a/NK_C_API.h b/NK_C_API.h
index dd31287..f52034a 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -244,7 +244,7 @@ NK_C_API int NK_totp_get_time();
* @param new_PIN char[25](Pro) new PIN
* @return command processing error code
*/
-NK_C_API int NK_change_admin_PIN(char *current_PIN, char *new_PIN);
+NK_C_API int NK_change_admin_PIN(const char *current_PIN, const char *new_PIN);
/**
* Change user PIN
@@ -252,7 +252,7 @@ NK_C_API int NK_change_admin_PIN(char *current_PIN, char *new_PIN);
* @param new_PIN char[25](Pro) new PIN
* @return command processing error code
*/
-NK_C_API int NK_change_user_PIN(char *current_PIN, char *new_PIN);
+NK_C_API int NK_change_user_PIN(const char *current_PIN, const char *new_PIN);
/**
diff --git a/unittest/test_C_API.cpp b/unittest/test_C_API.cpp
index 37d3c7f..160145b 100644
--- a/unittest/test_C_API.cpp
+++ b/unittest/test_C_API.cpp
@@ -24,8 +24,8 @@ TEST_CASE("Check retry count", "[BASIC]") {
}
TEST_CASE("Check long strings", "[STANDARD]") {
- char* longPin = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- char *pin = "123123123";
+ const char* longPin = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+ const char* pin = "123123123";
auto result = NK_change_user_PIN(longPin, pin);
REQUIRE(result == TOO_LONG_STRING);
result = NK_change_user_PIN(pin, longPin);