git: libc - Fix bugs in arc4random, improve arc4random() and srandomdev()

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Oct 17 15:18:40 PDT 2013


commit ebbb4b97bba5f71fea11be7f7df933ecaf76a6e5
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Oct 17 15:15:58 2013 -0700

    libc - Fix bugs in arc4random, improve arc4random() and srandomdev()
    
    * Fix a bug where arc4random() was not using the entire 128 bytes of random
      data it had read from /dev/random.
    
    * Increase the amount of state incorporated by arc4random_stir()
      from 128 to 256 bytes.
    
    * Fix an important issue with both srandomdev() and arc4random().  When
      /dev/random is not available these functions now back-off to the new
      kern.random sysctl to obtain random data.
    
      This allows these functions to work in chroot's that might not have
      /dev mounted.
    
    * Do not try to incorporate random stack data.  This is stupid, the stack
      data is not random.

Summary of changes:
 lib/libc/gen/arc4random.c | 84 +++++++++++++++++++++++++++++++++--------------
 lib/libc/stdlib/random.c  | 38 +++++++++++++++++----
 2 files changed, 90 insertions(+), 32 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ebbb4b97bba5f71fea11be7f7df933ecaf76a6e5


-- 
DragonFly BSD source repository



More information about the Commits mailing list