diff options
author | Ulf Möller <ulf@openssl.org> | 2000-01-21 02:15:56 +0100 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2000-01-21 02:15:56 +0100 |
commit | e7f97e2d22e386df60c8da63277727a931bf22b7 (patch) | |
tree | 45c42494189d95fada508ac3ff806dee37c00d22 /crypto/pkcs12/p12_mutl.c | |
parent | Some more ifdefs for no-xxx options. (diff) | |
download | openssl-e7f97e2d22e386df60c8da63277727a931bf22b7.tar.xz openssl-e7f97e2d22e386df60c8da63277727a931bf22b7.zip |
Check RAND_bytes() return value or use RAND_pseudo_bytes().
Diffstat (limited to 'crypto/pkcs12/p12_mutl.c')
-rw-r--r-- | crypto/pkcs12/p12_mutl.c | 5 |
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())) { |