Hi,

while testing the new EGD support, I found some bugs.
crypto/rand_egd.c:98
The first byte returned is the number of bytes granted. This number can
be 0, when the egd-pool is drained, so that the following read blocks.
To reproduce, run "openssl genrsa -out somekey.pem -rand /var/run/egd-pool 1024"
several times in a fast sequence.
        if (read(fd, buf, 1) != 1) goto err;
+       if (buf[0] == 0) goto err;
        num = read(fd, buf, 255);
Of course, the returned buf[0] value must match the later returned "num" value,
but what should we do if it does not match instead of using "num" anyway? :-)

apps/app_rand.c, app_RAND_load_files() (is it a bug or a feature? :-)
When specifying a non-existant random-source, like "-rand /does/not/exist"
RAND_EGD() will return "-1", while RAND_load_file() will return "0":
        tot+=RAND_egd(n);
        tot+=RAND_load_file(n,1024L*1024L);
Hence, "tot" will yield "-1":
ws01 222: ./openssl genrsa -out somekey.pem -rand /does/not/exist
-1 semi-random bytes loaded
Generating RSA private key, 512 bit long modulus
...

Best regards,
        Lutz
-- 
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to