Skip to content

Commit

Permalink
Seed the preview2 context with the thread_rng, instead of using a sys…
Browse files Browse the repository at this point in the history
…call
  • Loading branch information
elliottt committed Sep 28, 2023
1 parent a4e35cc commit 2c3a283
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/wasi/src/preview2/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ impl WasiCtxBuilder {
pub fn new() -> Self {
// For the insecure random API, use `SmallRng`, which is fast. It's
// also insecure, but that's the deal here.
let insecure_random = Box::new(cap_rand::rngs::SmallRng::from_entropy());
let insecure_random = Box::new(cap_rand::rngs::SmallRng::from_rng(cap_rand::thread_rng(
cap_rand::ambient_authority(),
)).unwrap());

// For the insecure random seed, use a `u128` generated from
// `thread_rng()`, so that it's not guessable from the insecure_random
Expand Down

0 comments on commit 2c3a283

Please sign in to comment.