| 13 | static bool pseudorand_initted = false; |
| 14 | |
| 15 | static void init_if_needed(void) |
| 16 | { |
| 17 | if (unlikely(!pseudorand_initted)) { |
| 18 | unsigned char seedbuf[16]; |
| 19 | struct sha256 sha; |
| 20 | |
| 21 | randombytes_buf(seedbuf, sizeof(seedbuf)); |
| 22 | memcpy(&siphashseed, seedbuf, sizeof(siphashseed)); |
| 23 | |
| 24 | /* In case isaac is reversible, don't leak seed. */ |
| 25 | sha256(&sha, seedbuf, sizeof(seedbuf)); |
| 26 | isaac64_init(&isaac64, sha.u.u8, sizeof(sha.u.u8)); |
| 27 | pseudorand_initted = true; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | uint64_t pseudorand(uint64_t max) |
| 32 | { |
no test coverage detected