summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_pwri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cms/cms_pwri.c')
-rw-r--r--src/lib/libcrypto/cms/cms_pwri.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c
index b79612a12d..36a5db04b8 100644
--- a/src/lib/libcrypto/cms/cms_pwri.c
+++ b/src/lib/libcrypto/cms/cms_pwri.c
@@ -237,7 +237,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
237 /* Invalid size */ 237 /* Invalid size */
238 return 0; 238 return 0;
239 } 239 }
240 tmp = OPENSSL_malloc(inlen); 240 tmp = malloc(inlen);
241 /* setup IV by decrypting last two blocks */ 241 /* setup IV by decrypting last two blocks */
242 EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, 242 EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
243 in + inlen - 2 * blocklen, blocklen * 2); 243 in + inlen - 2 * blocklen, blocklen * 2);
@@ -270,7 +270,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
270 rv = 1; 270 rv = 1;
271 err: 271 err:
272 OPENSSL_cleanse(tmp, inlen); 272 OPENSSL_cleanse(tmp, inlen);
273 OPENSSL_free(tmp); 273 free(tmp);
274 return rv; 274 return rv;
275 275
276 } 276 }
@@ -405,7 +405,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
405 if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx)) 405 if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx))
406 goto err; 406 goto err;
407 407
408 key = OPENSSL_malloc(keylen); 408 key = malloc(keylen);
409 409
410 if (!key) 410 if (!key)
411 goto err; 411 goto err;
@@ -417,7 +417,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
417 } 417 }
418 else 418 else
419 { 419 {
420 key = OPENSSL_malloc(pwri->encryptedKey->length); 420 key = malloc(pwri->encryptedKey->length);
421 421
422 if (!key) 422 if (!key)
423 { 423 {
@@ -446,7 +446,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
446 EVP_CIPHER_CTX_cleanup(&kekctx); 446 EVP_CIPHER_CTX_cleanup(&kekctx);
447 447
448 if (!r && key) 448 if (!r && key)
449 OPENSSL_free(key); 449 free(key);
450 X509_ALGOR_free(kekalg); 450 X509_ALGOR_free(kekalg);
451 451
452 return r; 452 return r;