aboutsummaryrefslogtreecommitdiff
path: root/crypto/pem
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-01-21 01:15:56 +0000
committerUlf Möller <ulf@openssl.org>2000-01-21 01:15:56 +0000
commite7f97e2d22e386df60c8da63277727a931bf22b7 (patch)
tree45c42494189d95fada508ac3ff806dee37c00d22 /crypto/pem
parent731d9c5fb5d0535e3c84866e3c355cbf21a92a67 (diff)
downloadopenssl-e7f97e2d22e386df60c8da63277727a931bf22b7.zip
openssl-e7f97e2d22e386df60c8da63277727a931bf22b7.tar.gz
openssl-e7f97e2d22e386df60c8da63277727a931bf22b7.tar.bz2
Check RAND_bytes() return value or use RAND_pseudo_bytes().
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index 449a1fe..49aeb62 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -379,7 +379,8 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
kstr=(unsigned char *)buf;
}
RAND_add(data,i,0);/* put in the RSA key. */
- RAND_bytes(iv,8); /* Generate a salt */
+ if (RAND_bytes(iv,8) <= 0) /* Generate a salt */
+ goto err;
/* The 'iv' is used as the iv and as a salt. It is
* NOT taken from the BytesToKey function */
EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL);