diff --git a/Sources/UUID/uuid.c b/Sources/UUID/uuid.c index 8282995df2..5dc4aca97a 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);