aboutsummaryrefslogtreecommitdiff
path: root/crypto/pkcs12
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/pkcs12
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/pkcs12')
-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 3cb782f..f1094b3 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())) {