bind9/lib/isc
Ondřej Surý 99ba29bc52 Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG
This commit reverts the previous change to use system provided
entropy, as (SYS_)getrandom is very slow on Linux because it is
a syscall.

The change introduced in this commit adds a new call isc_nonce_buf
that uses CSPRNG from cryptographic library provider to generate
secure data that can be and must be used for generating nonces.
Example usage would be DNS cookies.

The isc_random() API has been changed to use fast PRNG that is not
cryptographically secure, but runs entirely in user space.  Two
contestants have been considered xoroshiro family of the functions
by Villa&Blackman and PCG by O'Neill.  After a consideration the
xoshiro128starstar function has been used as uint32_t random number
provider because it is very fast and has good enough properties
for our usage pattern.

The other change introduced in the commit is the more extensive usage
of isc_random_uniform in places where the usage pattern was
isc_random() % n to prevent modulo bias.  For usage patterns where
only 16 or 8 bits are needed (DNS Message ID), the isc_random()
functions has been renamed to isc_random32(), and isc_random16() and
isc_random8() functions have been introduced by &-ing the
isc_random32() output with 0xffff and 0xff.  Please note that the
functions that uses stripped down bit count doesn't pass our
NIST SP 800-22 based random test.
2018-05-29 22:58:21 +02:00
..
alpha Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
ia64 Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
include Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
mips Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
nls address win32 build issues 2018-05-22 16:32:21 -07:00
noatomic Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
nothreads address win32 build issues 2018-05-22 16:32:21 -07:00
powerpc Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
pthreads address win32 build issues 2018-05-22 16:32:21 -07:00
sparc64 Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
tests Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
unix Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
win32 Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
x86_32 Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
x86_64 Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
.gitignore [master] update gitignore files; use rev-parse to get srcid 2014-06-17 13:49:30 -07:00
aes.c address win32 build issues 2018-05-22 16:32:21 -07:00
api begin preparation for 9.13.0 2018-05-21 11:50:38 -07:00
app_api.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
assertions.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
Atffile 3131. [func] Improve scalability by allocating one zone task 2011-07-06 05:05:52 +00:00
backtrace-emptytbl.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
backtrace.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
base32.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
base64.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
bind9.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
buffer.c isc_buffer_*(): if source can be NULL, only call memmove() when length is non-zero 2018-05-15 09:11:34 +02:00
bufferlist.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
commandline.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
counter.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
crc64.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
entropy.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
entropy_private.h Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
error.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
event.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
fsaccess.c address win32 build issues 2018-05-22 16:32:21 -07:00
hash.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
heap.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
hex.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
hmacmd5.c address win32 build issues 2018-05-22 16:32:21 -07:00
hmacsha.c address win32 build issues 2018-05-22 16:32:21 -07:00
ht.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
httpd.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
inet_ntop.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
inet_pton.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
iterated_hash.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
Kyuafile regen master 2017-12-29 01:44:18 +00:00
lex.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
lfsr.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
lib.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
log.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
Makefile.in Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
md5.c address win32 build issues 2018-05-22 16:32:21 -07:00
mem.c Don't keep around debuglist structs when done 2018-05-11 11:17:14 +10:00
mutexblock.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
netaddr.c isc_buffer_*(): if source can be NULL, only call memmove() when length is non-zero 2018-05-15 09:11:34 +02:00
netscope.c Replace isc_string_touint64 with strtoull (C99) 2018-04-12 10:37:33 +02:00
nonce.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
parseint.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
pk11.c address win32 build issues 2018-05-22 16:32:21 -07:00
pk11_result.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
pool.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
portset.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
print.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
quota.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
radix.c improve readability of radix code 2018-05-28 18:45:41 -04:00
random.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
ratelimiter.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
refcount.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
regex.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
region.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
result.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
rwlock.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
safe.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
serial.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
sha1.c address win32 build issues 2018-05-22 16:32:21 -07:00
sha2.c address win32 build issues 2018-05-22 16:32:21 -07:00
sockaddr.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
socket_api.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
stats.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
string.c Remove isc_string_strcasestr implementation and clean up the header and headers 2018-04-12 10:37:33 +02:00
strtoul.c address win32 build issues 2018-05-22 16:32:21 -07:00
symtab.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
task.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
taskpool.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
timer.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
timer_p.h Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
tm.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
version.c address win32 build issues 2018-05-22 16:32:21 -07:00
xoshiro128starstar.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00