aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Merge branch 'pr_117'Szczepan Zalega2018-06-19
|\ | | | | | | | | | | | | | | Library version getter for C API Fixes #117 Fixes #35 Fixes #62
| * Add offline test for version getterSzczepan Zalega2018-06-19
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Move implementation from header back to compilation unitSzczepan Zalega2018-06-19
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Add getters for the library versionRobin Krahl2018-05-25
| | | | | | | | | | | | | | 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.
* | Merge branch 'pr_118'Szczepan Zalega2018-06-19
|\ \ | |/ |/| | | | | | | C API: Storage status getter Closes #118
| * Add missing struct keywordSzczepan Zalega2018-06-19
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Add getter for Storage status to C APIRobin Krahl2018-05-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * Refactor result retrieval in C APIRobin Krahl2018-05-25
|/ | | | | | | | | | | | | | | 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.
* Merge branch 'tests_update_Pro_v0.9'Szczepan Zalega2018-05-24
|\ | | | | | | | | Add tests for authorization issue https://github.com/Nitrokey/nitrokey-pro-firmware/issues/45
| * Skip test for devices with firmware lower than v0.9Szczepan Zalega2018-05-24
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Add authorization testsSzczepan Zalega2018-05-21
|/ | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'pr_113'Szczepan Zalega2018-05-19
|\ | | | | | | | | | | Mark unused parameters in TOTP code getter in the C API. Closes #113
| * Mark NK_get_totp_code arguments as unusedRobin Krahl2018-05-19
|/ | | | | | | | 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.
* Merge branch 'pr_112'Szczepan Zalega2018-05-19
|\ | | | | | | | | | | Fix broken include Closes #112
| * Fix include path for NK_C_API.h in test_strdup.cppRobin Krahl2018-05-19
|/
* Merge branch '110-mixed_strings'Szczepan Zalega2018-04-19
|\ | | | | | | | | | | | | | | | | 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
| * Correct NK_status() reply lengthSzczepan Zalega2018-04-19
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Implement suggested testsSzczepan Zalega2018-04-19
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Change const char* to char* for functions returning duplicated strings.Szczepan Zalega2018-04-19
| | | | | | | | | | | | | | 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>
| * Return allocated string instead of pointer to a string literalSzczepan Zalega2018-04-19
|/ | | | | | Issue #110 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'pr_106'Szczepan Zalega2018-04-19
|\ | | | | | | | | | | Update documentation of C API regarding OTP secret length and type. Closes #106
| * Remove (Pro) marks from C API docsSzczepan Zalega2018-04-19
| | | | | | | | | | | | | | 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>
| * C API docs - mention 320-bits secret for Pro v0.8Szczepan Zalega2018-04-19
| | | | | | | | | | | | Same for C-string requirements for fields and sizes Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Correct documentation for NK_write_{hotp,totp}_slotRobin Krahl2018-04-19
|/ | | | | | | 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].
* Merge branch '97-compilation_warnings'Szczepan Zalega2018-04-19
|\
| * Fix compilation warnings for testsSzczepan Zalega2018-04-19
|/ | | | | | | Cleanup CMakeList a bit as well. Fixes #97 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Install: use correct source dir for Udev rules installation when included ↵Szczepan Zalega2018-04-11
| | | | | | from another CMake project Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Do not output DEBUG messages by defaultv3.3Szczepan Zalega2018-04-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'pr_108'Szczepan Zalega2018-04-10
|\ | | | | | | Closes #108
| * Add missing `enum` specifier in the C APIRobin Krahl2018-04-10
|/ | | | | 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.
* Tests: skip reading custom-type based function headerSzczepan Zalega2018-04-10
| | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch '98-release_3.3'Szczepan Zalega2018-04-10
|\ | | | | | | Update version to v3.3
| * Update version to 3.3Szczepan Zalega2018-04-10
|/ | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch 'delay_RORW_pin_type_change'Szczepan Zalega2018-04-10
|\
| * Delay RO/RW PIN type change to start from v0.52 (instead of v0.51)Szczepan Zalega2018-04-10
|/ | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* Merge branch '102-get_status_invalid'Szczepan Zalega2018-04-10
|\ | | | | | | Fixes #102
| * Name magic numbers in validation functionsSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Correct validation functions for GetStatus and WriteGeneralConfig structsSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Correct C API documentationSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| * Precise value for p.enable_user_password field to 1 on true, as in firmwareSzczepan Zalega2018-04-10
| | | | | | | | Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Merge branch 'pr_105'Szczepan Zalega2018-04-10
|\ \ | | | | | | | | | Fixes #105
| * | Add NK_login_enum to the C APIRobin Krahl2018-04-10
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Add a NitrokeyManager::connect overload for enumRobin Krahl2018-04-10
|/ / | | | | | | | | | | | | 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.
* | Merge branch 'pr_103'Szczepan Zalega2018-04-10
|\ \ | | | | | | | | | Fixes #103
| * | Fix suggested CMake options in readmeRobin Krahl2018-04-10
|/ / | | | | | | | | | | | | | | | | 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.
* | Merge branch 'pr_104'Szczepan Zalega2018-04-10
|\ \ | |/ |/| | | Fixes #104
| * Null-terminate the argument for strtoulRobin Krahl2018-04-10
|/ | | | | | 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.
* Merge branch 'pr_101'Szczepan Zalega2018-03-13
|\ | | | | | | | | | | Fixup for QMake Issue #101
| * Update include paths for QMake as wellSzczepan Zalega2018-03-13
| | | | | | | | | | | | Fixup to #101 Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
* | Merge branch 'pr_101'Szczepan Zalega2018-03-13
|\| | | | | | | | | | | Fixed header path. Allow to override UDEV rules. Closes #101