aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-07-05 22:59:27 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-07-05 23:03:37 +0000
commite923c8b1ddaeafc9494ae86738bed9ad0e0e6e8f (patch)
treefa1e771be72a5b6954b546e85e74d9859deb144f
parent381666ed17e0d85293f52493f852480bee70783b (diff)
downloadnitrokey-rs-e923c8b1ddaeafc9494ae86738bed9ad0e0e6e8f.tar.gz
nitrokey-rs-e923c8b1ddaeafc9494ae86738bed9ad0e0e6e8f.tar.bz2
Update nitrokey-sys to version 3.5
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--Cargo.toml2
-rw-r--r--TODO.md12
-rw-r--r--src/device.rs8
4 files changed, 16 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e98e857..e471f9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ SPDX-License-Identifier: MIT
- Implement `DerefMut` for `User<T>` and `Admin<T>`.
- Add `device_mut` method to `DeviceWrapper`.
- Require a mutable `Device` reference if a method changes the device state.
+- Update the `nitrokey-sys` dependency to version 3.5.0.
# v0.3.4 (2019-01-20)
- Fix authentication methods that assumed that `char` is signed.
diff --git a/Cargo.toml b/Cargo.toml
index 355f001..83cfa9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ exclude = [".builds/*"]
[dependencies]
libc = "0.2"
-nitrokey-sys = "~3.4"
+nitrokey-sys = "3.5"
rand_core = {version = "0.3", default-features = false, features = ["std"] }
rand_os = {version = "0.1"}
diff --git a/TODO.md b/TODO.md
index 1ff723d..d7c8874 100644
--- a/TODO.md
+++ b/TODO.md
@@ -10,6 +10,18 @@ SPDX-License-Identifier: MIT
- `NK_get_progress_bar_value`
- `NK_list_devices_by_cpuID`
- `NK_connect_with_ID`
+- Evaluate the changes in libnitrokey 3.5:
+ - `NK_get_SD_usage_data`
+ - `NK_get_status`
+ - `NK_get_status_as_string`
+ - `NK_list_devices`
+ - `NK_free_device_info`
+ - `NK_connect_with_path`
+ - `NK_enable_firmware_update_pro`
+ - `NK_change_firmware_password_pro`
+ - `NK_read_HOTP_slot`
+ - `NK_status` (deprecated)
+ - `NK_get_progress_bar_value` (return value)
- Clear passwords from memory.
- Lock password safe in `PasswordSafe::drop()` (see [nitrokey-storage-firmware
issue 65][]).
diff --git a/src/device.rs b/src/device.rs
index f6492cd..6597ba9 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -399,13 +399,9 @@ pub trait Device: Authenticate + GetPasswordSafe + GenerateOtp + fmt::Debug {
fn get_firmware_version(&self) -> Result<FirmwareVersion, Error> {
let major = result_or_error(unsafe { nitrokey_sys::NK_get_major_firmware_version() })?;
let minor = result_or_error(unsafe { nitrokey_sys::NK_get_minor_firmware_version() })?;
- let max = i32::from(u8::max_value());
- if major < 0 || minor < 0 || major > max || minor > max {
- return Err(Error::UnexpectedError);
- }
Ok(FirmwareVersion {
- major: major as u8,
- minor: minor as u8,
+ major,
+ minor,
})
}