diff --git a/Cargo.lock b/Cargo.lock index 1309baa503..6c1b4cd749 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -392,11 +392,11 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.5" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" dependencies = [ - "rand_core", + "rand_core 0.10.0", ] [[package]] @@ -406,23 +406,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] -name = "rand_jitter" -version = "0.4.0" +name = "rand_core" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "814ba4c101d5c52ef4e6e8e5288c4b6e03d840af28e4d0ff9edab06ed5e1f2f4" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" + +[[package]] +name = "rand_jitter" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a02dd27aa28665e46e60168c8f355240c73b8a344d2557a92318849441ffda33" dependencies = [ "libc", - "rand_core", + "rand_core 0.10.0", "winapi", ] [[package]] name = "rand_xorshift" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" dependencies = [ - "rand_core", + "rand_core 0.10.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6d5d608b1b..6496aac703 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,10 +70,9 @@ bitflags = "2" cbitset = "0.2" posix-regex = { version = "0.1.4", features = ["no_std"] } -# TODO: For some reason, rand_jitter hasn't been updated to use the latest rand_core -rand = { version = "0.8", default-features = false, features = ["small_rng"] } -rand_xorshift = "0.3" -rand_jitter = "0.4" +rand = { version = "0.10", default-features = false } +rand_xorshift = "0.5" +rand_jitter = "0.6" memchr = { version = "2.2.0", default-features = false } plain = "0.2" diff --git a/src/header/crypt/mod.rs b/src/header/crypt/mod.rs index 0087f56793..4a3edd6872 100644 --- a/src/header/crypt/mod.rs +++ b/src/header/crypt/mod.rs @@ -8,7 +8,7 @@ use alloc::{ string::{String, ToString}, }; use core::ptr; -use rand::{RngCore, SeedableRng, rngs::SmallRng}; +use rand::{Rng, SeedableRng, rngs::SmallRng}; use crate::{ c_str::CStr, diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs index 478c142e56..5fb1b4d04a 100644 --- a/src/header/stdlib/mod.rs +++ b/src/header/stdlib/mod.rs @@ -4,8 +4,8 @@ use core::{convert::TryFrom, intrinsics, iter, mem, ptr, slice}; use rand::{ - Rng, SeedableRng, - distributions::{Alphanumeric, Distribution, Uniform}, + RngExt, SeedableRng, + distr::{Alphanumeric, Distribution, Uniform}, }; use rand_jitter::JitterRng; use rand_xorshift::XorShiftRng; @@ -66,7 +66,7 @@ static mut RNG: Option = None; static RNG_SAMPLER: Once> = Once::new(); fn rng_sampler() -> &'static Uniform { - RNG_SAMPLER.call_once(|| Uniform::new_inclusive(0, RAND_MAX)) + RNG_SAMPLER.call_once(|| Uniform::new_inclusive(0, RAND_MAX).expect("within bounds")) } /// See .