From: Johan Brandhorst-Satzkorn Date: Sat, 28 Jan 2023 06:49:46 +0000 (-0800) Subject: misc/wasm: use NodeJS crypto library X-Git-Tag: go1.21rc1~1730 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3875258f971ce534262020c8342e70226b770d95;p=gostls13.git 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 --- 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");