11

I am creating an application which runs on a mobile node with Ubuntu, which does not generate enough entropy bytes to the /dev/random, and does not always stay connected on the Internet to use typical socket entropy-gathering solutions such as EGD.

Are there any good tools for gathering the needed entropy in my situation?

Just to clarify, trying to get 1024 bytes (which seems to be the recommended value by the OpenSSL book) via /dev/random took nearly two hours...

AviD
  • 72,138
  • 22
  • 136
  • 218
efr4k
  • 497
  • 3
  • 13

1 Answers1

14

The proper way is to use /dev/urandom, not /dev/random. There are very few cryptographic algorithm for which /dev/random is even theoretically better than /dev/urandom (this would be information-theoretic secure algorithms, not mundane things like AES or RSA). /dev/urandom produces randomness of cryptographic quality provided that it could get at some point at least 20 bytes or so of "true randomness", something which the OS took care of during installation. /dev/urandom happily extends that initial seed into megabytes of pseudo-alea which is computationally indistinguishable from true randomness (that's all you need), and it will never block.

Thomas Pornin
  • 320,799
  • 57
  • 780
  • 949
  • Thanks, this at least worked. If someone has anything to add regarding the strength/entropy of the bytes produced I would apreciate it, as it only seems to be (at least) 20 byte entropy to me (from your statement?) – efr4k Apr 23 '11 at 13:54