Recently I was writing a PERL script that uses openssl to encrypt
an email message.  The script executes the following command and
pipes the body of the message to the command's standard input:

    openssl smime -subject 'subject' -encrypt /path/to/cert.pem > outfile

The above command produces the following error message:

    unable to write 'random state'

According to some documentation I was reading, the error message
occurs when openssl is attempting to access the "default seeding
file" (/dev/urandom, or /dev/random if /dev/urandom does not exist).

I downloaded the source code, searched for the error message,
and found that app_RAND_write_file() prints this message when it
calls RAND_write_file() and receives a return value indicating an
error.  Looking at RAND_write_file(), I see that it is generating
random bytes and writing them to the default seeding file.  Why is
it doing this?  On the machine that I am executing on, /dev/urandom
and /dev/random both exist.  However I do not have write permission
on these files (and therefore I get the error message).  Since I
don't have root privileges, I can't chmod() /dev/urandom or
/dev/random to make the error message go away.

Is there a workaround that will prevent openssl from failing with
this error message?  Any ideas or suggestions are greatly appreciated.

Thanks,
Dave Peterson
[EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to