diff options
Diffstat (limited to 'src/lib/libcrypto/cms')
-rw-r--r-- | src/lib/libcrypto/cms/cms_asn1.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_enc.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_env.c | 20 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_ess.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_sd.c | 14 |
6 files changed, 30 insertions, 30 deletions
diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c index cfe67fb6c1..bd7466cc1d 100644 --- a/src/lib/libcrypto/cms/cms_asn1.c +++ b/src/lib/libcrypto/cms/cms_asn1.c | |||
@@ -234,7 +234,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
234 | if (kekri->key) | 234 | if (kekri->key) |
235 | { | 235 | { |
236 | OPENSSL_cleanse(kekri->key, kekri->keylen); | 236 | OPENSSL_cleanse(kekri->key, kekri->keylen); |
237 | OPENSSL_free(kekri->key); | 237 | free(kekri->key); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | else if (ri->type == CMS_RECIPINFO_PASS) | 240 | else if (ri->type == CMS_RECIPINFO_PASS) |
@@ -243,7 +243,7 @@ static int cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | |||
243 | if (pwri->pass) | 243 | if (pwri->pass) |
244 | { | 244 | { |
245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); | 245 | OPENSSL_cleanse(pwri->pass, pwri->passlen); |
246 | OPENSSL_free(pwri->pass); | 246 | free(pwri->pass); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index bebeaf29c7..612fce6dde 100644 --- a/src/lib/libcrypto/cms/cms_enc.c +++ b/src/lib/libcrypto/cms/cms_enc.c | |||
@@ -143,7 +143,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
143 | /* Generate random session key */ | 143 | /* Generate random session key */ |
144 | if (!enc || !ec->key) | 144 | if (!enc || !ec->key) |
145 | { | 145 | { |
146 | tkey = OPENSSL_malloc(tkeylen); | 146 | tkey = malloc(tkeylen); |
147 | if (!tkey) | 147 | if (!tkey) |
148 | { | 148 | { |
149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, | 149 | CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO, |
@@ -184,7 +184,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
184 | { | 184 | { |
185 | /* Use random key */ | 185 | /* Use random key */ |
186 | OPENSSL_cleanse(ec->key, ec->keylen); | 186 | OPENSSL_cleanse(ec->key, ec->keylen); |
187 | OPENSSL_free(ec->key); | 187 | free(ec->key); |
188 | ec->key = tkey; | 188 | ec->key = tkey; |
189 | ec->keylen = tkeylen; | 189 | ec->keylen = tkeylen; |
190 | tkey = NULL; | 190 | tkey = NULL; |
@@ -222,13 +222,13 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) | |||
222 | if (ec->key && !keep_key) | 222 | if (ec->key && !keep_key) |
223 | { | 223 | { |
224 | OPENSSL_cleanse(ec->key, ec->keylen); | 224 | OPENSSL_cleanse(ec->key, ec->keylen); |
225 | OPENSSL_free(ec->key); | 225 | free(ec->key); |
226 | ec->key = NULL; | 226 | ec->key = NULL; |
227 | } | 227 | } |
228 | if (tkey) | 228 | if (tkey) |
229 | { | 229 | { |
230 | OPENSSL_cleanse(tkey, tkeylen); | 230 | OPENSSL_cleanse(tkey, tkeylen); |
231 | OPENSSL_free(tkey); | 231 | free(tkey); |
232 | } | 232 | } |
233 | if (ok) | 233 | if (ok) |
234 | return b; | 234 | return b; |
@@ -243,7 +243,7 @@ int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, | |||
243 | ec->cipher = cipher; | 243 | ec->cipher = cipher; |
244 | if (key) | 244 | if (key) |
245 | { | 245 | { |
246 | ec->key = OPENSSL_malloc(keylen); | 246 | ec->key = malloc(keylen); |
247 | if (!ec->key) | 247 | if (!ec->key) |
248 | return 0; | 248 | return 0; |
249 | memcpy(ec->key, key, keylen); | 249 | memcpy(ec->key, key, keylen); |
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index be20b1c024..78fa2aa7b7 100644 --- a/src/lib/libcrypto/cms/cms_env.c +++ b/src/lib/libcrypto/cms/cms_env.c | |||
@@ -334,7 +334,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) | 334 | if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0) |
335 | goto err; | 335 | goto err; |
336 | 336 | ||
337 | ek = OPENSSL_malloc(eklen); | 337 | ek = malloc(eklen); |
338 | 338 | ||
339 | if (ek == NULL) | 339 | if (ek == NULL) |
340 | { | 340 | { |
@@ -355,7 +355,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, | |||
355 | if (pctx) | 355 | if (pctx) |
356 | EVP_PKEY_CTX_free(pctx); | 356 | EVP_PKEY_CTX_free(pctx); |
357 | if (ek) | 357 | if (ek) |
358 | OPENSSL_free(ek); | 358 | free(ek); |
359 | return ret; | 359 | return ret; |
360 | 360 | ||
361 | } | 361 | } |
@@ -399,7 +399,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
399 | ktri->encryptedKey->length) <= 0) | 399 | ktri->encryptedKey->length) <= 0) |
400 | goto err; | 400 | goto err; |
401 | 401 | ||
402 | ek = OPENSSL_malloc(eklen); | 402 | ek = malloc(eklen); |
403 | 403 | ||
404 | if (ek == NULL) | 404 | if (ek == NULL) |
405 | { | 405 | { |
@@ -421,7 +421,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
421 | if (ec->key) | 421 | if (ec->key) |
422 | { | 422 | { |
423 | OPENSSL_cleanse(ec->key, ec->keylen); | 423 | OPENSSL_cleanse(ec->key, ec->keylen); |
424 | OPENSSL_free(ec->key); | 424 | free(ec->key); |
425 | } | 425 | } |
426 | 426 | ||
427 | ec->key = ek; | 427 | ec->key = ek; |
@@ -431,7 +431,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, | |||
431 | if (pctx) | 431 | if (pctx) |
432 | EVP_PKEY_CTX_free(pctx); | 432 | EVP_PKEY_CTX_free(pctx); |
433 | if (!ret && ek) | 433 | if (!ret && ek) |
434 | OPENSSL_free(ek); | 434 | free(ek); |
435 | 435 | ||
436 | return ret; | 436 | return ret; |
437 | } | 437 | } |
@@ -671,7 +671,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
671 | goto err; | 671 | goto err; |
672 | } | 672 | } |
673 | 673 | ||
674 | wkey = OPENSSL_malloc(ec->keylen + 8); | 674 | wkey = malloc(ec->keylen + 8); |
675 | 675 | ||
676 | if (!wkey) | 676 | if (!wkey) |
677 | { | 677 | { |
@@ -695,7 +695,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, | |||
695 | err: | 695 | err: |
696 | 696 | ||
697 | if (!r && wkey) | 697 | if (!r && wkey) |
698 | OPENSSL_free(wkey); | 698 | free(wkey); |
699 | OPENSSL_cleanse(&actx, sizeof(actx)); | 699 | OPENSSL_cleanse(&actx, sizeof(actx)); |
700 | 700 | ||
701 | return r; | 701 | return r; |
@@ -748,7 +748,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
748 | goto err; | 748 | goto err; |
749 | } | 749 | } |
750 | 750 | ||
751 | ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8); | 751 | ukey = malloc(kekri->encryptedKey->length - 8); |
752 | 752 | ||
753 | if (!ukey) | 753 | if (!ukey) |
754 | { | 754 | { |
@@ -776,7 +776,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, | |||
776 | err: | 776 | err: |
777 | 777 | ||
778 | if (!r && ukey) | 778 | if (!r && ukey) |
779 | OPENSSL_free(ukey); | 779 | free(ukey); |
780 | OPENSSL_cleanse(&actx, sizeof(actx)); | 780 | OPENSSL_cleanse(&actx, sizeof(actx)); |
781 | 781 | ||
782 | return r; | 782 | return r; |
@@ -864,7 +864,7 @@ BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) | |||
864 | if (ec->key) | 864 | if (ec->key) |
865 | { | 865 | { |
866 | OPENSSL_cleanse(ec->key, ec->keylen); | 866 | OPENSSL_cleanse(ec->key, ec->keylen); |
867 | OPENSSL_free(ec->key); | 867 | free(ec->key); |
868 | ec->key = NULL; | 868 | ec->key = NULL; |
869 | ec->keylen = 0; | 869 | ec->keylen = 0; |
870 | } | 870 | } |
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index 90c0b82fb5..99a4da6356 100644 --- a/src/lib/libcrypto/cms/cms_ess.c +++ b/src/lib/libcrypto/cms/cms_ess.c | |||
@@ -157,7 +157,7 @@ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) | |||
157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); | 157 | CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); |
158 | 158 | ||
159 | if (rrder) | 159 | if (rrder) |
160 | OPENSSL_free(rrder); | 160 | free(rrder); |
161 | 161 | ||
162 | return r; | 162 | return r; |
163 | 163 | ||
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; |
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 77fbd13596..d852af596d 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c | |||
@@ -658,7 +658,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
658 | { | 658 | { |
659 | unsigned char *sig; | 659 | unsigned char *sig; |
660 | unsigned int siglen; | 660 | unsigned int siglen; |
661 | sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); | 661 | sig = malloc(EVP_PKEY_size(si->pkey)); |
662 | if (!sig) | 662 | if (!sig) |
663 | { | 663 | { |
664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 664 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
@@ -669,7 +669,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, | |||
669 | { | 669 | { |
670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, | 670 | CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, |
671 | CMS_R_SIGNFINAL_ERROR); | 671 | CMS_R_SIGNFINAL_ERROR); |
672 | OPENSSL_free(sig); | 672 | free(sig); |
673 | goto err; | 673 | goto err; |
674 | } | 674 | } |
675 | ASN1_STRING_set0(si->signature, sig, siglen); | 675 | ASN1_STRING_set0(si->signature, sig, siglen); |
@@ -738,8 +738,8 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
738 | goto err; | 738 | goto err; |
739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) | 739 | if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0) |
740 | goto err; | 740 | goto err; |
741 | OPENSSL_free(abuf); | 741 | free(abuf); |
742 | abuf = OPENSSL_malloc(siglen); | 742 | abuf = malloc(siglen); |
743 | if(!abuf) | 743 | if(!abuf) |
744 | goto err; | 744 | goto err; |
745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) | 745 | if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0) |
@@ -760,7 +760,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) | |||
760 | 760 | ||
761 | err: | 761 | err: |
762 | if (abuf) | 762 | if (abuf) |
763 | OPENSSL_free(abuf); | 763 | free(abuf); |
764 | EVP_MD_CTX_cleanup(&mctx); | 764 | EVP_MD_CTX_cleanup(&mctx); |
765 | return 0; | 765 | return 0; |
766 | 766 | ||
@@ -792,7 +792,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) | |||
792 | if(!abuf) | 792 | if(!abuf) |
793 | goto err; | 793 | goto err; |
794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); | 794 | r = EVP_DigestVerifyUpdate(&mctx, abuf, alen); |
795 | OPENSSL_free(abuf); | 795 | free(abuf); |
796 | if (r <= 0) | 796 | if (r <= 0) |
797 | { | 797 | { |
798 | r = -1; | 798 | r = -1; |
@@ -917,7 +917,7 @@ int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs) | |||
917 | return 0; | 917 | return 0; |
918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, | 918 | r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities, |
919 | V_ASN1_SEQUENCE, smder, smderlen); | 919 | V_ASN1_SEQUENCE, smder, smderlen); |
920 | OPENSSL_free(smder); | 920 | free(smder); |
921 | return r; | 921 | return r; |
922 | } | 922 | } |
923 | 923 | ||