misc/wasm: use NodeJS crypto library
The move to NodeJS 18 allows us to replace the custom
crypto functions with the expanded crypto primitives of
the NodeJS crypto library.
Fixes #56860
Change-Id: I8726b4003150f31521f246f613b6976641b9fa69
Reviewed-on: https://go-review.googlesource.com/c/go/+/463975
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Evan Phoenix <evan@phx.io>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/misc/wasm/wasm_exec_node.js b/misc/wasm/wasm_exec_node.js
index 90905db..9860690 100644
--- a/misc/wasm/wasm_exec_node.js
+++ b/misc/wasm/wasm_exec_node.js
@@ -16,12 +16,7 @@
globalThis.performance ??= require("performance");
-const crypto = require("crypto");
-globalThis.crypto = {
- getRandomValues(b) {
- crypto.randomFillSync(b);
- },
-};
+globalThis.crypto ??= require("crypto");
require("./wasm_exec");