diff options
author | Elie Tournier <tournier.elie@gmail.com> | 2017-04-20 11:15:40 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-25 15:16:12 +0200 |
commit | ea9a9d738e7a53ceca93de6e41501b6b31bb1844 (patch) | |
tree | 8e6d94f45deccb74856cb53cbed42427561000fe | |
parent | af1e72475cc3f1cfc7cadece162e2231610c8cd0 (diff) | |
download | libnitrokey-ea9a9d738e7a53ceca93de6e41501b6b31bb1844.tar.gz libnitrokey-ea9a9d738e7a53ceca93de6e41501b6b31bb1844.tar.bz2 |
Rename #define: s/STICK10/NKPRO and s/STICK20/NKSTORAGEpr_60
Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
-rw-r--r-- | include/NKPro_commands.h | 4 | ||||
-rw-r--r-- | include/NKPro_commands_0.8.h | 7 | ||||
-rw-r--r-- | include/NKStorage_commands.h | 8 | ||||
-rw-r--r-- | include/device_proto.h | 4 | ||||
-rw-r--r-- | unittest/test2.cc | 70 | ||||
-rw-r--r-- | unittest/test_command_ids_header.h | 70 |
6 files changed, 81 insertions, 82 deletions
diff --git a/include/NKPro_commands.h b/include/NKPro_commands.h index 60ab1b7..35837ca 100644 --- a/include/NKPro_commands.h +++ b/include/NKPro_commands.h @@ -1,5 +1,5 @@ -#ifndef STICK10_COMMANDS_H -#define STICK10_COMMANDS_H +#ifndef NKPRO_COMMANDS_H +#define NKPRO_COMMANDS_H #include <bitset> #include <iomanip> diff --git a/include/NKPro_commands_0.8.h b/include/NKPro_commands_0.8.h index 5fffdfe..5d205ed 100644 --- a/include/NKPro_commands_0.8.h +++ b/include/NKPro_commands_0.8.h @@ -2,8 +2,8 @@ // Created by sz on 08.11.16. // -#ifndef LIBNITROKEY_STICK10_COMMANDS_0_8_H -#define LIBNITROKEY_STICK10_COMMANDS_0_8_H +#ifndef LIBNITROKEY_NKPRO_COMMANDS_0_8_H +#define LIBNITROKEY_NKPRO_COMMANDS_0_8_H #include <bitset> #include <iomanip> @@ -322,5 +322,4 @@ namespace nitrokey { } } #pragma pack (pop) - -#endif //LIBNITROKEY_STICK10_COMMANDS_0_8_H +#endif //LIBNITROKEY_NKPRO_COMMANDS_0_8_H diff --git a/include/NKStorage_commands.h b/include/NKStorage_commands.h index b375617..7bbebe0 100644 --- a/include/NKStorage_commands.h +++ b/include/NKStorage_commands.h @@ -1,5 +1,5 @@ -#ifndef STICK20_COMMANDS_H -#define STICK20_COMMANDS_H +#ifndef NKSTORAGE_COMMANDS_H +#define NKSTORAGE_COMMANDS_H @@ -15,8 +15,8 @@ namespace nitrokey { namespace proto { /* -* STICK20 protocol command ids -* a superset (almost) of STICK10 +* NKSTORAGE protocol command ids +* a superset (almost) of NKPRO */ namespace NKStorage { diff --git a/include/device_proto.h b/include/device_proto.h index 4abb7b8..935739e 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -17,8 +17,8 @@ #include "CommandFailedException.h" #include "LongOperationInProgressException.h" -#define STICK20_UPDATE_MODE_VID 0x03EB -#define STICK20_UPDATE_MODE_PID 0x2FF1 +#define NKSTORAGE_UPDATE_MODE_VID 0x03EB +#define NKSTORAGE_UPDATE_MODE_PID 0x2FF1 #define PAYLOAD_SIZE 53 #define PWS_SLOT_COUNT 16 diff --git a/unittest/test2.cc b/unittest/test2.cc index cd012c5..e477afa 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -84,41 +84,41 @@ TEST_CASE("long operation test", "[test_long]") { TEST_CASE("test device commands ids", "[fast]") { -// REQUIRE(STICK20_CMD_START_VALUE == static_cast<uint8_t>(CommandID::START_VALUE)); - REQUIRE(STICK20_CMD_ENABLE_CRYPTED_PARI == static_cast<uint8_t>(CommandID::ENABLE_CRYPTED_PARI)); - REQUIRE(STICK20_CMD_DISABLE_CRYPTED_PARI == static_cast<uint8_t>(CommandID::DISABLE_CRYPTED_PARI)); - REQUIRE(STICK20_CMD_ENABLE_HIDDEN_CRYPTED_PARI == static_cast<uint8_t>(CommandID::ENABLE_HIDDEN_CRYPTED_PARI)); - REQUIRE(STICK20_CMD_DISABLE_HIDDEN_CRYPTED_PARI == static_cast<uint8_t>(CommandID::DISABLE_HIDDEN_CRYPTED_PARI)); - REQUIRE(STICK20_CMD_ENABLE_FIRMWARE_UPDATE == static_cast<uint8_t>(CommandID::ENABLE_FIRMWARE_UPDATE)); - REQUIRE(STICK20_CMD_EXPORT_FIRMWARE_TO_FILE == static_cast<uint8_t>(CommandID::EXPORT_FIRMWARE_TO_FILE)); - REQUIRE(STICK20_CMD_GENERATE_NEW_KEYS == static_cast<uint8_t>(CommandID::GENERATE_NEW_KEYS)); - REQUIRE(STICK20_CMD_FILL_SD_CARD_WITH_RANDOM_CHARS == static_cast<uint8_t>(CommandID::FILL_SD_CARD_WITH_RANDOM_CHARS)); - - REQUIRE(STICK20_CMD_WRITE_STATUS_DATA == static_cast<uint8_t>(CommandID::WRITE_STATUS_DATA)); - REQUIRE(STICK20_CMD_ENABLE_READONLY_UNCRYPTED_LUN == static_cast<uint8_t>(CommandID::ENABLE_READONLY_UNCRYPTED_LUN)); - REQUIRE(STICK20_CMD_ENABLE_READWRITE_UNCRYPTED_LUN == static_cast<uint8_t>(CommandID::ENABLE_READWRITE_UNCRYPTED_LUN)); - - REQUIRE(STICK20_CMD_SEND_PASSWORD_MATRIX == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX)); - REQUIRE(STICK20_CMD_SEND_PASSWORD_MATRIX_PINDATA == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX_PINDATA)); - REQUIRE(STICK20_CMD_SEND_PASSWORD_MATRIX_SETUP == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX_SETUP)); - - REQUIRE(STICK20_CMD_GET_DEVICE_STATUS == static_cast<uint8_t>(CommandID::GET_DEVICE_STATUS)); - REQUIRE(STICK20_CMD_SEND_DEVICE_STATUS == static_cast<uint8_t>(CommandID::SEND_DEVICE_STATUS)); - - REQUIRE(STICK20_CMD_SEND_HIDDEN_VOLUME_PASSWORD == static_cast<uint8_t>(CommandID::SEND_HIDDEN_VOLUME_PASSWORD)); - REQUIRE(STICK20_CMD_SEND_HIDDEN_VOLUME_SETUP == static_cast<uint8_t>(CommandID::SEND_HIDDEN_VOLUME_SETUP)); - REQUIRE(STICK20_CMD_SEND_PASSWORD == static_cast<uint8_t>(CommandID::SEND_PASSWORD)); - REQUIRE(STICK20_CMD_SEND_NEW_PASSWORD == static_cast<uint8_t>(CommandID::SEND_NEW_PASSWORD)); - REQUIRE(STICK20_CMD_CLEAR_NEW_SD_CARD_FOUND == static_cast<uint8_t>(CommandID::CLEAR_NEW_SD_CARD_FOUND)); - - REQUIRE(STICK20_CMD_SEND_STARTUP == static_cast<uint8_t>(CommandID::SEND_STARTUP)); - REQUIRE(STICK20_CMD_SEND_CLEAR_STICK_KEYS_NOT_INITIATED == static_cast<uint8_t>(CommandID::SEND_CLEAR_STICK_KEYS_NOT_INITIATED)); - REQUIRE(STICK20_CMD_SEND_LOCK_STICK_HARDWARE == static_cast<uint8_t>(CommandID::SEND_LOCK_STICK_HARDWARE)); - - REQUIRE(STICK20_CMD_PRODUCTION_TEST == static_cast<uint8_t>(CommandID::PRODUCTION_TEST)); - REQUIRE(STICK20_CMD_SEND_DEBUG_DATA == static_cast<uint8_t>(CommandID::SEND_DEBUG_DATA)); - - REQUIRE(STICK20_CMD_CHANGE_UPDATE_PIN == static_cast<uint8_t>(CommandID::CHANGE_UPDATE_PIN)); +// REQUIRE(NKSTORAGE_CMD_START_VALUE == static_cast<uint8_t>(CommandID::START_VALUE)); + REQUIRE(NKSTORAGE_CMD_ENABLE_CRYPTED_PARI == static_cast<uint8_t>(CommandID::ENABLE_CRYPTED_PARI)); + REQUIRE(NKSTORAGE_CMD_DISABLE_CRYPTED_PARI == static_cast<uint8_t>(CommandID::DISABLE_CRYPTED_PARI)); + REQUIRE(NKSTORAGE_CMD_ENABLE_HIDDEN_CRYPTED_PARI == static_cast<uint8_t>(CommandID::ENABLE_HIDDEN_CRYPTED_PARI)); + REQUIRE(NKSTORAGE_CMD_DISABLE_HIDDEN_CRYPTED_PARI == static_cast<uint8_t>(CommandID::DISABLE_HIDDEN_CRYPTED_PARI)); + REQUIRE(NKSTORAGE_CMD_ENABLE_FIRMWARE_UPDATE == static_cast<uint8_t>(CommandID::ENABLE_FIRMWARE_UPDATE)); + REQUIRE(NKSTORAGE_CMD_EXPORT_FIRMWARE_TO_FILE == static_cast<uint8_t>(CommandID::EXPORT_FIRMWARE_TO_FILE)); + REQUIRE(NKSTORAGE_CMD_GENERATE_NEW_KEYS == static_cast<uint8_t>(CommandID::GENERATE_NEW_KEYS)); + REQUIRE(NKSTORAGE_CMD_FILL_SD_CARD_WITH_RANDOM_CHARS == static_cast<uint8_t>(CommandID::FILL_SD_CARD_WITH_RANDOM_CHARS)); + + REQUIRE(NKSTORAGE_CMD_WRITE_STATUS_DATA == static_cast<uint8_t>(CommandID::WRITE_STATUS_DATA)); + REQUIRE(NKSTORAGE_CMD_ENABLE_READONLY_UNCRYPTED_LUN == static_cast<uint8_t>(CommandID::ENABLE_READONLY_UNCRYPTED_LUN)); + REQUIRE(NKSTORAGE_CMD_ENABLE_READWRITE_UNCRYPTED_LUN == static_cast<uint8_t>(CommandID::ENABLE_READWRITE_UNCRYPTED_LUN)); + + REQUIRE(NKSTORAGE_CMD_SEND_PASSWORD_MATRIX == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX)); + REQUIRE(NKSTORAGE_CMD_SEND_PASSWORD_MATRIX_PINDATA == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX_PINDATA)); + REQUIRE(NKSTORAGE_CMD_SEND_PASSWORD_MATRIX_SETUP == static_cast<uint8_t>(CommandID::SEND_PASSWORD_MATRIX_SETUP)); + + REQUIRE(NKSTORAGE_CMD_GET_DEVICE_STATUS == static_cast<uint8_t>(CommandID::GET_DEVICE_STATUS)); + REQUIRE(NKSTORAGE_CMD_SEND_DEVICE_STATUS == static_cast<uint8_t>(CommandID::SEND_DEVICE_STATUS)); + + REQUIRE(NKSTORAGE_CMD_SEND_HIDDEN_VOLUME_PASSWORD == static_cast<uint8_t>(CommandID::SEND_HIDDEN_VOLUME_PASSWORD)); + REQUIRE(NKSTORAGE_CMD_SEND_HIDDEN_VOLUME_SETUP == static_cast<uint8_t>(CommandID::SEND_HIDDEN_VOLUME_SETUP)); + REQUIRE(NKSTORAGE_CMD_SEND_PASSWORD == static_cast<uint8_t>(CommandID::SEND_PASSWORD)); + REQUIRE(NKSTORAGE_CMD_SEND_NEW_PASSWORD == static_cast<uint8_t>(CommandID::SEND_NEW_PASSWORD)); + REQUIRE(NKSTORAGE_CMD_CLEAR_NEW_SD_CARD_FOUND == static_cast<uint8_t>(CommandID::CLEAR_NEW_SD_CARD_FOUND)); + + REQUIRE(NKSTORAGE_CMD_SEND_STARTUP == static_cast<uint8_t>(CommandID::SEND_STARTUP)); + REQUIRE(NKSTORAGE_CMD_SEND_CLEAR_STICK_KEYS_NOT_INITIATED == static_cast<uint8_t>(CommandID::SEND_CLEAR_STICK_KEYS_NOT_INITIATED)); + REQUIRE(NKSTORAGE_CMD_SEND_LOCK_STICK_HARDWARE == static_cast<uint8_t>(CommandID::SEND_LOCK_STICK_HARDWARE)); + + REQUIRE(NKSTORAGE_CMD_PRODUCTION_TEST == static_cast<uint8_t>(CommandID::PRODUCTION_TEST)); + REQUIRE(NKSTORAGE_CMD_SEND_DEBUG_DATA == static_cast<uint8_t>(CommandID::SEND_DEBUG_DATA)); + + REQUIRE(NKSTORAGE_CMD_CHANGE_UPDATE_PIN == static_cast<uint8_t>(CommandID::CHANGE_UPDATE_PIN)); } diff --git a/unittest/test_command_ids_header.h b/unittest/test_command_ids_header.h index cd55c8a..56bc2d6 100644 --- a/unittest/test_command_ids_header.h +++ b/unittest/test_command_ids_header.h @@ -1,41 +1,41 @@ #ifndef LIBNITROKEY_TEST_COMMAND_IDS_HEADER_H_H #define LIBNITROKEY_TEST_COMMAND_IDS_HEADER_H_H -#define STICK20_CMD_START_VALUE 0x20 -#define STICK20_CMD_ENABLE_CRYPTED_PARI (STICK20_CMD_START_VALUE + 0) -#define STICK20_CMD_DISABLE_CRYPTED_PARI (STICK20_CMD_START_VALUE + 1) -#define STICK20_CMD_ENABLE_HIDDEN_CRYPTED_PARI (STICK20_CMD_START_VALUE + 2) -#define STICK20_CMD_DISABLE_HIDDEN_CRYPTED_PARI (STICK20_CMD_START_VALUE + 3) -#define STICK20_CMD_ENABLE_FIRMWARE_UPDATE (STICK20_CMD_START_VALUE + 4) -#define STICK20_CMD_EXPORT_FIRMWARE_TO_FILE (STICK20_CMD_START_VALUE + 5) -#define STICK20_CMD_GENERATE_NEW_KEYS (STICK20_CMD_START_VALUE + 6) -#define STICK20_CMD_FILL_SD_CARD_WITH_RANDOM_CHARS (STICK20_CMD_START_VALUE + 7) - -#define STICK20_CMD_WRITE_STATUS_DATA (STICK20_CMD_START_VALUE + 8) -#define STICK20_CMD_ENABLE_READONLY_UNCRYPTED_LUN (STICK20_CMD_START_VALUE + 9) -#define STICK20_CMD_ENABLE_READWRITE_UNCRYPTED_LUN (STICK20_CMD_START_VALUE + 10) - -#define STICK20_CMD_SEND_PASSWORD_MATRIX (STICK20_CMD_START_VALUE + 11) -#define STICK20_CMD_SEND_PASSWORD_MATRIX_PINDATA (STICK20_CMD_START_VALUE + 12) -#define STICK20_CMD_SEND_PASSWORD_MATRIX_SETUP (STICK20_CMD_START_VALUE + 13) - -#define STICK20_CMD_GET_DEVICE_STATUS (STICK20_CMD_START_VALUE + 14) -#define STICK20_CMD_SEND_DEVICE_STATUS (STICK20_CMD_START_VALUE + 15) - -#define STICK20_CMD_SEND_HIDDEN_VOLUME_PASSWORD (STICK20_CMD_START_VALUE + 16) -#define STICK20_CMD_SEND_HIDDEN_VOLUME_SETUP (STICK20_CMD_START_VALUE + 17) -#define STICK20_CMD_SEND_PASSWORD (STICK20_CMD_START_VALUE + 18) -#define STICK20_CMD_SEND_NEW_PASSWORD (STICK20_CMD_START_VALUE + 19) -#define STICK20_CMD_CLEAR_NEW_SD_CARD_FOUND (STICK20_CMD_START_VALUE + 20) - -#define STICK20_CMD_SEND_STARTUP (STICK20_CMD_START_VALUE + 21) -#define STICK20_CMD_SEND_CLEAR_STICK_KEYS_NOT_INITIATED (STICK20_CMD_START_VALUE + 22) -#define STICK20_CMD_SEND_LOCK_STICK_HARDWARE (STICK20_CMD_START_VALUE + 23) - -#define STICK20_CMD_PRODUCTION_TEST (STICK20_CMD_START_VALUE + 24) -#define STICK20_CMD_SEND_DEBUG_DATA (STICK20_CMD_START_VALUE + 25) - -#define STICK20_CMD_CHANGE_UPDATE_PIN (STICK20_CMD_START_VALUE + 26) +#define NKSTORAGE_CMD_START_VALUE 0x20 +#define NKSTORAGE_CMD_ENABLE_CRYPTED_PARI (NKSTORAGE_CMD_START_VALUE + 0) +#define NKSTORAGE_CMD_DISABLE_CRYPTED_PARI (NKSTORAGE_CMD_START_VALUE + 1) +#define NKSTORAGE_CMD_ENABLE_HIDDEN_CRYPTED_PARI (NKSTORAGE_CMD_START_VALUE + 2) +#define NKSTORAGE_CMD_DISABLE_HIDDEN_CRYPTED_PARI (NKSTORAGE_CMD_START_VALUE + 3) +#define NKSTORAGE_CMD_ENABLE_FIRMWARE_UPDATE (NKSTORAGE_CMD_START_VALUE + 4) +#define NKSTORAGE_CMD_EXPORT_FIRMWARE_TO_FILE (NKSTORAGE_CMD_START_VALUE + 5) +#define NKSTORAGE_CMD_GENERATE_NEW_KEYS (NKSTORAGE_CMD_START_VALUE + 6) +#define NKSTORAGE_CMD_FILL_SD_CARD_WITH_RANDOM_CHARS (NKSTORAGE_CMD_START_VALUE + 7) + +#define NKSTORAGE_CMD_WRITE_STATUS_DATA (NKSTORAGE_CMD_START_VALUE + 8) +#define NKSTORAGE_CMD_ENABLE_READONLY_UNCRYPTED_LUN (NKSTORAGE_CMD_START_VALUE + 9) +#define NKSTORAGE_CMD_ENABLE_READWRITE_UNCRYPTED_LUN (NKSTORAGE_CMD_START_VALUE + 10) + +#define NKSTORAGE_CMD_SEND_PASSWORD_MATRIX (NKSTORAGE_CMD_START_VALUE + 11) +#define NKSTORAGE_CMD_SEND_PASSWORD_MATRIX_PINDATA (NKSTORAGE_CMD_START_VALUE + 12) +#define NKSTORAGE_CMD_SEND_PASSWORD_MATRIX_SETUP (NKSTORAGE_CMD_START_VALUE + 13) + +#define NKSTORAGE_CMD_GET_DEVICE_STATUS (NKSTORAGE_CMD_START_VALUE + 14) +#define NKSTORAGE_CMD_SEND_DEVICE_STATUS (NKSTORAGE_CMD_START_VALUE + 15) + +#define NKSTORAGE_CMD_SEND_HIDDEN_VOLUME_PASSWORD (NKSTORAGE_CMD_START_VALUE + 16) +#define NKSTORAGE_CMD_SEND_HIDDEN_VOLUME_SETUP (NKSTORAGE_CMD_START_VALUE + 17) +#define NKSTORAGE_CMD_SEND_PASSWORD (NKSTORAGE_CMD_START_VALUE + 18) +#define NKSTORAGE_CMD_SEND_NEW_PASSWORD (NKSTORAGE_CMD_START_VALUE + 19) +#define NKSTORAGE_CMD_CLEAR_NEW_SD_CARD_FOUND (NKSTORAGE_CMD_START_VALUE + 20) + +#define NKSTORAGE_CMD_SEND_STARTUP (NKSTORAGE_CMD_START_VALUE + 21) +#define NKSTORAGE_CMD_SEND_CLEAR_STICK_KEYS_NOT_INITIATED (NKSTORAGE_CMD_START_VALUE + 22) +#define NKSTORAGE_CMD_SEND_LOCK_STICK_HARDWARE (NKSTORAGE_CMD_START_VALUE + 23) + +#define NKSTORAGE_CMD_PRODUCTION_TEST (NKSTORAGE_CMD_START_VALUE + 24) +#define NKSTORAGE_CMD_SEND_DEBUG_DATA (NKSTORAGE_CMD_START_VALUE + 25) + +#define NKSTORAGE_CMD_CHANGE_UPDATE_PIN (NKSTORAGE_CMD_START_VALUE + 26) #endif //LIBNITROKEY_TEST_COMMAND_IDS_HEADER_H_H |