diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2019-07-16 08:58:37 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2019-07-16 11:00:20 +0200 |
commit | 6c138eaa850c745b97b7e48a201db0cbaad8e1e0 (patch) | |
tree | e3d202e09ec6c99054e7103578a961b949773709 | |
parent | f150d59410eefdec2ae69b2422906a3d1d88aa07 (diff) | |
download | nitrokey-rs-6c138eaa850c745b97b7e48a201db0cbaad8e1e0.tar.gz nitrokey-rs-6c138eaa850c745b97b7e48a201db0cbaad8e1e0.tar.bz2 |
Update rand_{core,os} dependencies
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.
-rw-r--r-- | CHANGELOG.md | 9 | ||||
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | src/util.rs | 3 |
3 files changed, 11 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3051d0f..41e46a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,9 +38,12 @@ 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. -- Update the `nitrokey-test` dependency to version 0.3 and add the - `nitrokey-test-state` dependency in version 0.1.0. +- Update dependencies: + - `nitrokey-sys` to 3.5 + - `nitrokey-test` to 0.3 + - `rand_core` to 0.5 + - `rand_os` to 0.2 +- Add `nitrokey-test-state` dependency in version 0.1. - Refactor connection management: - Add `ConcurrentAccessError` and `PoisonError` `Error` variants. - Add the `Manager` struct that manages connections to Nitrokey devices. @@ -17,12 +17,12 @@ license = "MIT" exclude = [".builds/*"] [dependencies] -lazy_static = "1.2.0" +lazy_static = "1.2" libc = "0.2" nitrokey-sys = "3.5" -rand_core = {version = "0.3", default-features = false, features = ["std"] } -rand_os = {version = "0.1"} +rand_core = {version = "0.5", default-features = false, features = ["std"] } +rand_os = {version = "0.2"} [dev-dependencies] nitrokey-test = "0.3" -nitrokey-test-state = "0.1.0" +nitrokey-test-state = "0.1" diff --git a/src/util.rs b/src/util.rs index fdb73c3..a5dd1e5 100644 --- a/src/util.rs +++ b/src/util.rs @@ -77,9 +77,8 @@ pub fn get_last_error() -> Error { } pub fn generate_password(length: usize) -> Result<Vec<u8>, Error> { - let mut rng = OsRng::new().map_err(|err| Error::RandError(Box::new(err)))?; let mut data = vec![0u8; length]; - rng.fill_bytes(&mut data[..]); + OsRng.fill_bytes(&mut data[..]); Ok(data) } |