diff --git a/Sources/UUID/uuid.c b/Sources/UUID/uuid.c index 6115754d71..4450f02474 100644 --- a/Sources/UUID/uuid.c +++ b/Sources/UUID/uuid.c @@ -88,6 +88,12 @@ static inline void read_random(void *buffer, unsigned numBytes) { BCryptGenRandom(NULL, buffer, numBytes, BCRYPT_RNG_USE_ENTROPY_IN_BUFFER | BCRYPT_USE_SYSTEM_PREFERRED_RNG); } +#elif TARGET_OS_WASI +#include + +static inline void read_random(void *buffer, unsigned numBytes) { + getentropy(buffer, numBytes); +} #else static inline void read_random(void *buffer, unsigned numBytes) { int fd = open("/dev/urandom", O_RDONLY);