summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-25 17:06:56 +0100
committerMatt Caswell <matt@openssl.org>2016-06-27 15:00:08 +0100
commitad64a69e02f7dda422d0f4f53dce7b1278715380 (patch)
tree5c76fd6da6b731a05cbd8559db71e8c821b44f36 /crypto/pem
parentf3dbce6634dee43dcb0243544db05e101104fe6b (diff)
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 'crypto/pem')
-rw-r--r--crypto/pem/pem_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index ac4faae047..c82b3c0ae2 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -393,7 +393,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
}
RAND_add(data, i, 0); /* put in the RSA key. */
OPENSSL_assert(enc->iv_len <= (int)sizeof(iv));
- if (RAND_pseudo_bytes(iv, enc->iv_len) < 0) /* Generate a salt */
+ if (RAND_bytes(iv, enc->iv_len) <= 0) /* Generate a salt */
goto err;
/*
* The 'iv' is used as the iv and as a salt. It is NOT taken from