aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/p5_pbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/p5_pbe.c')
-rw-r--r--crypto/asn1/p5_pbe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/asn1/p5_pbe.c b/crypto/asn1/p5_pbe.c
index adb92e5fd0..8cda4f609a 100644
--- a/crypto/asn1/p5_pbe.c
+++ b/crypto/asn1/p5_pbe.c
@@ -129,7 +129,8 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
}
pbe->salt->length = saltlen;
if (salt) memcpy (pbe->salt->data, salt, saltlen);
- else RAND_bytes (pbe->salt->data, saltlen);
+ else if (RAND_bytes (pbe->salt->data, saltlen) <= 0)
+ return NULL;
if (!(astype = ASN1_TYPE_new())) {
ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);