Skip to content

Commit

Permalink
wasi support
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Mar 26, 2019
1 parent c9b4bea commit 8db3df8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions impl/random.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,23 @@ hydro_random_init(void)
return -1;
}
hydro_random_context.counter = ~LOAD64_LE(hydro_random_context.state);

return 0;
}

#elif defined(__wasi__)

#include <unistd.h>

static int
hydro_random_init(void)
{
if (getentropy(hydro_random_context.state,
sizeof hydro_random_context.state) != 0) {
return -1;
}
hydro_random_context.counter = ~LOAD64_LE(hydro_random_context.state);

return 0;
}

Expand Down

0 comments on commit 8db3df8

Please sign in to comment.