Security Fixes for Libgcrypt and GnuPG 1.4
lists.gnupg.org
lists.gnupg.org
You'll notice that there are no tests with this commit, and no tests on other commits for the same feature. You can conclude from this that there are no tests at all for correct CSPRNG operation.
Matthew Green has more on this here: http://blog.cryptographyengineering.com/2014/03/how-do-you-k... ('Known Answer Tests (KATs)' section).
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commi...
If you look at random.c before this commit, what it did previously is either return bytes read from /dev/urandom or /dev/random (which is fine) or some fall-back code that used the awful standard C rand(3).
I'd guess that at the time there were some crappy UNIXes that didn't have a working /dev/random, so they wanted to make the fall-back less awful, and accidentally broke the "working" case at the same time? Hazards of writing portable code...
[1] http://seclists.org/oss-sec/2016/q3/260 (fetched 07:16:12 21 August 2016 UTC)