bind9/lib/dns
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
..
include remove #ifndef DNS_RBT_USEHASH from rbtdb.c 2018-05-25 09:12:17 -07:00
rdata 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
win32 address win32 build issues 2018-05-22 16:32:21 -07:00
.gitignore 4394. [func] Add rndc command "dnstap-reopen" to close and 2016-06-24 09:37:04 +10:00
acl.c improve readability of radix code 2018-05-28 18:45:41 -04:00
adb.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
api begin preparation for 9.13.0 2018-05-21 11:50:38 -07:00
Atffile 3043. [test] Merged in the NetBSD ATF test framework (currently 2011-02-26 02:26:33 +00:00
badcache.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
byaddr.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
cache.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
callbacks.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
catz.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
client.c Replace all random functions with isc_random, isc_random_buf and isc_random_uniform API. 2018-05-16 09:54:35 +02:00
clientinfo.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
compress.c address win32 build issues 2018-05-22 16:32:21 -07:00
db.c remove the rbtdb64 database implementation 2018-04-20 16:14:51 -07:00
dbiterator.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dbtable.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
diff.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dispatch.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
dlz.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dns64.c remove the experimental authoritative ECS support from named 2018-05-25 08:21:25 -07:00
dnsrps.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
dnssec.c Address GCC 8 -Wformat-truncation warnings 2018-05-10 10:35:01 +02:00
dnstap.c libdns refactoring: get rid of multiple versions of dns_dt_create, dns_view_setcache, dns_zt_apply, dns_message_logfmtpacket, dns_message_logpacket, dns_ssutable_checkrules and dns_ttl_totext 2018-04-06 08:04:41 +02:00
dnstap.proto [master] dnstap 2015-10-02 12:32:42 -07:00
ds.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dst_api.c copyrights 2018-05-23 12:39:40 -04:00
dst_gost.h Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
dst_internal.h address win32 build issues 2018-05-22 16:32:21 -07:00
dst_lib.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dst_openssl.h Use standard OPENSSL_NO_ENGINE instead of custom USE_ENGINE define 2018-05-03 15:32:43 +02:00
dst_parse.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dst_parse.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dst_pkcs11.h Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
dst_result.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
dyndb.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
ecdb.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
ecs.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
fixedname.c Add a dns_fixedname_initname() helper function 2018-04-09 12:14:16 +02:00
forward.c libdns refactoring: get rid of multiple versions of dns_keytable_add, dns_iptable_addprefix and dns_iptable_addprefix 2018-04-06 08:04:41 +02:00
gen-unix.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
gen-win32.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
gen.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
geoip.c remove the experimental authoritative ECS support from named 2018-05-25 08:21:25 -07:00
gssapi_link.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
gssapictx.c Replace all random functions with isc_random, isc_random_buf and isc_random_uniform API. 2018-05-16 09:54:35 +02:00
hmac_link.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
ipkeylist.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
iptable.c improve readability of radix code 2018-05-28 18:45:41 -04:00
journal.c Remove isc_string_printf and isc_string_printf_truncate. 2018-04-12 10:37:33 +02:00
key.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
keydata.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
keytable.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
lib.c Replace all random functions with isc_random, isc_random_buf and isc_random_uniform API. 2018-05-16 09:54:35 +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
lookup.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
Makefile.in address win32 build issues 2018-05-22 16:32:21 -07:00
mapapi begin preparation for 9.13.0 2018-05-21 11:50:38 -07:00
master.c work around cppcheck false positive 2018-05-29 09:28:30 +10:00
masterdump.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
message.c libdns refactoring: get rid of multiple versions of dns_dt_create, dns_view_setcache, dns_zt_apply, dns_message_logfmtpacket, dns_message_logpacket, dns_ssutable_checkrules and dns_ttl_totext 2018-04-06 08:04:41 +02:00
name.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
ncache.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
nsec.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
nsec3.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
nta.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
openssl_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
openssldh_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
openssldsa_link.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
opensslecdsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
openssleddsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
opensslgost_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
opensslrsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
order.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
peer.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
pkcs11.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11dh_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11dsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11ecdsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11eddsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11gost_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
pkcs11rsa_link.c address win32 build issues 2018-05-22 16:32:21 -07:00
portlist.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
private.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
rbt.c remove #ifndef DNS_RBT_USEHASH from rbtdb.c 2018-05-25 09:12:17 -07:00
rbtdb.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
rbtdb.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rcode.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rdata.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rdatalist.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rdatalist_p.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rdataset.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
rdatasetiter.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rdataslab.c dns_rdataslab_merge(): use dns_rdata_compare() instead of compare_rdata() 2018-05-15 09:11:34 +02:00
request.c remove the experimental authoritative ECS support from named 2018-05-25 08:21:25 -07:00
resolver.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +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
rootns.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rpz.c Fix ARM about min-update-interval default for RPZ zones 2018-05-17 19:02:51 -07:00
rriterator.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
rrl.c remove the experimental authoritative ECS support from named 2018-05-25 08:21:25 -07:00
sdb.c fix shadowed global variables 2018-04-20 19:51:00 -04:00
sdlz.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
soa.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
spnego.asn1 Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
spnego.c address win32 build issues 2018-05-22 16:32:21 -07:00
spnego.h Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
spnego_asn1.c address win32 build issues 2018-05-22 16:32:21 -07:00
spnego_asn1.pl Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
ssu.c remove the experimental authoritative ECS support from named 2018-05-25 08:21:25 -07:00
ssu_external.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
tcpmsg.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
time.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +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
tkey.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
tsec.c Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
tsig.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
tsig_p.h Update license headers to not include years in copyright in all applicable files 2018-02-23 10:12:02 +01:00
ttl.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
update.c new option "dnskey-sig-validity" 2018-04-20 12:12:08 -07:00
validator.c Use dns_fixedname_initname() where possible 2018-04-09 12:14:16 +02:00
version.c address win32 build issues 2018-05-22 16:32:21 -07:00
view.c add named.conf option root-key-sentinel 2018-04-18 08:49:55 -07:00
xfrin.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
zone.c Change isc_random() to be just PRNG, and add isc_nonce_buf() that uses CSPRNG 2018-05-29 22:58:21 +02:00
zone_p.h Move find_zone_keys() to lib/dns/zone_p.h 2018-05-09 13:21:02 +02:00
zonekey.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00
zt.c Remove $Id markers, Principal Author and Reviewed tags from the full source tree 2018-05-11 13:17:46 +02:00