diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_enc.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_env.c | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_ess.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_kari.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_sd.c | 20 |
6 files changed, 33 insertions, 33 deletions
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index a04c831f95..a032c801f5 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_enc.c,v 1.15 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_enc.c,v 1.16 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. |
| @@ -128,7 +128,7 @@ cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
| 128 | tkeylen = EVP_CIPHER_CTX_key_length(ctx); | 128 | tkeylen = EVP_CIPHER_CTX_key_length(ctx); |
| 129 | /* Generate random session key */ | 129 | /* Generate random session key */ |
| 130 | if (!enc || !ec->key) { | 130 | if (!enc || !ec->key) { |
| 131 | tkey = OPENSSL_malloc(tkeylen); | 131 | tkey = malloc(tkeylen); |
| 132 | if (tkey == NULL) { | 132 | if (tkey == NULL) { |
| 133 | CMSerror(ERR_R_MALLOC_FAILURE); | 133 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 134 | goto err; | 134 | goto err; |
| @@ -209,7 +209,7 @@ cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, | |||
| 209 | { | 209 | { |
| 210 | ec->cipher = cipher; | 210 | ec->cipher = cipher; |
| 211 | if (key) { | 211 | if (key) { |
| 212 | if ((ec->key = OPENSSL_malloc(keylen)) == NULL) { | 212 | if ((ec->key = malloc(keylen)) == NULL) { |
| 213 | CMSerror(ERR_R_MALLOC_FAILURE); | 213 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 214 | return 0; | 214 | return 0; |
| 215 | } | 215 | } |
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; |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index 1d3f092ae8..d488297c87 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_ess.c,v 1.16 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_ess.c,v 1.17 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. |
| @@ -172,7 +172,7 @@ CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) | |||
| 172 | if (!r) | 172 | if (!r) |
| 173 | CMSerror(ERR_R_MALLOC_FAILURE); | 173 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 174 | 174 | ||
| 175 | OPENSSL_free(rrder); | 175 | free(rrder); |
| 176 | 176 | ||
| 177 | return r; | 177 | return r; |
| 178 | } | 178 | } |
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c index e1f22cc43a..19513e3658 100644 --- a/src/lib/libcrypto/cms/cms_kari.c +++ b/src/lib/libcrypto/cms/cms_kari.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_kari.c,v 1.7 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_kari.c,v 1.8 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. |
| @@ -256,7 +256,7 @@ cms_kek_cipher(unsigned char **pout, size_t *poutlen, const unsigned char *in, | |||
| 256 | /* obtain output length of ciphered key */ | 256 | /* obtain output length of ciphered key */ |
| 257 | if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen)) | 257 | if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen)) |
| 258 | goto err; | 258 | goto err; |
| 259 | out = OPENSSL_malloc(outlen); | 259 | out = malloc(outlen); |
| 260 | if (out == NULL) | 260 | if (out == NULL) |
| 261 | goto err; | 261 | goto err; |
| 262 | if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen)) | 262 | if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen)) |
| @@ -268,7 +268,7 @@ cms_kek_cipher(unsigned char **pout, size_t *poutlen, const unsigned char *in, | |||
| 268 | err: | 268 | err: |
| 269 | OPENSSL_cleanse(kek, keklen); | 269 | OPENSSL_cleanse(kek, keklen); |
| 270 | if (!rv) | 270 | if (!rv) |
| 271 | OPENSSL_free(out); | 271 | free(out); |
| 272 | EVP_CIPHER_CTX_reset(kari->ctx); | 272 | EVP_CIPHER_CTX_reset(kari->ctx); |
| 273 | /* FIXME: WHY IS kari->pctx freed here? /RL */ | 273 | /* FIXME: WHY IS kari->pctx freed here? /RL */ |
| 274 | EVP_PKEY_CTX_free(kari->pctx); | 274 | EVP_PKEY_CTX_free(kari->pctx); |
| @@ -303,7 +303,7 @@ CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 303 | rv = 1; | 303 | rv = 1; |
| 304 | 304 | ||
| 305 | err: | 305 | err: |
| 306 | OPENSSL_free(cek); | 306 | free(cek); |
| 307 | 307 | ||
| 308 | return rv; | 308 | return rv; |
| 309 | } | 309 | } |
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index dd66541409..30c5ce0618 100644 --- a/src/lib/libcrypto/cms/cms_pwri.c +++ b/src/lib/libcrypto/cms/cms_pwri.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_pwri.c,v 1.20 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.21 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. |
| @@ -232,7 +232,7 @@ kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, | |||
| 232 | /* Invalid size */ | 232 | /* Invalid size */ |
| 233 | return 0; | 233 | return 0; |
| 234 | } | 234 | } |
| 235 | if ((tmp = OPENSSL_malloc(inlen)) == NULL) { | 235 | if ((tmp = malloc(inlen)) == NULL) { |
| 236 | CMSerror(ERR_R_MALLOC_FAILURE); | 236 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 237 | return 0; | 237 | return 0; |
| 238 | } | 238 | } |
| @@ -391,7 +391,7 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 391 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, kekctx)) | 391 | if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, kekctx)) |
| 392 | goto err; | 392 | goto err; |
| 393 | 393 | ||
| 394 | key = OPENSSL_malloc(keylen); | 394 | key = malloc(keylen); |
| 395 | if (key == NULL) | 395 | if (key == NULL) |
| 396 | goto err; | 396 | goto err; |
| 397 | 397 | ||
| @@ -400,7 +400,7 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 400 | pwri->encryptedKey->data = key; | 400 | pwri->encryptedKey->data = key; |
| 401 | pwri->encryptedKey->length = keylen; | 401 | pwri->encryptedKey->length = keylen; |
| 402 | } else { | 402 | } else { |
| 403 | key = OPENSSL_malloc(pwri->encryptedKey->length); | 403 | key = malloc(pwri->encryptedKey->length); |
| 404 | if (key == NULL) { | 404 | if (key == NULL) { |
| 405 | CMSerror(ERR_R_MALLOC_FAILURE); | 405 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 406 | goto err; | 406 | goto err; |
| @@ -421,7 +421,7 @@ cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, | |||
| 421 | err: | 421 | err: |
| 422 | EVP_CIPHER_CTX_free(kekctx); | 422 | EVP_CIPHER_CTX_free(kekctx); |
| 423 | if (!r) | 423 | if (!r) |
| 424 | OPENSSL_free(key); | 424 | free(key); |
| 425 | X509_ALGOR_free(kekalg); | 425 | X509_ALGOR_free(kekalg); |
| 426 | 426 | ||
| 427 | return r; | 427 | return r; |
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 7072ce7dac..0681bf2759 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_sd.c,v 1.19 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_sd.c,v 1.20 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. |
| @@ -650,13 +650,13 @@ cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMS_SignerInfo *si, BIO *chain | |||
| 650 | if (!EVP_DigestFinal_ex(mctx, md, &mdlen)) | 650 | if (!EVP_DigestFinal_ex(mctx, md, &mdlen)) |
| 651 | goto err; | 651 | goto err; |
| 652 | siglen = EVP_PKEY_size(si->pkey); | 652 | siglen = EVP_PKEY_size(si->pkey); |
| 653 | sig = OPENSSL_malloc(siglen); | 653 | sig = malloc(siglen); |
| 654 | if (sig == NULL) { | 654 | if (sig == NULL) { |
| 655 | CMSerror(ERR_R_MALLOC_FAILURE); | 655 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 656 | goto err; | 656 | goto err; |
| 657 | } | 657 | } |
| 658 | if (EVP_PKEY_sign(pctx, sig, &siglen, md, mdlen) <= 0) { | 658 | if (EVP_PKEY_sign(pctx, sig, &siglen, md, mdlen) <= 0) { |
| 659 | OPENSSL_free(sig); | 659 | free(sig); |
| 660 | goto err; | 660 | goto err; |
| 661 | } | 661 | } |
| 662 | ASN1_STRING_set0(si->signature, sig, siglen); | 662 | ASN1_STRING_set0(si->signature, sig, siglen); |
| @@ -664,14 +664,14 @@ cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMS_SignerInfo *si, BIO *chain | |||
| 664 | unsigned char *sig; | 664 | unsigned char *sig; |
| 665 | unsigned int siglen; | 665 | unsigned int siglen; |
| 666 | 666 | ||
| 667 | sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); | 667 | sig = malloc(EVP_PKEY_size(si->pkey)); |
| 668 | if (sig == NULL) { | 668 | if (sig == NULL) { |
| 669 | CMSerror(ERR_R_MALLOC_FAILURE); | 669 | CMSerror(ERR_R_MALLOC_FAILURE); |
| 670 | goto err; | 670 | goto err; |
| 671 | } | 671 | } |
| 672 | if (!EVP_SignFinal(mctx, sig, &siglen, si->pkey)) { | 672 | if (!EVP_SignFinal(mctx, sig, &siglen, si->pkey)) { |
| 673 | CMSerror(CMS_R_SIGNFINAL_ERROR); | 673 | CMSerror(CMS_R_SIGNFINAL_ERROR); |
| 674 | OPENSSL_free(sig); | 674 | free(sig); |
| 675 | goto err; | 675 | goto err; |
| 676 | } | 676 | } |
| 677 | ASN1_STRING_set0(si->signature, sig, siglen); | 677 | ASN1_STRING_set0(si->signature, sig, siglen); |
| @@ -746,8 +746,8 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
| 746 | goto err; | 746 | goto err; |
| 747 | if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0) | 747 | if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0) |
| 748 | goto err; | 748 | goto err; |
| 749 | OPENSSL_free(abuf); | 749 | free(abuf); |
| 750 | abuf = OPENSSL_malloc(siglen); | 750 | abuf = malloc(siglen); |
| 751 | if (abuf == NULL) | 751 | if (abuf == NULL) |
| 752 | goto err; | 752 | goto err; |
| 753 | if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0) | 753 | if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0) |
| @@ -766,7 +766,7 @@ CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
| 766 | return 1; | 766 | return 1; |
| 767 | 767 | ||
| 768 | err: | 768 | err: |
| 769 | OPENSSL_free(abuf); | 769 | free(abuf); |
| 770 | EVP_MD_CTX_reset(mctx); | 770 | EVP_MD_CTX_reset(mctx); |
| 771 | 771 | ||
| 772 | return 0; | 772 | return 0; |
| @@ -804,7 +804,7 @@ CMS_SignerInfo_verify(CMS_SignerInfo *si) | |||
| 804 | if (!abuf) | 804 | if (!abuf) |
| 805 | goto err; | 805 | goto err; |
| 806 | r = EVP_DigestVerifyUpdate(mctx, abuf, alen); | 806 | r = EVP_DigestVerifyUpdate(mctx, abuf, alen); |
| 807 | OPENSSL_free(abuf); | 807 | free(abuf); |
| 808 | if (r <= 0) { | 808 | if (r <= 0) { |
| 809 | r = -1; | 809 | r = -1; |
| 810 | goto err; | 810 | goto err; |
| @@ -941,7 +941,7 @@ CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) | |||
| 941 | return 0; | 941 | return 0; |
| 942 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, | 942 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, |
| 943 | V_ASN1_SEQUENCE, smder, smderlen); | 943 | V_ASN1_SEQUENCE, smder, smderlen); |
| 944 | OPENSSL_free(smder); | 944 | free(smder); |
| 945 | 945 | ||
| 946 | return r; | 946 | return r; |
| 947 | } | 947 | } |
