+20030317
+ - (djm) Fix return value checks for RAND_bytes. Report from 
+   Steve G <linux_4ever@yahoo.com>
+
 20030315
  - (djm) OpenBSD CVS Sync
    - markus@cvs.openbsd.org 2003/03/13 11:42:19
      save auth method before monitor_reset_key_state(); bugzilla bug #284;
      ok provos@
 
-$Id: ChangeLog,v 1.2629 2003/03/15 00:37:09 djm Exp $
+$Id: ChangeLog,v 1.2630 2003/03/17 05:13:53 djm Exp $
 
 #include "includes.h"
 #include "log.h"
 
-RCSID("$Id: bsd-arc4random.c,v 1.5 2002/05/08 22:57:18 tim Exp $");
+RCSID("$Id: bsd-arc4random.c,v 1.6 2003/03/17 05:13:53 djm Exp $");
 
 #ifndef HAVE_ARC4RANDOM
 
        unsigned char rand_buf[SEED_SIZE];
 
        memset(&rc4, 0, sizeof(rc4));
-       if (!RAND_bytes(rand_buf, sizeof(rand_buf)))
+       if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0)
                fatal("Couldn't obtain random bytes (error %ld)",
                    ERR_get_error());
        RC4_set_key(&rc4, sizeof(rand_buf), rand_buf);
 
 #include "pathnames.h"
 #include "log.h"
 
-RCSID("$Id: ssh-rand-helper.c,v 1.9 2002/10/21 00:13:37 djm Exp $");
+RCSID("$Id: ssh-rand-helper.c,v 1.10 2003/03/17 05:13:53 djm Exp $");
 
 /* Number of bytes we write out */
 #define OUTPUT_SEED_SIZE       48
 
        debug("writing PRNG seed to file %.100s", filename);
 
-       RAND_bytes(seed, sizeof(seed));
+       if (RAND_bytes(seed, sizeof(seed)) <= 0)
+               fatal("PRNG seed extration failed");
 
        /* Don't care if the seed doesn't exist */
        prng_check_seedfile(filename);
        if (!RAND_status())
                fatal("Not enough entropy in RNG");
 
-       RAND_bytes(buf, bytes);
+       if (RAND_bytes(buf, bytes) <= 0)
+               fatal("Couldn't extract entropy from PRNG");
 
        if (output_hex) {
                for(ret = 0; ret < bytes; ret++)