]> Cypherpunks.ru repositories - gostls13.git/commitdiff
misc/wasm: use NodeJS crypto library
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Sat, 28 Jan 2023 06:49:46 +0000 (22:49 -0800)
committerJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Mon, 30 Jan 2023 18:49:42 +0000 (18:49 +0000)
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>
misc/wasm/wasm_exec_node.js

index 90905db1150ee7f3e645fe89c59f2a5d954fa152..986069087bc0bce0beddeb3fb19ebb2b42cf4fdb 100644 (file)
@@ -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");