| Commit message (Collapse) | Author | Age |
... | |
| | | |
| | | |
| | | |
| | | | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The C++ API currently provides the Storage status in
NitrokeyManager::get_status_storage(). The C API only provides a string
version of this data (NK_get_status_storage_as_string). This patch adds
a struct to the C API that can store the storage status and a function
that can retrieve it.
The interpretation of the fields of the internal struct is based on the
following code in the Nitrokey Storage firmware:
- src/HighLevelFunctions/FlashStorage.h, lines 73 to 90 (struct
definition with comments)
- src/OTP/report_protocol.c, lines 241 to 376 (debug output of the
data)
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The result retrieval functions get_with_array_result,
get_with_string_result, get_with_result and get_without_result currently
contain much duplicated code: the error handling. This patch tries to
simplify this code by introducing a new function, get_with_status, that
executes a function, catches errors and returns the error code together
with the result of the function or a fallback value passed by the user
if the function failed.
get_with_array_result, get_with_string_result and get_with_result are
adapted to use this function. get_without_result is not changed as it
has a different error handling logic than the other functions: It
ignores any InvalidCRCReceived exceptions.
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
Add tests for authorization issue
https://github.com/Nitrokey/nitrokey-pro-firmware/issues/45
|
| | |
| | |
| | |
| | | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|/ /
| |
| |
| | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\ \
| | |
| | |
| | |
| | |
| | | |
Mark unused parameters in TOTP code getter in the C API.
Closes #113
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
According to the GetTOTP class in stick10_commands_0.8.h and after
firmware inspection, the challenge, last_totp_time and last_interval
arguments for the get_TOTP_code method are unused. This patch adds this
information to the doc comment for NK_get_totp_code and
NK_get_totp_code_PIN.
|
|\ \
| |/
|/|
| |
| |
| | |
Fix broken include
Closes #112
|
|/ |
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Make sure all C API strings are deallocable.
Tested with Python's 3.6.5 'pytest -sv test_{pro,storage}.py' on Storage v0.50,
Ubuntu 18.04
Closes #110
|
| |
| |
| |
| | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| |
| |
| |
| | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
| |
Issue #110
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| |
| |
| | |
Update documentation of C API regarding OTP secret length and type.
Closes #106
|
| |
| |
| |
| |
| |
| |
| | |
These were to meant, that the sizes were confirmed for Pro and not for Storage, during library development. Storage has maintained the compatibility, hence there is no need for the mentioned marks.
Issue #106
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
| |
| |
| |
| |
| |
| | |
Same for C-string requirements for fields and sizes
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|/
|
|
|
|
|
| |
While the actual secret is 20 bytes, the functions accept a hex string.
That means that every byte of the secret is represented by two bytes
(characters) in the hex string. So the argument secret for the
functions NK_write_{hotp,totp}_slot is char[40], not char[20].
|
|\ |
|
|/
|
|
|
|
|
| |
Cleanup CMakeList a bit as well.
Fixes #97
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
| |
from another CMake project
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| | |
Closes #108
|
|/
|
|
|
| |
Contrary to C++, C requires the type `enum NK_device_model` instead of
only `NK_device_model` when refering to the enum with that name.
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| | |
Update version to v3.3
|
|/
|
|
| |
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>
|
| |
| |
| |
| | |
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 #105
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As with the C++ API, identifying the model by the first character of a
string is not intuitive. This patch adds the NK_login_enum function to
the C API that accepts an enum value instead of a string. It also adds
a new enum NK_device_model as device::DeviceModel is an enum class and
therefore cannot be used in C.
|
|/ /
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | |
| | | |
Fixes #103
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
The readme suggested to use the option `-DCOMPILE_TESTS` for CMake in
order to compile unit tests. Yet CMake expectes option values of the
form `<var>:<type>=<value>` or `<var>=<value>` (see cmake(1)).
Therefore, this patch replaces `-DCOMPILE_TESTS` with
`-DCOMPILE_TESTS=ON`, matching the general build instructions in the
CMake section.
|
|\ \
| |/
|/|
| | |
Fixes #104
|
|/
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| |
| | |
Fixup for QMake
Issue #101
|
| |
| |
| |
| |
| |
| | |
Fixup to #101
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\|
| |
| |
| |
| |
| | |
Fixed header path. Allow to override UDEV rules.
Closes #101
|
| | |
|
|/ |
|
|\ |
|
|/
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|\
| |
| |
| |
| | |
Update C API with new command, determining the PIN type for unencrypted
volume RO/RW state change.
|