GNOME Bugzilla – Bug 593232
g_rand_new: read no more than requested from /dev/urandom
Last modified: 2009-09-08 19:44:21 UTC
Created attachment 141801 [details] [review] Turn off buffering on dev_urandom before freading it The call to fread() in g_rand_new() will result in 4096 bytes being read from /dev/urandom, although only 16 of those bytes will be used. Turning off buffering with setvbuf(3) before the call to fread() makes it read no more than requested. This improves performance a lot and saves entropy.
Created attachment 141832 [details] [review] Turn off buffering on dev_urandom before freading it No need for a size when turning buffering off.
Performance issue, so adding 'perf' keyword. Duplicate of bug #419150 really, albeit with slightly different emphasis.
*** Bug 419150 has been marked as a duplicate of this bug. ***