| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
As we cannot test this function properly in Python (due to missing
struct definitions), we test it in the C++ test suite.
|
|
|
|
|
| |
As we cannot read the output of NK_list_devices in the Python tests at
the moment, this test case uses NK_list_devices_by_cpuID instead.
|
|
|
|
|
|
|
| |
Unfortunately, I cannot test more as the current ffi implementation does
not allow me to import struct definitions. Without the definition for
the NK_device_info struct, I cannot inspect the result of the
NK_list_devices function.
|
|
|
|
|
|
|
| |
For easier handling, we should use a std::string instead of
std::wstring for the serial number in DeviceInfo. For the conversion, I
assume that the serial number is valid UTF-8. As it should be
alphanumeric and ASCII only, this should be true.
|
|
|
|
|
|
| |
The current test case is renamed to “Use Storage API” as it queries the
storage status. The new test case, “Use API”, lists all connected
devices and prints their model, path and serial number.
|
|
|
|
|
|
| |
The current test case is renamed to “List Storage devices” as it also
displays the SD card ID. The new test case, “List devices”, lists all
connected devices and prints their model, path and serial number.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Related to #133
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
| |
Handle UNKNOWN_ERROR code (introduced in Storage v0.51, firmware commit
687d4aca31ce405db41231be73864ee2f91b3714) and is returned,
when device fails to retrieve the AES key.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| |
| |
| | |
Allow to connect to device with model specified by enum.
Fixes #116
|
| |
| |
| |
| |
| |
| |
| | |
Using return value instead of memory manipulation seem to be cleaner solution and less error prone
due to avoiding pointer usage.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The C++ API already provides access to the model of the connected device
in NitrokeyManager::get_connected_device_model(). This patch also
exposes this information in the C API by adding NK_get_device_model. As
there might be no device connected, the function returns a boolean
indicating the connection status and writes the model of the connected
device to a pointer passed as an argument.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
All current tests are written in C++. Therefore C++-only code in the C
API might not be detected by the tests. This patch adds a minimal test
written in C that only includes the C API header. This should make sure
that the C API code is valid.
The new test is called `test_minimal.c` and is added to the CMake
COMPILE_OFFLINE_TESTS option.
|
|\ \
| | |
| | |
| | |
| | |
| | | |
Fix version getter test
Closes #123
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`git describe` may return a tag name or <tag>-<n>-g<hash>, where <n> is
the number of commits since the last tag <tag> and <hash> is the hash of
the current commit. The current test case only considers the latter
case. This patch adds a regular expression to handle both cases.
|
|\ \ \
| |/ /
|/| |
| | |
| | |
| | | |
Fix connect() return value in offline mode
Fixes #115
|
| | |
| | |
| | |
| | | |
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>
|
|/ |
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
| |
Cleanup CMakeList a bit as well.
Fixes #97
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
As discussed in issue #95, the buffer passed to strtoul must be
null-terminated. This patch null-terminates the buffer used in
hexStringToByte in the test_HOTP unit test to avoid a buffer over-read.
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
Done for Pro devices
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
Add it to CMake
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>
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
model and version
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Makes occasional fails
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|