1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:34:44 -07:00

runtime: use urandom instead of random

Random is bad, it can block and prevent binaries from starting.
Use urandom instead.  We'd rather have bad random bits than no
random bits.

Change-Id: I360e1cb90ace5518a1b51708822a1dae27071ebd
Reviewed-on: https://go-review.googlesource.com/2582
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
Keith Randall 2015-01-08 15:30:22 -08:00
parent 5664eda733
commit 1de9c4073b
4 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ func osinit() {
}
}
var urandom_dev = []byte("/dev/random\x00")
var urandom_dev = []byte("/dev/urandom\x00")
//go:nosplit
func getRandomData(r []byte) {

View File

@ -96,7 +96,7 @@ func osinit() {
ncpu = getncpu()
}
var urandom_dev = []byte("/dev/random\x00")
var urandom_dev = []byte("/dev/urandom\x00")
//go:nosplit
func getRandomData(r []byte) {

View File

@ -145,7 +145,7 @@ func osinit() {
ncpu = getproccount()
}
var urandom_dev = []byte("/dev/random\x00")
var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
if startupRandomData != nil {

View File

@ -165,7 +165,7 @@ func newosproc(mp *m, _ unsafe.Pointer) {
}
}
var urandom_dev = []byte("/dev/random\x00")
var urandom_dev = []byte("/dev/urandom\x00")
//go:nosplit
func getRandomData(r []byte) {