]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add limited support for WebAssembly WASI target
authorMarcin Kolny <marcin.kolny@gmail.com>
Sun, 2 Jul 2023 23:38:40 +0000 (00:38 +0100)
committerPauli <pauli@openssl.org>
Thu, 6 Jul 2023 02:54:17 +0000 (12:54 +1000)
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)

crypto/bio/bss_log.c
providers/implementations/rands/seeding/rand_unix.c

index f2c84606d2b5e45ba63464e948824ddb94f07f5b..a90aebe0b48662ece155144082f8db35cf7b1689 100644 (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>
index 2aae396f2392ca3a299bc96578c4abb83edb0ad0..a6d246ad235e859679a4cee87341706db5a4d919 100644 (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;