Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2018 19:10:45 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338273 - head/sys/netinet
Message-ID:  <201808231910.w7NJAj4k001960@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Thu Aug 23 19:10:45 2018
New Revision: 338273
URL: https://svnweb.freebsd.org/changeset/base/338273

Log:
  Use arc4rand() instead of read_random() in the SCTP and TCP code.
  
  This was suggested by jmg@.
  
  Reviewed by:		delphij@, jmg@, jtl@
  MFC after:		1 month
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D16860

Modified:
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/tcp_subr.c

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Thu Aug 23 18:46:05 2018	(r338272)
+++ head/sys/netinet/sctp_os_bsd.h	Thu Aug 23 19:10:45 2018	(r338273)
@@ -445,7 +445,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed,
 /*
  * SCTP AUTH
  */
-#define SCTP_READ_RANDOM(buf, len)	read_random(buf, len)
+#define SCTP_READ_RANDOM(buf, len)	arc4rand(buf, len, 0)
 
 /* map standard crypto API names */
 #define SCTP_SHA1_CTX		SHA1_CTX

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Thu Aug 23 18:46:05 2018	(r338272)
+++ head/sys/netinet/tcp_subr.c	Thu Aug 23 19:10:45 2018	(r338273)
@@ -1096,7 +1096,7 @@ tcp_init(void)
 	/* Initialize the TCP logging data. */
 	tcp_log_init();
 #endif
-	read_random(&V_ts_offset_secret, sizeof(V_ts_offset_secret));
+	arc4rand(&V_ts_offset_secret, sizeof(V_ts_offset_secret), 0);
 
 	if (tcp_soreceive_stream) {
 #ifdef INET
@@ -2716,7 +2716,7 @@ tcp_new_isn(struct in_conninfo *inc)
 	if ((V_isn_last_reseed == 0) || ((V_tcp_isn_reseed_interval > 0) &&
 	     (((u_int)V_isn_last_reseed + (u_int)V_tcp_isn_reseed_interval*hz)
 		< (u_int)ticks))) {
-		read_random(&V_isn_secret, sizeof(V_isn_secret));
+		arc4rand(&V_isn_secret, sizeof(V_isn_secret), 0);
 		V_isn_last_reseed = ticks;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808231910.w7NJAj4k001960>