Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update getrandom to 0.3 #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ wyrand = []
pcg64 = []
chacha = []
rdseed = ["std"]
getrandom_custom = ["getrandom/custom"]

[dependencies]
zeroize = { version = "1.5", optional = true, features = ["zeroize_derive"] }

# optional getrandom with 'js' feature for WASM
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", optional = true, features = ["js"] }
getrandom = { version = "0.3", optional = true, features = ["wasm_js"] }

# optional getrandom with 'rdrand' feature for x86(-64)
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
getrandom = { version = "0.2", optional = true, features = ["rdrand"] }
getrandom = { version = "0.3", optional = true }

# optional getrandom without any features for non-WASM, non-x86 targets.
[target.'cfg(not(any(target_arch = "wasm32", target_arch = "x86", target_arch = "x86_64")))'.dependencies]
getrandom = { version = "0.2", optional = true }
getrandom = { version = "0.3", optional = true }

[dev-dependencies]
hex = "0.4.3"
Expand Down
5 changes: 1 addition & 4 deletions src/entropy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(feature = "getrandom_custom")]
pub use getrandom::register_custom_getrandom;

#[cfg(all(target_vendor = "apple", not(feature = "getrandom")))]
pub use darwin::entropy as system;
#[cfg(all(
Expand Down Expand Up @@ -42,7 +39,7 @@ pub mod openbsd;
/// Pull in system entropy using the [`getrandom`](https://crates.io/crates/getrandom) crate.
/// Uses backup entropy (rdseed and system time) if it fails.
pub fn system(out: &mut [u8]) {
match getrandom::getrandom(out) {
match getrandom::fill(out) {
Ok(_) => (),
Err(_) => backup(out),
}
Expand Down