Add a prominent warning about these functions' unsuitability for

cryptographic purposes, and recommend using arc4random(3) instead.
This commit is contained in:
Dag-Erling Smørgrav 2012-09-04 21:40:53 +00:00
parent 22a5e6b972
commit edab57e04e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240107
2 changed files with 17 additions and 13 deletions

View File

@ -55,9 +55,15 @@
.Fn rand_r "unsigned *ctx"
.Sh DESCRIPTION
.Bf -symbolic
The functions described in this manual page are not cryptographically
secure.
Cryptographic applications should use
.Xr arc4random 3
instead.
.Ef
.Pp
These interfaces are obsoleted by
.Xr random 3 .
.Ef
.Pp
The
.Fn rand
@ -88,9 +94,6 @@ The
function initializes a seed using the
.Xr random 4
random number device which returns good random numbers.
However, the
.Fn rand
function still remains unsuitable for cryptographic use.
.Pp
The
.Fn rand_r
@ -105,8 +108,6 @@ For better generator quality, use
.Xr random 3
or
.Xr lrand48 3 .
Applications requiring cryptographic quality randomness should use
.Xr arc4random 3 .
.Sh SEE ALSO
.Xr arc4random 3 ,
.Xr lrand48 3 ,

View File

@ -53,6 +53,14 @@
.Ft char *
.Fn setstate "char *state"
.Sh DESCRIPTION
.Bf -symbolic
The functions described in this manual page are not cryptographically
secure.
Cryptographic applications should use
.Xr arc4random 3
instead.
.Ef
.Pp
The
.Fn random
function
@ -98,10 +106,8 @@ as the seed.
.Pp
The
.Fn srandomdev
routine initializes a state array using the
.Xr random 4
random number device which returns good random numbers,
suitable for cryptographic use.
routine initializes a state array using data from
.Xr random 4 .
Note that this particular seeding
procedure can generate states which are impossible to reproduce by
calling
@ -191,6 +197,3 @@ The historical implementation used to have a very weak seeding; the
random sequence did not vary much with the seed.
The current implementation employs a better pseudo-random number
generator for the initial state calculation.
.Pp
Applications requiring cryptographic quality randomness should use
.Xr arc4random 3 .