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
This commit is contained in:
tuexen 2018-08-23 19:10:45 +00:00
parent cf3e18f4f6
commit de9ca6bed2
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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;
}