Red Hat Bugzilla – Bug 165036
openssl rand doesn't exit
Last modified: 2007-11-30 17:07:19 EST
If you run 'openssl rand -rand /dev/urandom -out /tmp/some.file 2048', then
openssl will chew up 100% and never exit. From an strace, it seems to be
continually reading from /dev/urandom.
If you run 'openssl rand -out /tmp/some.file 2048', then it runs without a problem.
That's perfectly fine, because the -rand option means to read a file as a seed
to the random generator. So it tries to read the whole file and seed it into the
rng. However /dev/urandom is not a regular file but a device which can be read
forever so it openssl does it because it doesn't distinguish between a file an a
If you want to obtain 2048 random bytes use 'dd if=/dev/urandom
of=/tmp/some.file count=1 bs=2048'