summaryrefslogtreecommitdiffstats
path: root/crypto/cms/cms_pwri.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/cms/cms_pwri.c')
-rw-r--r--crypto/cms/cms_pwri.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c
index 0571bb8026..28f2a1c3c8 100644
--- a/crypto/cms/cms_pwri.c
+++ b/crypto/cms/cms_pwri.c
@@ -188,9 +188,10 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
/* Invalid size */
return 0;
}
- tmp = OPENSSL_malloc(inlen);
- if (tmp == NULL)
+ if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
+ CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
return 0;
+ }
/* setup IV by decrypting last two blocks */
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2)