summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Update README after test refactoringRobin Krahl2019-01-05
|
* Prefer assert_eq over is_ok() checksDaniel Mueller2019-01-05
| | | | | | | | | | We experienced various problems running the tests and while they may or may not be caused by local setup issues, it is helpful to have more information than just an indication that an assertion (true/false) was violated. To that end, this change adjusts some of the assert!(<func>().is_ok()) to compare against Ok(()) instead. This way, if the result is not the Ok variant, the error code will get printed.
* Adjust PWS tests to use nitrokey-test crateDaniel Mueller2019-01-05
| | | | This change adjusts the PWS tests to use the nitrokey-test crate.
* Adjust OTP tests to use nitrokey-testDaniel Mueller2019-01-05
| | | | This change adjusts the OTP tests to use the nitrokey-test crate.
* Use nitrokey-test for nitrokey device testsDaniel Mueller2019-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is the first in a series to migrate the existing tests to using the nitrokey-test crate. The crate provides a couple of benefits over the existing way testing works: - test execution is automatically serialized (i.e., no more need for --test-threads) - available devices are detected at runtime (i.e., no more need for --features test-pro) - tests capable of running only on a specific device are automatically skipped if this device is not present In addition to that, the crate also offers selection of particular groups of tests by virtue of the NITROKEY_TEST_GROUP environment variable. If set (valid values are "nodev", "pro", and "storage") only tests of the particular group are run (those tests will fail if a required precondition is not met, i.e., if a device is present but "nodev" is set, or if the "pro" group is run but no device or a storage device is present). Unfortunately, it has some limitations as well. Most importantly Rust does not allow us to indicate whether a test has been skipped or not. While it has #[ignore] support, that strictly is a compile-time feature and, hence, not usable. This patch in particular pulls in the nitrokey-test crate and adjusts the existing device tests to make use of it.
* Release v0.3.0v0.3.0Robin Krahl2019-01-04
|
* Update documentation and test for factory_resetRobin Krahl2019-01-04
| | | | | | Contrary to my previous beliefs, build_aes_key has to be called even after a factory reset using the Nitrokey API. This patch updates the documentation and the unit tests based on this insight.
* Fix documentation test for Storage::change_update_pinRobin Krahl2019-01-04
|
* Add Storage::enable_firmware_update methodRobin Krahl2019-01-03
| | | | | | | | This patch adds the enable_firmware_update method to the Storage struct that uses NK_enable_firmware_update to put the Nitrokey Storage into update mode. This method is not tested as external tooling is required to resume normal operation and as it is hard to bail out if an error occurs.
* Add Device::build_aes_key methodRobin Krahl2019-01-03
| | | | | | | | This patch adds the build_aes_key method to the Device trait that uses the NK_build_aes_key function to build new AES keys on the device. This effectively resets the password safe and the encrypted storage. It is unclear whether other data (e. g. the one-time passwords) are affected too.
* Add Device::factory_reset methodRobin Krahl2019-01-03
| | | | | | | This patch adds the factory_reset_method to the Device trait that uses the NK_factory_reset function to perform a factory reset. The tests verify that the user and admin PIN are reset and that the OTP storage and the password safe are deleted.
* Add Storage::change_update_pin methodRobin Krahl2019-01-03
| | | | | | This patch adds the change_update_pin method to the Storage struct that uses the NK_change_update_password function to set the password required for firmware updates.
* Document decryption failure for get_password_safeRobin Krahl2019-01-03
| | | | | | After a factory reset, the password safe cannot be accessed as its secret cannot be decrypted. This patch improves the documentation for GetPasswordSafe::get_password_safe to reflect this behavior.
* Update changelogRobin Krahl2019-01-03
|
* Update documentation for pws methodsRobin Krahl2019-01-03
|
* Preserve unknown error code valuesDaniel Mueller2019-01-03
| | | | | | | | | | The CommandError::Unknown variant, which is used whenever a reported error code is not known, makes it close to impossible to determine the root cause of, say, a one-off error, because all information explaining what went wrong is discarded. With this change we adjust the Unknown variant to include the error report. In addition, we introduce a new CommandError variant, Undefined, that is used when no error code is available.
* Fix typo: occured -> occurredDaniel Mueller2019-01-03
|
* Extend unlock_user_pin testsRobin Krahl2019-01-03
| | | | | | This patch adds a test case that changes the PIN when calling unlock_user_pin. The previous test case only unlocked the current user PIN.
* Remove CommandError::RngErrorRobin Krahl2019-01-03
| | | | | We switched to rand::thread_rng() which cannot fail. Therefore the CommandError::RngError is no longer needed and removed in this patch.
* Add force argument to ConfigureOtp::set_timeRobin Krahl2019-01-02
| | | | | | | | This patch adds the force argument to the set_time method in the ConfigureOtp trait that allows the user to choose whether jumps to the past are allowed when updating the time. It is implemented by using the NK_totp_set_time_soft function. Previously, jumps where unconditionally allowed.
* Relax nitrokey-sys dependency to 3.4Robin Krahl2019-01-01
|
* Release v0.2.3v0.2.3Robin Krahl2018-12-31
|
* Release v0.2.2v0.2.2Robin Krahl2018-12-30
|
* Remove the Cargo.toml extract from READMERobin Krahl2018-12-30
| | | | | The Cargo.toml extract in the README does not provide any real value, but it adds maintenance effort. Therefore it is removed in this patch.
* Fix Storage volume detection for test casesRobin Krahl2018-12-30
| | | | | | It seems that with newer firmeware, the model string in the lsblk output is Nitrokey_Storage instead of Nitrokey Storage. Therefore this patch replaces underscores with spaces to account for both versions.
* Fix get_model implementation for StorageRobin Krahl2018-12-30
|
* Derive Clone and Copy for CommandError, LogLevel, OtpModeRobin Krahl2018-12-30
| | | | | | As these three enums are scalar values, this patch derives the Clone and Copy traits for them. This should avoid unnecessary allocations and reduce the memory footprint.
* Fix formatting using to rustfmtRobin Krahl2018-12-30
|
* Add function Device::get_modelRobin Krahl2018-12-30
| | | | | This patch adds the function Device::get_model that returns the model of the connected Nitrokey stick.
* Update the changelogRobin Krahl2018-12-16
|
* Update to rand v0.6Robin Krahl2018-12-16
| | | | | | | | This patch updates the rand dependecy to version 0.6. It also replaces the OsRng, which is guaranteed to use OS/hardware entropy, with the thread_rng, which is likely to use OS/hardware entropy as a seed. The choice of RNG and the handling of password should be reviewed at a later point.
* Remove test-no-device featureRobin Krahl2018-12-16
| | | | | | | Currently, the test-no-device feature is used for tests that expect no Nitrokey to be connected. Yet test-no-device is equivalent to not test-pro and not test-storage. Therefore, this patch removes the test-no-device feature.
* Fix examples for {Pro, Storage}::connect()Robin Krahl2018-12-16
|
* Refactor tests into the top-level tests directoryRobin Krahl2018-12-16
| | | | | | Newer Rust versions support integration tests in a top-level tests directory. This patch refactors the existing unit tests into integration tests.
* Remove redundant extern crate declarationsRobin Krahl2018-12-16
| | | | | | | With Rust edition 2018, it is no longer necessary to declare dependencies in the code using `extern crate`. Therefore, this patch removes these declarations and replaces them with `use` declarations if necessary.
* Update to Rust edition 2018Robin Krahl2018-12-16
|
* Use the crate:: path qualifier for modulesRobin Krahl2018-12-16
| | | | | | This patch changes use declarations for modules within this crate to use the crate:: path qualifier. This will be mandatory in Rust edition 2018.
* Use the dyn syntax for trait objectsRobin Krahl2018-12-16
| | | | | This patch changes the type of trait objects from `Trait` to `dyn Trait`. This fixes bare-trait-object compiler warnings.
* Make hidden life time parameters explicitRobin Krahl2018-12-16
| | | | | This patch makes hidden life time parameters explicit to fix elided-lifetime-in-path compiler warnings.
* Add documentation for {Pro, Storage}::connect()Robin Krahl2018-12-16
|
* Enable additional compiler warningsRobin Krahl2018-12-16
| | | | | | | | This patch enables the following compiler warnings: - missing_docs for public symbols without documentation - rust_2018_compatibility for Rust edition 2018 support - rust_2018_idioms for Rust edition 2018 support - unused for different types of unused code
* Fix formatting according to Rust style guideRobin Krahl2018-12-16
|
* Release v0.2.1v0.2.1Robin Krahl2018-12-10
|
* Re-export device::{StorageStatus, VolumeStatus} in lib.rsRobin Krahl2018-12-10
|
* Update READMERobin Krahl2018-12-10
|
* Release v0.2.0v0.2.0Robin Krahl2018-12-10
|
* Provide access to the status of a Nitrokey StorageRobin Krahl2018-12-10
| | | | | | This patch adds a `get_status` method to the `Storage` structure. The returned structure `StorageStatus` is based on the structure provided by libnitrokey.
* Add a Storage-only example to the DeviceWrapper documentationRobin Krahl2018-12-10
| | | | | | | As connect() now returns DeviceWrappers of the correct type, this patch adds an example to the DeviceWrapper documentation that shows how to use type conditions, i. e. how to execute a command only for Nitrokey Storage devices.
* Fix generic connections (connect()) to return correct deviceRobin Krahl2018-12-10
| | | | | | This patch fixes the generic connect() method to return a DeviceWrapper of the correct type. This is enabled by the NK_get_device_model() method introduced in libnitrokey v3.4.
* Always free string pointers returned by libnitrokeyRobin Krahl2018-12-10
| | | | | | | | Old libnitrokey versions could return pointers to both statically and dynamically allocated strings for functions that return strings. This has been fixed in libnitrokey commit 7a8550d (included in v3.4). This patch removes the old workaround and always frees the return value of functions returning a string pointer.