From b6b591ef197b227954fd1f0baef964bb40f03575 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 11 Nov 2023 18:41:50 -0700 Subject: [PATCH] crypto-common: weakly activate `rand_core/getrandom` (#1381) When both `getrandom` and `rand_core` are enabled, activates the `rand_core/getrandom` feature, which makes `OsRng` available as `crypto_common::rand_core::OsRng`. --- Cargo.lock | 1 + crypto-common/Cargo.toml | 1 + crypto-common/src/lib.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b9bfc7bbf..c8aae2089 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,6 +286,7 @@ dependencies = [ name = "crypto-common" version = "0.2.0-pre" dependencies = [ + "getrandom", "hybrid-array", "rand_core 0.6.4", ] diff --git a/crypto-common/Cargo.toml b/crypto-common/Cargo.toml index 38496ad54..e0e7dd090 100644 --- a/crypto-common/Cargo.toml +++ b/crypto-common/Cargo.toml @@ -20,6 +20,7 @@ rand_core = { version = "0.6.4", optional = true } getrandom = { version = "0.2", optional = true } [features] +getrandom = ["dep:getrandom", "rand_core?/getrandom"] std = [] [package.metadata.docs.rs] diff --git a/crypto-common/src/lib.rs b/crypto-common/src/lib.rs index 5fb3a814a..247746a64 100644 --- a/crypto-common/src/lib.rs +++ b/crypto-common/src/lib.rs @@ -12,6 +12,8 @@ #[cfg(feature = "std")] extern crate std; +#[cfg(feature = "getrandom")] +pub use getrandom; #[cfg(feature = "rand_core")] pub use rand_core;