diff options
Diffstat (limited to 'usr.sbin/bind/bin/dig/dighost.c')
-rw-r--r-- | usr.sbin/bind/bin/dig/dighost.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c index 9532869d9c4..4e2928dbda0 100644 --- a/usr.sbin/bind/bin/dig/dighost.c +++ b/usr.sbin/bind/bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.27 2020/01/09 14:19:49 florian Exp $ */ +/* $Id: dighost.c,v 1.28 2020/01/09 14:24:07 florian Exp $ */ /*! \file * \note @@ -43,7 +43,7 @@ #include <dns/ds.h> #include <dns/master.h> #include <dns/nsec.h> -#include <isc/random.h> + #include <ctype.h> #endif #include <dns/fixedname.h> @@ -65,7 +65,7 @@ #include <isc/app.h> #include <isc/base64.h> -#include <isc/entropy.h> + #include <isc/file.h> #include <isc/hex.h> #include <isc/lang.h> @@ -74,7 +74,7 @@ #include <isc/netdb.h> #include <isc/parseint.h> -#include <isc/random.h> + #include <isc/result.h> #include <isc/safe.h> #include <isc/serial.h> @@ -165,7 +165,6 @@ unsigned int digestbits = 0; isc_buffer_t *namebuf = NULL; dns_tsigkey_t *tsigkey = NULL; isc_boolean_t validated = ISC_TRUE; -isc_entropy_t *entp = NULL; isc_mempool_t *commctx = NULL; isc_boolean_t debugging = ISC_FALSE; isc_boolean_t debugtiming = ISC_FALSE; @@ -1424,7 +1423,6 @@ void setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { dig_searchlist_t *domain = NULL; lwres_result_t lwresult; - isc_result_t result; debug("setup_system()"); @@ -1505,10 +1503,7 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { #endif #endif - result = isc_entropy_getdata(entp, cookie_secret, - sizeof(cookie_secret), NULL, 0); - if (result != ISC_R_SUCCESS) - fatal("unable to generate cookie secret"); + arc4random_buf(cookie_secret, sizeof(cookie_secret)); } /*% @@ -1574,10 +1569,9 @@ setup_libs(void) { result = isc_socketmgr_create(mctx, &socketmgr); check_result(result, "isc_socketmgr_create"); - result = isc_entropy_create(mctx, &entp); check_result(result, "isc_entropy_create"); - result = dst_lib_init(mctx, entp, 0); + result = dst_lib_init(mctx); check_result(result, "dst_lib_init"); is_dst_up = ISC_TRUE; @@ -2145,8 +2139,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) srv != NULL; srv = ISC_LIST_HEAD(lookup->my_server_list)) { INSIST(i > 0); - isc_random_get(&j); - j %= i; + j = arc4random_uniform(i); next = ISC_LIST_NEXT(srv, link); while (j-- > 0 && next != NULL) { srv = next; @@ -2434,7 +2427,7 @@ setup_lookup(dig_lookup_t *lookup) { dighost_trying(store, lookup); INSIST(dns_name_isabsolute(lookup->name)); - isc_random_get(&id); + id = arc4random(); lookup->sendmsg->id = (unsigned short)id & 0xFFFF; lookup->sendmsg->opcode = lookup->opcode; lookup->msgcounter = 0; @@ -4394,10 +4387,6 @@ destroy_libs(void) { dst_lib_destroy(); is_dst_up = ISC_FALSE; } - if (entp != NULL) { - debug("detach from entropy"); - isc_entropy_detach(&entp); - } UNLOCK_LOOKUP; DESTROYLOCK(&lookup_lock); |