| Commit message (Collapse) | Author | Age |
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| |
| |
| |
| | |
Library version getter for C API
Fixes #117
Fixes #35
Fixes #62
|
| |
| |
| |
| |
| |
| |
| | |
CMake generates version.h from version.h.in and sets the major and minor
version as specified in CMakeLists.txt and the current git version as
returned by `git describe --always`. These values are also added to the
C API as NK_get{_major,_minor,}_library_version.
|
| |
| |
| |
| | |
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)
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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].
|
|
|
|
|
| |
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.
|
|\
| |
| |
| | |
Fixes #102
|
| |
| |
| |
| | |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|/
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
NK_C_API.h uses the type bool although it is not defined in standard C.
Since C99, the header stdbool.h provides this type, so this patch
includes it in NK_C_API.h to make it valid C code. (Note that the API
already required C99 for the "//"-style comments.)
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
| |
Guard extern to only C++
|
|
|
|
| |
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
|
|
|
|
|
|
|
|
|
| |
Adjust Python tests for new OTP codes return value
Also remove manual 0-filling
Fixes #57
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>
|
|
|
|
|
|
| |
Use uint8_t instead of int where appropriate
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>
|
|
|
|
| |
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>
|