vysheng/tg — pull request #228 by nopjmp (2014-08-15 19:06:33+00:00)
Title: check when RAND_bytes returns 0

RAND_bytes returns 0 when there was not enough entropy.

On a modern desktop this should not be a problem with all of the sources of entropy we have.

If we are on an ARM device or an older computer and just logged into a console session this will cause RAND_bytes to return 0. Most of the randomness engine OpenSSL supports will also not modify the buffer that was given to the RAND_bytes function. This leads to us using chunks of memory as our 'secure_random' function.