summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cms/cms_env.c')
-rw-r--r--src/lib/libcrypto/cms/cms_env.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c
index d6bf34c02a..38d6b5649c 100644
--- a/src/lib/libcrypto/cms/cms_env.c
+++ b/src/lib/libcrypto/cms/cms_env.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_env.c,v 1.17 2019/08/11 10:38:27 jsing Exp $ */ 1/* $OpenBSD: cms_env.c,v 1.18 2019/08/11 10:41:49 jsing Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -392,7 +392,7 @@ cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
392 if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) 392 if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0)
393 goto err; 393 goto err;
394 394
395 ek = OPENSSL_malloc(eklen); 395 ek = malloc(eklen);
396 396
397 if (ek == NULL) { 397 if (ek == NULL) {
398 CMSerror(ERR_R_MALLOC_FAILURE); 398 CMSerror(ERR_R_MALLOC_FAILURE);
@@ -410,7 +410,7 @@ cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
410 err: 410 err:
411 EVP_PKEY_CTX_free(pctx); 411 EVP_PKEY_CTX_free(pctx);
412 ktri->pctx = NULL; 412 ktri->pctx = NULL;
413 OPENSSL_free(ek); 413 free(ek);
414 414
415 return ret; 415 return ret;
416} 416}
@@ -454,7 +454,7 @@ cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
454 ktri->encryptedKey->length) <= 0) 454 ktri->encryptedKey->length) <= 0)
455 goto err; 455 goto err;
456 456
457 ek = OPENSSL_malloc(eklen); 457 ek = malloc(eklen);
458 458
459 if (ek == NULL) { 459 if (ek == NULL) {
460 CMSerror(ERR_R_MALLOC_FAILURE); 460 CMSerror(ERR_R_MALLOC_FAILURE);
@@ -477,7 +477,7 @@ cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
477 EVP_PKEY_CTX_free(ktri->pctx); 477 EVP_PKEY_CTX_free(ktri->pctx);
478 ktri->pctx = NULL; 478 ktri->pctx = NULL;
479 if (!ret) 479 if (!ret)
480 OPENSSL_free(ek); 480 free(ek);
481 481
482 return ret; 482 return ret;
483} 483}
@@ -697,7 +697,7 @@ cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
697 goto err; 697 goto err;
698 } 698 }
699 699
700 wkey = OPENSSL_malloc(ec->keylen + 8); 700 wkey = malloc(ec->keylen + 8);
701 if (wkey == NULL) { 701 if (wkey == NULL) {
702 CMSerror(ERR_R_MALLOC_FAILURE); 702 CMSerror(ERR_R_MALLOC_FAILURE);
703 goto err; 703 goto err;
@@ -715,7 +715,7 @@ cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
715 715
716 err: 716 err:
717 if (!r) 717 if (!r)
718 OPENSSL_free(wkey); 718 free(wkey);
719 OPENSSL_cleanse(&actx, sizeof(actx)); 719 OPENSSL_cleanse(&actx, sizeof(actx));
720 720
721 return r; 721 return r;
@@ -759,7 +759,7 @@ cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
759 goto err; 759 goto err;
760 } 760 }
761 761
762 ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8); 762 ukey = malloc(kekri->encryptedKey->length - 8);
763 if (ukey == NULL) { 763 if (ukey == NULL) {
764 CMSerror(ERR_R_MALLOC_FAILURE); 764 CMSerror(ERR_R_MALLOC_FAILURE);
765 goto err; 765 goto err;
@@ -781,7 +781,7 @@ cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
781 err: 781 err:
782 782
783 if (!r) 783 if (!r)
784 OPENSSL_free(ukey); 784 free(ukey);
785 OPENSSL_cleanse(&actx, sizeof(actx)); 785 OPENSSL_cleanse(&actx, sizeof(actx));
786 786
787 return r; 787 return r;