diff options
author | Matt Caswell <matt@openssl.org> | 2015-02-26 11:57:37 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-03-25 12:38:07 +0000 |
commit | 266483d2f56b0764849797f31866bfd84f9c3aa8 (patch) | |
tree | 42323d0c8b8cea8da4aff3dfdd4bc2251e34a0db /crypto/bio/bf_nbio.c | |
parent | 8817e2e0c998757d3bd036d7f45fe8d0a49fbe2d (diff) | |
download | openssl-new-266483d2f56b0764849797f31866bfd84f9c3aa8.tar.gz |
RAND_bytes updates
Ensure RAND_bytes return value is checked correctly, and that we no longer
use RAND_pseudo_bytes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bio/bf_nbio.c')
-rw-r--r-- | crypto/bio/bf_nbio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index 3af58bd38f..0ba6055e07 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -136,7 +136,8 @@ static int nbiof_read(BIO *b, char *out, int outl) return (0); BIO_clear_retry_flags(b); - RAND_pseudo_bytes(&n, 1); + if (RAND_bytes(&n, 1) <= 0) + return -1; num = (n & 0x07); if (outl > num) @@ -172,7 +173,8 @@ static int nbiof_write(BIO *b, const char *in, int inl) num = nt->lwn; nt->lwn = 0; } else { - RAND_pseudo_bytes(&n, 1); + if (RAND_bytes(&n, 1) <= 0) + return -1; num = (n & 7); } |