From owner-svn-src-stable@freebsd.org Tue Mar 14 06:12:52 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA7E3D0AF49; Tue, 14 Mar 2017 06:12:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6C8C181D; Tue, 14 Mar 2017 06:12:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2E6CpEO075278; Tue, 14 Mar 2017 06:12:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2E6CpMo075276; Tue, 14 Mar 2017 06:12:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201703140612.v2E6CpMo075276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 14 Mar 2017 06:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r315227 - in stable/10: lib/libc/gen sys/libkern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2017 06:12:53 -0000 Author: delphij Date: Tue Mar 14 06:12:51 2017 New Revision: 315227 URL: https://svnweb.freebsd.org/changeset/base/315227 Log: MFC r315225: Discard first 3072 bytes of RC4 keystream, this is a bandaid that allows us to work on switching to a more modern PRNG. Submitted by: Steven Chamberlain Approved by: so Modified: stable/10/lib/libc/gen/arc4random.c stable/10/sys/libkern/arc4random.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/arc4random.c ============================================================================== --- stable/10/lib/libc/gen/arc4random.c Tue Mar 14 06:10:40 2017 (r315226) +++ stable/10/lib/libc/gen/arc4random.c Tue Mar 14 06:12:51 2017 (r315227) @@ -172,7 +172,7 @@ arc4_stir(void) * Discard early keystream, as per recommendations in: * "(Not So) Random Shuffles of RC4" by Ilya Mironov. */ - for (i = 0; i < 1024; i++) + for (i = 0; i < 3072; i++) (void)arc4_getbyte(); arc4_count = 1600000; } Modified: stable/10/sys/libkern/arc4random.c ============================================================================== --- stable/10/sys/libkern/arc4random.c Tue Mar 14 06:10:40 2017 (r315226) +++ stable/10/sys/libkern/arc4random.c Tue Mar 14 06:12:51 2017 (r315227) @@ -80,9 +80,9 @@ arc4_randomstir (void) /* * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. (N = 256 in our case.) + * by Fluher, Mantin, and Shamir. (N = 768 in our case.) */ - for (n = 0; n < 256*4; n++) + for (n = 0; n < 768*4; n++) arc4_randbyte(); mtx_unlock(&arc4_mtx); }