diff options
author | Matt Caswell <matt@openssl.org> | 2016-04-25 17:06:56 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-27 15:00:08 +0100 |
commit | ad64a69e02f7dda422d0f4f53dce7b1278715380 (patch) | |
tree | 5c76fd6da6b731a05cbd8559db71e8c821b44f36 /ssl/d1_both.c | |
parent | f3dbce6634dee43dcb0243544db05e101104fe6b (diff) | |
download | openssl-new-ad64a69e02f7dda422d0f4f53dce7b1278715380.tar.gz |
Change usage of RAND_pseudo_bytes to RAND_bytes
RAND_pseudo_bytes() allows random data to be returned even in low entropy
conditions. Sometimes this is ok. Many times it is not. For the avoidance
of any doubt, replace existing usage of RAND_pseudo_bytes() with
RAND_bytes().
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 5d26c94926..b5900dea8f 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -1469,7 +1469,7 @@ int dtls1_process_heartbeat(SSL *s) memcpy(bp, pl, payload); bp += payload; /* Random padding */ - if (RAND_pseudo_bytes(bp, padding) < 0) { + if (RAND_bytes(bp, padding) <= 0) { OPENSSL_free(buffer); return -1; } @@ -1554,11 +1554,11 @@ int dtls1_heartbeat(SSL *s) /* Sequence number */ s2n(s->tlsext_hb_seq, p); /* 16 random bytes */ - if (RAND_pseudo_bytes(p, 16) < 0) + if (RAND_bytes(p, 16) <= 0) goto err; p += 16; /* Random padding */ - if (RAND_pseudo_bytes(p, padding) < 0) + if (RAND_bytes(p, padding) <= 0) goto err; ret = dtls1_write_bytes(s, TLS1_RT_HEARTBEAT, buf, 3 + payload + padding); |