Add limited support for WebAssembly WASI target

CLA: trivial

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21344)
This commit is contained in:
Marcin Kolny 2023-07-03 00:38:40 +01:00 committed by Pauli
parent 3e76b38852
commit d88a0f5f39
2 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,8 @@
#if defined(OPENSSL_SYS_WINCE)
#elif defined(OPENSSL_SYS_WIN32)
#elif defined(__wasi__)
# define NO_SYSLOG
#elif defined(OPENSSL_SYS_VMS)
# include <opcdef.h>
# include <descrip.h>

View File

@ -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;