Re: [PATCH] rand.c updates from FreeBSD RELENG_5

看板DFBSD_submit作者時間21年前 (2004/05/17 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串18/18 (看更多)
This is a multi-part message in MIME format. --------------080005090601020804020202 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Matthew Dillon wrote: > :I have redone the rand.3 patch and attached it. I tested it against > :what is currently in DFly's CVS and did not witness any problems. Let > :me know how it goes. > : > :Thanks again, > :Mike > > Whoop, I was all ready to commit this but then noticed that, in fact, > you attached rand.c rather then rand.3. > > If you could repost your cleaned up rand.3 I'll be able to finally get > this in the tree. Note to self: lack of sleep == bad. I have attached the appropriate patch now. I hope everything is golden now :-) --Mike --------------080005090601020804020202 Content-Type: text/plain; name="rand.3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rand.3.patch" --- rand.3 2004-05-13 16:29:35.000000000 -0500 +++ rand.3.new 2004-05-12 15:51:53.000000000 -0500 @@ -34,7 +34,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)rand.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdlib/rand.3,v 1.4.2.5 2001/12/14 18:33:58 ru Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/rand.3,v 1.14 2003/09/08 19:57:15 ru Exp $ .\" $DragonFly: src/lib/libc/stdlib/rand.3,v 1.2 2003/06/17 04:26:46 dillon Exp $ .\" .Dd May 25, 1999 @@ -43,6 +43,7 @@ .Sh NAME .Nm rand , .Nm srand , +.Nm sranddev , .Nm rand_r .Nd bad random number generator .Sh LIBRARY @@ -51,6 +52,8 @@ .In stdlib.h .Ft void .Fn srand "unsigned seed" +.Ft void +.Fn sranddev void .Ft int .Fn rand void .Ft int @@ -67,7 +70,7 @@ of 0 to .Dv RAND_MAX (as defined by the header file -.Aq Pa stdlib.h ) . +.In stdlib.h ) . .Pp The .Fn srand @@ -85,14 +88,24 @@ value is provided, the functions are automatically seeded with a value of 1. .Pp +The +.Fn sranddev +function initializes a seed using the +.Xr random 4 +random number device which returns good random numbers, +suitable for cryptographic use. +.Pp +The .Fn rand_r +function provides the same functionality as .Fn rand . A pointer to the context value .Fa ctx must be supplied by the caller. .Sh SEE ALSO -.Xr random 3 +.Xr random 3 , +.Xr random 4 .Sh STANDARDS The .Fn rand --------------080005090601020804020202--
文章代碼(AID): #10g8QP00 (DFBSD_submit)
討論串 (同標題文章)
文章代碼(AID): #10g8QP00 (DFBSD_submit)