Bug 88988

Summary: "openssl genrsa" hangs when -rand option used
Product: [Retired] Red Hat Linux Reporter: James Ralston <ralston>
Component: opensslAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: jorton
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-05-28 20:28:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description James Ralston 2003-04-16 01:55:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
The "openssl genrsa" command consistently hangs if the -rand option is used. 
Specifically, it goes into a (seemingly) never-ending malloc/read loop.

(Using the -rand option is desirable, because by default, openssl gathers
entropy from /dev/urandom instead of /dev/random.)

Version-Release number of selected component (if applicable):
openssl-0.9.7a-5
(My test system is fully up-to-date w/respect to errata updates.)

How reproducible:
Always

Steps to Reproduce:
openssl genrsa -rand /dev/urandom 1024

Actual Results:  The openssl command goes into a malloc/read loop.

Expected Results:  The openssl command should have generated a certificate to
stdout.  (Removing the "-rand /dev/urandom" yields the expected results.)

Additional info:

This occurs on both 9 and 8.0; I haven't tested earlier releases yet.

Comment 1 Joe Orton 2003-05-28 20:28:33 UTC
Yes, that would be the expected behaviour.  OpenSSL will try to seed the PRNG
with the entire contents of the file specified with the -rand option.  Since
/dev/random never returns EOF, this will never terminate.