aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12/p12_mutl.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/pkcs12/p12_mutl.c')
-rw-r--r--crypto/pkcs12/p12_mutl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index 3cb782fa60..f1094b3840 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -156,7 +156,10 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
- if (!salt) RAND_bytes (p12->mac->salt->data, saltlen);
+ if (!salt) {
+ if (RAND_bytes (p12->mac->salt->data, saltlen) <= 0)
+ return 0;
+ }
else memcpy (p12->mac->salt->data, salt, saltlen);
p12->mac->dinfo->algor->algorithm = OBJ_nid2obj(EVP_MD_type(md_type));
if (!(p12->mac->dinfo->algor->parameter = ASN1_TYPE_new())) {