From owner-svn-src-stable@freebsd.org Tue Mar 14 06:10:42 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 665E2D0AD2C; Tue, 14 Mar 2017 06:10:42 +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 32D1313BB; Tue, 14 Mar 2017 06:10:42 +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 v2E6Af6r071537; Tue, 14 Mar 2017 06:10:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2E6Af2N071535; Tue, 14 Mar 2017 06:10:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201703140610.v2E6Af2N071535@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:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315226 - in stable/11: lib/libc/gen sys/libkern X-SVN-Group: stable-11 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:10:42 -0000 Author: delphij Date: Tue Mar 14 06:10:40 2017 New Revision: 315226 URL: https://svnweb.freebsd.org/changeset/base/315226 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/11/lib/libc/gen/arc4random.c stable/11/sys/libkern/arc4random.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/arc4random.c ============================================================================== --- stable/11/lib/libc/gen/arc4random.c Tue Mar 14 06:00:44 2017 (r315225) +++ stable/11/lib/libc/gen/arc4random.c Tue Mar 14 06:10:40 2017 (r315226) @@ -171,7 +171,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/11/sys/libkern/arc4random.c ============================================================================== --- stable/11/sys/libkern/arc4random.c Tue Mar 14 06:00:44 2017 (r315225) +++ stable/11/sys/libkern/arc4random.c Tue Mar 14 06:10:40 2017 (r315226) @@ -72,11 +72,11 @@ 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.) * * http://dl.acm.org/citation.cfm?id=646557.694759 */ - for (n = 0; n < 256*4; n++) + for (n = 0; n < 768*4; n++) arc4_randbyte(); mtx_unlock(&arc4_mtx); }