Bug 165036

Summary: openssl rand doesn't exit
Product: Red Hat Enterprise Linux 4 Reporter: Sean Dilda <agrajag>
Component: opensslAssignee: Tomas Mraz <tmraz>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-08-03 19:20:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sean Dilda 2005-08-03 18:58:49 UTC
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.

Comment 1 Tomas Mraz 2005-08-03 19:20:29 UTC
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
device.

If you want to obtain 2048 random bytes use 'dd if=/dev/urandom
of=/tmp/some.file count=1 bs=2048'