Make perl use our (arc4random backed) drand48 when unseeded
authorafresh1 <afresh1@openbsd.org>
Tue, 30 Dec 2014 20:46:45 +0000 (20:46 +0000)
committerafresh1 <afresh1@openbsd.org>
Tue, 30 Dec 2014 20:46:45 +0000 (20:46 +0000)
uses srand48_deterministic if a seed is provided.

seems fine millert@

gnu/usr.bin/perl/Configure
gnu/usr.bin/perl/pp.c

index 8e22a5f..d34fded 100644 (file)
@@ -19620,9 +19620,9 @@ case "$ccflags" in
        ;;
 esac
 
-randfunc=Perl_drand48
-drand01="Perl_drand48()"
-seedfunc="Perl_drand48_init"
+randfunc=drand48
+drand01="drand48()"
+seedfunc="srand48"
 randbits=48
 randseedtype=U32
 
index 4ec6887..79abdb0 100644 (file)
@@ -2785,9 +2785,12 @@ PP(pp_srand)
         }
     }
     else {
-        anum = seed();
+        anum = 0;
     }
 
+    if (anum)
+        (void)srand48_deterministic((Rand_seed_t)anum);
+    else
     (void)seedDrand01((Rand_seed_t)anum);
     PL_srand_called = TRUE;
     if (anum)