aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/rand_xor.c
Commit message (Collapse)AuthorAgeFilesLines
* util/rand_xor: extend the urandom path to all non-Windows platformsEric Engestrom2020-05-161-2/+4
| | | | | | | | Any system that provides `/dev/urandom` should be allowed to try to use it. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emmanuel Gil Peyrot <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2316>
* util/rand_xor: fallback Linux to time-based instead of fixed seedEric Engestrom2020-05-161-22/+14
| | | | | | | | | When the caller asked for a randomised_seed, we should fall back to the time-based seed instead of the fixed seed. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emmanuel Gil Peyrot <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2316>
* util/rand_xor: drop unused headerEric Engestrom2020-05-161-1/+0
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emmanuel Gil Peyrot <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2316>
* util/rand_xor: make it clear that {,s_}rand_xorshift128plus take *exactly 2* ↵Eric Engestrom2020-05-161-2/+2
| | | | | | | | uint64_t Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emmanuel Gil Peyrot <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2316>
* util/rand_xor: use getrandom() when availableEmmanuel Gil Peyrot2020-05-151-1/+11
| | | | | | | | | | | | | | This function has been added in glibc 2.25, and the related syscall in Linux 3.17, in order to avoid requiring the /dev/urandom to exist, and doing the open()/read()/close() dance on it. We pass GRND_NONBLOCK so that it doesn’t block if not enough entropy has been gathered to initialise the /dev/urandom source, and fallback to the next source in any error case. Signed-off-by: Emmanuel Gil Peyrot <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2026>
* util/rand_xor: add missing include statementsNicolas Dechesne2017-06-011-0/+1
| | | | | | | | | | | | | | Fixes for: src/util/rand_xor.c:60:13: error: implicit declaration of function 'open' [-Werror=implicit-function-declaration] int fd = open("/dev/urandom", O_RDONLY); ^~~~ src/util/rand_xor.c:60:34: error: 'O_RDONLY' undeclared (first use in this function) int fd = open("/dev/urandom", O_RDONLY); ^~~~~~~~ Signed-off-by: Nicolas Dechesne <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/rand_xor: add function to seed randTimothy Arceri2017-03-231-0/+65
| | | | | | | | V2: pass the seed to the seed function so that we can isolate its uses. Stop leaking fd when urandom couldn't be read. Reviewed-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* util: move rand_xorshift128plus() to utilsTimothy Arceri2017-03-231-0/+20
V2: pass the seed to rand_xorshift128plus() so that we can isolate its uses. Reviewed-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>