From 333e90448a0e55f2e1161853caecf3d30ef3a74a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 5 Dec 2019 18:48:21 +0100 Subject: crypto/rand: generate random numbers using RtlGenRandom on Windows CryptGenRandom appears to be unfavorable these days, whereas the classic RtlGenRandom is still going strong. This commit also moves the warnBlocked function into rand_unix, rather than rand, because it's now only used on unix. Fixes #33542 Change-Id: I5c02a5917572f54079d627972401efb6e1ce4057 Reviewed-on: https://go-review.googlesource.com/c/go/+/210057 Run-TryBot: Jason A. Donenfeld TryBot-Result: Go Bot Reviewed-by: Filippo Valsorda Trust: Jason A. Donenfeld --- src/crypto/rand/rand.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/crypto/rand/rand.go') diff --git a/src/crypto/rand/rand.go b/src/crypto/rand/rand.go index a5ccd19de3..fddd1147e6 100644 --- a/src/crypto/rand/rand.go +++ b/src/crypto/rand/rand.go @@ -14,7 +14,7 @@ import "io" // On Linux and FreeBSD, Reader uses getrandom(2) if available, /dev/urandom otherwise. // On OpenBSD, Reader uses getentropy(2). // On other Unix-like systems, Reader reads from /dev/urandom. -// On Windows systems, Reader uses the CryptGenRandom API. +// On Windows systems, Reader uses the RtlGenRandom API. // On Wasm, Reader uses the Web Crypto API. var Reader io.Reader @@ -23,7 +23,3 @@ var Reader io.Reader func Read(b []byte) (n int, err error) { return io.ReadFull(Reader, b) } - -func warnBlocked() { - println("crypto/rand: blocked for 60 seconds waiting to read random data from the kernel") -} -- cgit v1.2.1