| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
| |
This version contains these major changes:
- Refactoring of the error handling.
- Using mutability to represent changes to the device status.
- Updating the nitrokey-sys/libnitrokey dependency to version 3.5.
- Refactoring the connection management and introducing the Manager
struct.
|
|
|
|
|
| |
rand_os::OsRng has been deprecated. Instead we can use rand_core with
the getrandom feature.
|
| |
|
|
|
|
|
|
|
| |
This patch updates the rand_core dependency to version 0.5 and the
rand_os dependency to version 0.2. This causes a change in util.rs:
Instead of constructing an OsRng instance using OsRng::new(), we can
directly instantiate the (now empty) struct.
|
| |
|
|
|
|
|
|
| |
Previously, we were using a development version of nitrokey-test that
was compatible with nitrokey 0.4. This patch updates nitrokey-test to
version 0.3, which includes the required changes.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This patch updates the nitrokey-test dependency to a new development
version that uses force_take instead of take to get a Manager instance.
If a test fails, the thread panics, leading to a poisoned cache – yet
this should not affect the other test cases. Therefore we want to
ignore the poisoned caches.
|
| |
| |
| |
| |
| | |
To test the changes to connection handling, we temporarily use the
development version of nitrokey-test.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As part of the connection refactoring, we introduce the Manager struct
that deals with connection management. To make sure there can be only
once instance of the manager, we add a global static Mutex that holds
the single Manager instance. We use the struct to ensure that the user
can only connect to one device at a time.
This also changes the Error::PoisonError variant to store the
sync::PoisonError. This allows the user to call into_inner on the
PoisonError to retrieve the MutexGuard and to ignore the error (for
example useful during testing).
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new 0.2.1 version of nitrokey-test requires an additional crate,
nitrokey-test-state. This patch updates the nitrokey-test version and
adds the nitrokey-test-state dependency in version 0.1.0. See this
thread [0] for more information.
[0] https://lists.sr.ht/~ireas/nitrokey-rs-dev/%3Ce3e908e5-3f66-7072-9603-8a4de5ac614b%40posteo.net%3E
|
|/
|
|
|
|
|
|
|
| |
As the return type of the NK_get_{major,minor}_firmware_version methods
changed with libnitrokey 3.5, we also have to adapt our
get_firmware_version function in device.rs.
This patch also updates the changelog and the todo list with the changes
caused by the new libnitrokey version.
|
|
|
|
|
|
|
|
|
|
| |
Firstly, the libnitrokey API contains breaking changes between minor
versions. Therefore we have to fix the nitrokey-sys version using a
tilde requirement ("~3.4" means ">= 3.4.0, < 3.5.0").
Secondly, nitrokey-test’s 0.2.1 release requires some changes that are
not yet implemented in this crate, so we have to pin its version to
0.2.0.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
This patch adds license and copyright information to all files to make
nitrokey-rs compliant with the REUSE practices [0].
[0] https://reuse.software/practices/2.0/
|
|
|
|
|
|
| |
With the std feature enabled, rand_core::Error implements
std::error::Error, which we require for the error types wrapped in the
Error enum.
|
|
|
|
|
|
|
|
|
| |
These macros allow easier comparisions using the new error type. This
patch fixes all tests and updates nitrokey-test to 0.2.0 so that it
integrates with the new error structure.
Some tests may still fail until CommunicationError::NotConnected is
actually returned.
|
|\ |
|
| | |
|
|/
|
|
|
|
|
| |
Since commit 65bff57e6139cc126191d4faabbcf74118932dd2, we use the
nitrokey-test crate to select test cases. Previously, we used the
features test-pro and test-storage to select test suites. These
features are now obsolete.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The rand crate comes with a slew of dependencies to cover all sort of
randomness related tasks in various scenarios. However, this crate
really only requires a tiny subset of this functionality. As it turns
out, this core functionality is provided by the rand_os crate.
This change drops the dependency to rand in favor of rand_os. In order
to accomplish that, it brings back the RngError variant for the
CommandError enum to capture the possibility of the creation of the
random number generator failing.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This patch adds the Storage struct and the test-storage feature. It
also enables all currently supported Pro commands for the Storage.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Now libnitrokey v3.3 is compiled from source, fixing the problems with
older libnitrokey versions (freeing strings, firmware version getter).
Also, bindgen is no longer a build dependency. This makes the build
process a lot faster.
|
|
|
|
|
| |
The nitrokey-sys crate now has its own Git repository at
https://git.ireas.org/nitrokey-sys-rs/ to make maintenance easier.
|
|
|
|
| |
Add the readme to Cargo.toml so that it is displayed on crates.io.
|
| |
|
|
|