1
0
mirror of https://github.com/golang/go synced 2024-11-08 07:26:11 -07:00
go/src/crypto/rand
Michael McLoughlin d401c427b2 crypto/rand: batch large calls to linux getrandom
The linux getrandom system call returns at most 33554431 = 2^25-1 bytes per
call. The existing behavior for larger reads is to report a failure, because
there appears to have been an unexpected short read. In this case the system
falls back to reading from "/dev/urandom".

This change performs reads of 2^25 bytes or more with multiple calls to
getrandom.

Fixes #20877

Change-Id: I618855bdedafd86cd11219fe453af1d6fa2c88a7
Reviewed-on: https://go-review.googlesource.com/49170
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 19:29:14 +00:00
..
eagain.go
example_test.go
rand_linux_test.go crypto/rand: batch large calls to linux getrandom 2017-08-09 19:29:14 +00:00
rand_linux.go crypto/rand: batch large calls to linux getrandom 2017-08-09 19:29:14 +00:00
rand_openbsd.go
rand_test.go
rand_unix.go
rand_windows.go
rand.go
util_test.go crypto/rand: only read necessary bytes for Int 2017-05-23 21:02:14 +00:00
util.go crypto/rand: only read necessary bytes for Int 2017-05-23 21:02:14 +00:00