wasm: add support for the crypto/rand package

This is done via wasi-libc and the WASI interface, for ease of
maintenance (only one implementation for both WASI and JS/browsers).
This commit is contained in:
Ayke van Laethem
2021-07-31 15:10:18 +02:00
committed by Ron Evans
parent ab47cea055
commit 478c592b13
7 changed files with 37 additions and 26 deletions
+4
View File
@@ -285,6 +285,10 @@
throw 'trying to exit with code ' + code;
}
},
random_get: (bufPtr, bufLen) => {
crypto.getRandomValues(loadSlice(bufPtr, bufLen));
return 0;
},
},
env: {
// func ticks() float64