diff options
author | ache <ache@FreeBSD.org> | 1997-03-23 23:08:31 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-03-23 23:08:31 +0000 |
commit | d2a19efd66e804cee2a49139b9a5d92a51183d90 (patch) | |
tree | be943b02844712d4cb9c2e08093e814b9833f27d | |
parent | e53bc8d1c316d0e53f980c38c17873378cabd4ce (diff) | |
download | FreeBSD-src-d2a19efd66e804cee2a49139b9a5d92a51183d90.zip FreeBSD-src-d2a19efd66e804cee2a49139b9a5d92a51183d90.tar.gz |
Add srandomdev() description
-rw-r--r-- | lib/libc/stdlib/random.3 | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3 index fed15b4..bced4aa 100644 --- a/lib/libc/stdlib/random.3 +++ b/lib/libc/stdlib/random.3 @@ -37,6 +37,7 @@ .Sh NAME .Nm random , .Nm srandom , +.Nm srandomdev , .Nm initstate , .Nm setstate .Nd better random number generator; routines for changing generators @@ -46,6 +47,8 @@ .Fn random void .Ft void .Fn srandom "unsigned long seed" +.Ft int +.Fn srandomdev void .Ft char * .Fn initstate "unsigned long seed" "char *state" "long n" .Ft char * @@ -93,6 +96,25 @@ with as the seed. .Pp The +.Fn srandomdev +routine initialize a state array using +.Xr urandom 4 +random number device which returns good random numbers, +suitable for cryptographic use. +Note that this particular seeding +procedure can generate states which are impossible to reproduce by +calling +.Fn srandom +with any value, since the succeeding terms in the +state buffer are no longer derived from the LC algorithm applied to +a fixed seed. +If successful +.Fn srandomdev +returns 0. It returns -1 on failure, and sets +.Va errno +to indicate the error. +.Pp +The .Fn initstate routine allows a state array, passed in as an argument, to be initialized for future use. The size of the state array (in bytes) is used by @@ -155,7 +177,8 @@ detects that the state information has been garbled, error messages are printed on the standard error output. .Sh SEE ALSO .Xr rand 3 , -.Xr srand 3 +.Xr srand 3 , +.Xr urandom 4 .Sh HISTORY These functions appeared in |