From 0c6f3234acea5888dd6c3c3aeee8cebcce59ba06 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Jan 2017 15:57:45 +0100 Subject: Use stdint instead of inttypes Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index e6df770..386cbda 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -1,7 +1,7 @@ #ifndef STICK20_COMMANDS_H #define STICK20_COMMANDS_H -#include "inttypes.h" +#include #include "command.h" #include #include -- cgit v1.2.1 From c2d3de8820cc2ad3f394b6672853af257d32e6f6 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 11 Jan 2017 16:04:52 +0100 Subject: Helper functions for getting device state get status for Pro and Storage check is device connected use make_shared for keeping instance reference fixed accessing active volume flag Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index 386cbda..8080117 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -141,7 +141,14 @@ namespace nitrokey { uint8_t NewSDCardFound_u8; uint8_t SDFillWithRandomChars_u8; uint32_t ActiveSD_CardID_u32; - uint8_t VolumeActiceFlag_u8; + union{ + uint8_t VolumeActiceFlag_u8; + struct { + bool unencrypted :1; + bool encrypted :1; + bool hidden :1; + } __packed VolumeActiceFlag_st; + } __packed; uint8_t NewSmartCardFound_u8; uint8_t UserPwRetryCount; uint8_t AdminPwRetryCount; -- cgit v1.2.1 From 185b318b9134da163bbfb160d2d737c835927f30 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 13 Jan 2017 12:55:08 +0100 Subject: Fix firmware version in device status Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index 8080117..fd72f1e 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -130,9 +130,9 @@ namespace nitrokey { uint8_t VersionInfo_au8[4]; struct { uint8_t __unused; - uint8_t major; - uint8_t __unused2; uint8_t minor; + uint8_t __unused2; + uint8_t major; } __packed versionInfo; }; -- cgit v1.2.1 From 69fedd655a87c32c0c54eac46a1d6df7450873d6 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 2 Feb 2017 18:22:40 +0100 Subject: Add description for some Storage variables Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index fd72f1e..a3f1609 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -123,6 +123,9 @@ namespace nitrokey { StorageCommandResponsePayload::TransmissionData transmission_data; uint16_t MagicNumber_StickConfig_u16; + /** + * READ_WRITE_ACTIVE = ReadWriteFlagUncryptedVolume_u8 == 0; + */ uint8_t ReadWriteFlagUncryptedVolume_u8; uint8_t ReadWriteFlagCryptedVolume_u8; @@ -134,11 +137,22 @@ namespace nitrokey { uint8_t __unused2; uint8_t major; } __packed versionInfo; - }; + } __packed; uint8_t ReadWriteFlagHiddenVolume_u8; uint8_t FirmwareLocked_u8; - uint8_t NewSDCardFound_u8; + + union{ + uint8_t NewSDCardFound_u8; + struct { + bool NewCard :1; + uint8_t Counter :7; + } __packed NewSDCardFound_st; + } __packed; + + /** + * SD card FILLED with random chars + */ uint8_t SDFillWithRandomChars_u8; uint32_t ActiveSD_CardID_u32; union{ -- cgit v1.2.1 From db76ae5299f3650385f66e4c596b18fd54250d38 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 3 Feb 2017 17:23:44 +0100 Subject: Allow users to lock encrypted volumes specifically Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index a3f1609..b887636 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -26,9 +26,12 @@ namespace nitrokey { public PasswordCommand {}; class EnableEncryptedPartition : public PasswordCommand {}; - class DisableEncryptedPartition : public PasswordCommand {}; class EnableHiddenEncryptedPartition : public PasswordCommand {}; + + //FIXME the volume disabling commands do not need password + class DisableEncryptedPartition : public PasswordCommand {}; class DisableHiddenEncryptedPartition : public PasswordCommand {}; + class EnableFirmwareUpdate : public PasswordCommand {}; class ChangeUpdatePassword : Command { -- cgit v1.2.1 From adbc664125142c434294bfa795666c90c7608429 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 9 Mar 2017 18:49:24 +0100 Subject: Adjust for compilation on Visual Studio 2017 Building works however tests are not. Possibly linking with original hidapi solution would work. --- include/stick20_commands.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index b887636..e3bea3f 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -1,12 +1,15 @@ #ifndef STICK20_COMMANDS_H #define STICK20_COMMANDS_H + + #include #include "command.h" #include #include #include "device_proto.h" +#pragma pack (push,1) namespace nitrokey { namespace proto { @@ -332,10 +335,12 @@ namespace nitrokey { typedef Transaction CommandTransaction; }; + } } } #undef print_to_ss +#pragma pack (pop) #endif -- cgit v1.2.1 From e8f6df836522250b9a9d4052722fb9780683058b Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 18 Feb 2017 17:05:02 +0100 Subject: Use proper command code for disabling hidden volume Signed-off-by: Szczepan Zalega --- include/stick20_commands.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/stick20_commands.h') diff --git a/include/stick20_commands.h b/include/stick20_commands.h index e3bea3f..d88919b 100644 --- a/include/stick20_commands.h +++ b/include/stick20_commands.h @@ -33,7 +33,7 @@ namespace nitrokey { //FIXME the volume disabling commands do not need password class DisableEncryptedPartition : public PasswordCommand {}; - class DisableHiddenEncryptedPartition : public PasswordCommand {}; + class DisableHiddenEncryptedPartition : public PasswordCommand {}; class EnableFirmwareUpdate : public PasswordCommand {}; -- cgit v1.2.1