| 1 |
BSD::arc4random version 1.50 |
| 2 |
============================ |
| 3 |
|
| 4 |
This module provides a Perl API for the BSDs' arc4random(3) suite |
| 5 |
of functions and adds a few high-level functions, such as the new |
| 6 |
arc4random_uniform(3). The Perl functions are ithreads-safe (only |
| 7 |
if threads::shared is required). Scalars can be tied to this pak- |
| 8 |
kage, yielding uniformly distributed random numbers with an arbi- |
| 9 |
trary upper bound on read access, contributing to the RC4 entropy |
| 10 |
pool on write access. An exported global $RANDOM variable returns |
| 11 |
15-bit unsigned random numbers, from [0; 32767], similar to mksh. |
| 12 |
Furthermore, Perl's internal PRNG is seeded with entropy obtained |
| 13 |
from the arc4random generator once on module load time. |
| 14 |
|
| 15 |
INSTALLATION |
| 16 |
|
| 17 |
Makefile.PL tries to auto-detect existence of arc4random_pushb by |
| 18 |
looking at the operating system used; see below if this fails: |
| 19 |
|
| 20 |
If your system does not have arc4random_pushb(3), edit the DEFINE |
| 21 |
line in Makefile.PL to define HAVE_ARC4RANDOM_PUSHB to 0 and make |
| 22 |
sure at least arc4random_addrandom(3) exists. *HOWEVER* note that |
| 23 |
then, entropy pushed into the system will end up in the process's |
| 24 |
own pool instead of in the kernel. You can fix this by regularily |
| 25 |
calling arc4random() or arc4random_bytes() and writing the output |
| 26 |
to /dev/urandom or similar (after obtaining permissions) FROM THE |
| 27 |
SAME PROCESS/SCRIPT (other ithread is okay) or, better, providing |
| 28 |
at compile time an arc4random_pushb(3)* implementation collecting |
| 29 |
entropy, sending it to a sensible place, e.g. a gathering daemon. |
| 30 |
|
| 31 |
Using a seed file, similar to the randex.pl Irssi plugin, is also |
| 32 |
a viable option. Future versions of this module will have support |
| 33 |
for seed files and entropy daemons included. |
| 34 |
|
| 35 |
*) http://www.mirbsd.org/man3/arc4random |
| 36 |
|
| 37 |
If your system's arc4random(3) function suite is not in libc, edit |
| 38 |
the LIBS line in Makefile.PL to include the appropriate library, |
| 39 |
e.g. -lbsd on Debian or -lcrypt on Interix, and possibly the INC |
| 40 |
line to use the appropriate header, e.g. something like this for |
| 41 |
Debian libbsd: '-include /usr/include/bsd/bsd.h' |
| 42 |
|
| 43 |
NOTE: This version of BSD::arc4random comes with an experimental |
| 44 |
implementation tested on BSD, Cygwin, Debian and Solaris; this is |
| 45 |
a kludge and will most likely go away. It is only used automati- |
| 46 |
cally on Debian GNU/HURD, GNU/kFreeBSD, GNU/Linux, as well as |
| 47 |
Cygwin and Solaris. It can be used on some BSDs as well; support |
| 48 |
for pushing back entropy is available on Cygwin/WIN32 and MirBSD. |
| 49 |
|
| 50 |
To install this module type the following: |
| 51 |
|
| 52 |
perl Makefile.PL |
| 53 |
make |
| 54 |
make test |
| 55 |
make install |
| 56 |
|
| 57 |
DEPENDENCIES |
| 58 |
|
| 59 |
This module requires arc4random(3), arc4random_addrandom(3) and |
| 60 |
arc4random_stir(3) in libc. There are configuration options in |
| 61 |
Makefile.PL, to change for example, if a different library like |
| 62 |
libcrypt on Interix or libbsd on Debian is required to pull in |
| 63 |
these functions. |
| 64 |
|
| 65 |
COPYRIGHT AND LICENCE |
| 66 |
|
| 67 |
Copyright (c) 2008, 2009, 2010, 2011 |
| 68 |
Thorsten "mirabilos" Glaser, MirOS Project |
| 69 |
Copyright (c) 2009 |
| 70 |
Benny Siegert, MirOS Project |
| 71 |
Uploaded to CPAN by: Sebastian "Vutral" Schwarz (PAUSE ID: SJSZ) |
| 72 |
Credits to him for input, ideas and a lot of help. |
| 73 |
The arc4random(9) PRNG has been invented by the OpenBSD Project. |
| 74 |
The arc4random_uniform algorithm is derived from the code in the |
| 75 |
OpenBSD kernel, published by Damien Miller under the ISC licence |
| 76 |
(although no code was copied, acknowledgement is granted). |
| 77 |
|
| 78 |
This module is covered by the MirOS Licence: http://mirbsd.de/MirOS-Licence |
| 79 |
|
| 80 |
________________________________________________________________________________________ |
| 81 |
$MirOS: contrib/hosted/tg/code/BSD::arc4random/README,v 1.6 2011/06/05 23:19:03 tg Exp $ |