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 <steven pyro eu org>
  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);
 }
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to