| Commit message (Collapse) | Author | Age |
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
| |
The firmware version parts returned by the Nitrokey devices are uint8_t
values. This is part of the public API as part of the NK_storage_status
struct. For consistency with this API, this patch changes the functions
NK_get_major_firmware_version and NK_get_minor_firmware_version to
return uint8_t instead of int.
|
|
|
|
|
|
|
|
|
|
| |
Previously, Stick20 was hardcoded in connect_with_path. Now we first
use hid_enumerate to find out the model on that path, then we connect to
that model.
We also could have added the model as a parameter to connect_with_path.
Yet we cannot directly check the model after connecting, so this would
be error-prone.
|
|
|
|
|
|
|
|
|
|
|
| |
Device::enumerate does not need any instance data, therefore it is made
static. Note that this not only changes the public API by making the
method static. We also return all connected Nitrokey devices instead of
only Storage devices.
The NitrokeyManager method list_devices_by_cpuID is changed to check the
device type so that they still only return Storage devices. The
list_device method now returns both Storage and Pro devices.
|
|
|
|
|
|
| |
In the previous commit, we changed the return value of Device::enumerate
to std::vector<DeviceInfo>. Now we change Nitrokey::list_devices to
also return DeviceInfo instances.
|
|
|
|
|
|
| |
The return type of Device::enumerate is changed from
std::vector<std::string> to std::vector<DeviceInfo> to expose the
additional information contained in the DeviceInfo struct.
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| |
| |
| | |
Fix connect() return value in offline mode
Fixes #115
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
NitrokeyManager::connect() currently returns true if the device pointer
is set. Yet this does not mean that the connection was successful. For
example, NitrokeyManger::connect(const char*) sets the device pointer
even if it was not successful.
This patch introduces a variable that keeps track of the connection
instead of checking the device pointer. This corrects the return value
without changing the behavior of the connect method (returning the
Storage device if both a Pro and a Storage device are present).
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The SetTime command supports two modes: set the time without checking
the currently set time, or verify that the currently set time is not
zero and not larger than the new time (see cmd_set_time(uint8_t*,
uint8_t*) in src/keyboard/report_protocol.c, lines 678--710, in the
Nitrokey Pro firmware).
NitrokeyManager called these two modes set_time(uint64_t) and
get_time(uint64_t), which is highly misleading -- the command does never
get the time. Furthermore, the get_time method per default calls the
command with the time zero, which will always result in an error.
The C API has the methods NK_totp_set_time(uint64_t) and
NK_totp_get_time(). NK_totp_get_time() calls get_time(uint64_t) with
the time zero, leading to an error, and is therefore useless.
This patch proposes a new wording. While it would make sense to call
the first mode “reset” and the second mode “set”, this would break
compatibility. Therefore, new methods set_time_soft(uint64_t) and
NK_totp_set_time_soft(uint64_t) are introduced to represent the
difference between a hard and a soft setting of the time.
The old methods, get_time(uint64_t) and NK_totp_get_time(), are not
removed but marked as deprecated. They should be removed in an upcoming
major release.
|
|
|
|
|
|
|
| |
All functions returning duplicated C-strings, which needs to be deallocated on caller side, are typed char* instead of const char*
Issue #110
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| | |
Fixes #102
|
| |
| |
| |
| | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|/
|
|
|
|
|
| |
Identifying the model to connect to by the first character of a string
is not intuitive. This patch adds an overload for the connect function
that accepts a device::DeviceModel enum value, providing a cleaner
interface.
|
| |
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
| |
Allow logger to set global prefix
Used to indicate current device
Store USB path when used to connection as well
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
Disconnection allows rediscovering devices.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
| |
Add C API and tests
Add mutexes
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
|
|
| |
Unencrypted volume ro/rw: rename user_admin_pin -> admin_pin to be consistent with latest API. Update description.
Document PIN requirements in C++ API
Extract pin type function
Add C API for separate unencrypted volume read write handling
Use correct commands to set ro/rw mode of unencrypted volume
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
model and version
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
| |
For 0.49 run new command, which needs Admin PIN
For 0.48 and lower run old command
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
|
| |
Add get_minor_firmware_version
Correct get_major_firmware version (was returning minor instead)
Name 3rd version field for test builds
Use minor firmware version in tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
Remove redundant file
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| |
| |
| | |
Improve test organization
Disable CRC check
Improve log
|
| |
| |
| |
| |
| |
| | |
To cover Storage's status string getter
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|/
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\ |
|
| | |
|
| | |
|
|/
|
|
|
|
| |
Move mutex from template instantation to single compilation unit to make it work as desired
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
| |
Remove doubled implementation
Remove clutter from DEBUG log level
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
| |
Inverse log levels order.
Allow to change logging level with int.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
Keep build directory (removed in earlier commit)
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|