From 3875258f971ce534262020c8342e70226b770d95 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 27 Jan 2023 22:49:46 -0800 Subject: [PATCH] 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 Reviewed-by: Evan Phoenix Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Reviewed-by: Michael Knyszek --- misc/wasm/wasm_exec_node.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/misc/wasm/wasm_exec_node.js b/misc/wasm/wasm_exec_node.js index 90905db115..986069087b 100644 --- a/misc/wasm/wasm_exec_node.js +++ b/misc/wasm/wasm_exec_node.js @@ -16,12 +16,7 @@ globalThis.TextDecoder = require("util").TextDecoder; globalThis.performance ??= require("performance"); -const crypto = require("crypto"); -globalThis.crypto = { - getRandomValues(b) { - crypto.randomFillSync(b); - }, -}; +globalThis.crypto ??= require("crypto"); require("./wasm_exec"); -- 2.48.1