os/os2: wasi target support

This commit is contained in:
Laytan Laats
2025-01-18 22:23:44 +01:00
parent 47030501ab
commit e4892f1bb2
17 changed files with 1238 additions and 4 deletions
+1
View File
@@ -5,6 +5,7 @@
#+build !netbsd
#+build !darwin
#+build !js
#+build !wasi
package crypto
HAS_RAND_BYTES :: false
+13
View File
@@ -0,0 +1,13 @@
package crypto
import "core:fmt"
import "core:sys/wasm/wasi"
HAS_RAND_BYTES :: true
@(private)
_rand_bytes :: proc(dst: []byte) {
if err := wasi.random_get(dst); err != nil {
fmt.panicf("crypto: wasi.random_get failed: %v", err)
}
}