From d88a0f5f3944535dd83d55bedc4d239544c5678d Mon Sep 17 00:00:00 2001 From: Marcin Kolny Date: Mon, 3 Jul 2023 00:38:40 +0100 Subject: Add limited support for WebAssembly WASI target CLA: trivial Reviewed-by: Tim Hudson Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21344) --- providers/implementations/rands/seeding/rand_unix.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'providers/implementations') diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index 2aae396f23..a6d246ad23 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -395,6 +395,10 @@ static ssize_t syscall_random(void *buf, size_t buflen) # elif (defined(__DragonFly__) && __DragonFly_version >= 500700) \ || (defined(__NetBSD__) && __NetBSD_Version >= 1000000000) return getrandom(buf, buflen, 0); +# elif defined(__wasi__) + if (getentropy(buf, buflen) == 0) + return (ssize_t)buflen; + return -1; # else errno = ENOSYS; return -1; -- cgit v1.2.3