aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/rand/rand_getrandom.go
AgeCommit message (Collapse)Author
2023-01-26crypto/rand, internal/syscall/unix: add support for getrandom on NetBSD ≥ 10.0json-isValidNumber-beforeTobias Klauser
The getrandom syscall was added to NetBSD in version 10.0, see https://man.netbsd.org/NetBSD-10.0-STABLE/getrandom.2 Change-Id: I2714c1040791f7f4728be8d869058a38cbd93d4d Reviewed-on: https://go-review.googlesource.com/c/go/+/463123 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-04-20crypto/rand: apply the same max read size on Illumos as on SolarisBryan C. Mills
This case was missed in CL 370894, and masked by the lack of an Illumos TryBot. Fixes #52452. Change-Id: I7cda193e33c11a9d04eb888fdb5ec9218e6ed1b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/401294 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Filippo Valsorda <valsorda@google.com>
2022-04-19crypto/rand: batch and buffer calls to getrandom/getentropyJason A. Donenfeld
We're using bufio to batch reads of /dev/urandom to 4k, but we weren't doing the same on newer platforms with getrandom/getentropy. Since the overhead is the same for these -- one syscall -- we should batch reads of these into the same 4k buffer. While we're at it, we can simplify a lot of the constant dispersal. This also adds a new test case to make sure the buffering works as desired. Change-Id: I7297d4aa795c00712e6484b841cef8650c2be4ef Reviewed-on: https://go-review.googlesource.com/c/go/+/370894 Reviewed-by: Filippo Valsorda <valsorda@google.com> Run-TryBot: Jason Donenfeld <Jason@zx2c4.com> Auto-Submit: Jason Donenfeld <Jason@zx2c4.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>