aboutsummaryrefslogtreecommitdiff
path: root/crypto/pkcs12
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-09-05 17:21:38 -0400
committerRich Salz <rsalz@openssl.org>2017-09-06 09:52:16 -0400
commitd3c3dfc5778ab2cca0d25c5959c8b814a334addb (patch)
tree30a8881804bdc1fe38e0d61bc282fd0e8976c81b /crypto/pkcs12
parentfa4b82cc7cc556c03c652d40bd966ef3d4445592 (diff)
downloadopenssl-d3c3dfc5778ab2cca0d25c5959c8b814a334addb.zip
openssl-d3c3dfc5778ab2cca0d25c5959c8b814a334addb.tar.gz
openssl-d3c3dfc5778ab2cca0d25c5959c8b814a334addb.tar.bz2
Add checks for alloc failing.
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4341)
Diffstat (limited to 'crypto/pkcs12')
-rw-r--r--crypto/pkcs12/p12_mutl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index 899a12e..a9e2202 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -124,8 +124,8 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
PKCS12err(PKCS12_F_PKCS12_GEN_MAC, PKCS12_R_KEY_GEN_ERROR);
return 0;
}
- hmac = HMAC_CTX_new();
- if (!HMAC_Init_ex(hmac, key, md_size, md_type, NULL)
+ if ((hmac = HMAC_CTX_new()) == NULL
+ || !HMAC_Init_ex(hmac, key, md_size, md_type, NULL)
|| !HMAC_Update(hmac, p12->authsafes->d.data->data,
p12->authsafes->d.data->length)
|| !HMAC_Final(hmac, mac, maclen)) {