FreeBSD Bugzilla – Attachment 170525 Details for
Bug 209616
[ndis][patch] compat/ndis rand() doesn't respect the seed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Attempt to do proper seeding (take 3)
ndis-seed.diff (text/plain), 661 bytes, created by
Pedro F. Giffuni
on 2016-05-21 01:05:42 UTC
(
hide
)
Description:
Attempt to do proper seeding (take 3)
Filename:
MIME Type:
Creator:
Pedro F. Giffuni
Created:
2016-05-21 01:05:42 UTC
Size:
661 bytes
patch
obsolete
>Index: sys/compat/ndis/subr_ntoskrnl.c >=================================================================== >--- sys/compat/ndis/subr_ntoskrnl.c (revision 300300) >+++ sys/compat/ndis/subr_ntoskrnl.c (working copy) >@@ -3185,20 +3185,24 @@ > return strtol(str, (char **)NULL, 10); > } > >+static unsigned int ntos_seed; >+ > static int > rand(void) > { >- struct timeval tv; > >- microtime(&tv); >- srandom(tv.tv_usec); >- return ((int)random()); >+ if (ntos_seed == 0) { >+ ntos_seed = arc4random(); >+ srandom(ntos_seed); >+ } >+ return (random()); > } > > static void >-srand(seed) >- unsigned int seed; >+srand(unsigned int seed) > { >+ >+ ntos_seed = seed; > srandom(seed); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209616
:
170453
|
170455
|
170525
|
170529