diff options
author | jsing <> | 2019-08-11 11:04:18 +0000 |
---|---|---|
committer | jsing <> | 2019-08-11 11:04:18 +0000 |
commit | aef380380727e6005f045b926db17dc65d46e675 (patch) | |
tree | 9e89724f288806b16eaed0d3d50667bcb47ddbc3 | |
parent | 8e1a02b0b1470213ac669256827ac9f393aaa8a7 (diff) | |
download | openbsd-aef380380727e6005f045b926db17dc65d46e675.tar.gz openbsd-aef380380727e6005f045b926db17dc65d46e675.tar.bz2 openbsd-aef380380727e6005f045b926db17dc65d46e675.zip |
Expand M_ASN1_new_of and M_ASN1_free_of macros.
-rw-r--r-- | src/lib/libcrypto/cms/cms_cd.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_dd.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_enc.c | 4 | ||||
-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 | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_pwri.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/cms/cms_sd.c | 8 |
9 files changed, 39 insertions, 39 deletions
diff --git a/src/lib/libcrypto/cms/cms_cd.c b/src/lib/libcrypto/cms/cms_cd.c index 752c808c65..ec67cf11f7 100644 --- a/src/lib/libcrypto/cms/cms_cd.c +++ b/src/lib/libcrypto/cms/cms_cd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_cd.c,v 1.14 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_cd.c,v 1.15 2019/08/11 11:04:18 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. |
@@ -84,7 +84,7 @@ cms_CompressedData_create(int comp_nid) | |||
84 | if (cms == NULL) | 84 | if (cms == NULL) |
85 | return NULL; | 85 | return NULL; |
86 | 86 | ||
87 | cd = M_ASN1_new_of(CMS_CompressedData); | 87 | cd = (CMS_CompressedData *)ASN1_item_new(&CMS_CompressedData_it); |
88 | 88 | ||
89 | if (cd == NULL) | 89 | if (cd == NULL) |
90 | goto err; | 90 | goto err; |
diff --git a/src/lib/libcrypto/cms/cms_dd.c b/src/lib/libcrypto/cms/cms_dd.c index f5295942bf..f1aafe39fe 100644 --- a/src/lib/libcrypto/cms/cms_dd.c +++ b/src/lib/libcrypto/cms/cms_dd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_dd.c,v 1.13 2019/08/11 10:50:23 jsing Exp $ */ | 1 | /* $OpenBSD: cms_dd.c,v 1.14 2019/08/11 11:04:18 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. |
@@ -74,7 +74,7 @@ cms_DigestedData_create(const EVP_MD *md) | |||
74 | if (cms == NULL) | 74 | if (cms == NULL) |
75 | return NULL; | 75 | return NULL; |
76 | 76 | ||
77 | dd = M_ASN1_new_of(CMS_DigestedData); | 77 | dd = (CMS_DigestedData *)ASN1_item_new(&CMS_DigestedData_it); |
78 | 78 | ||
79 | if (dd == NULL) | 79 | if (dd == NULL) |
80 | goto err; | 80 | goto err; |
diff --git a/src/lib/libcrypto/cms/cms_enc.c b/src/lib/libcrypto/cms/cms_enc.c index cce6e95b5e..fd2df99c6c 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.19 2019/08/11 10:54:11 jsing Exp $ */ | 1 | /* $OpenBSD: cms_enc.c,v 1.20 2019/08/11 11:04:18 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. |
@@ -234,7 +234,7 @@ CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, | |||
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | if (ciph) { | 236 | if (ciph) { |
237 | cms->d.encryptedData = M_ASN1_new_of(CMS_EncryptedData); | 237 | cms->d.encryptedData = (CMS_EncryptedData *)ASN1_item_new(&CMS_EncryptedData_it); |
238 | if (!cms->d.encryptedData) { | 238 | if (!cms->d.encryptedData) { |
239 | CMSerror(ERR_R_MALLOC_FAILURE); | 239 | CMSerror(ERR_R_MALLOC_FAILURE); |
240 | return 0; | 240 | return 0; |
diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index c1426b457b..4f1a0b1445 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.20 2019/08/11 10:43:57 jsing Exp $ */ | 1 | /* $OpenBSD: cms_env.c,v 1.21 2019/08/11 11:04:18 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. |
@@ -79,7 +79,7 @@ static CMS_EnvelopedData * | |||
79 | cms_enveloped_data_init(CMS_ContentInfo *cms) | 79 | cms_enveloped_data_init(CMS_ContentInfo *cms) |
80 | { | 80 | { |
81 | if (cms->d.other == NULL) { | 81 | if (cms->d.other == NULL) { |
82 | cms->d.envelopedData = M_ASN1_new_of(CMS_EnvelopedData); | 82 | cms->d.envelopedData = (CMS_EnvelopedData *)ASN1_item_new(&CMS_EnvelopedData_it); |
83 | if (!cms->d.envelopedData) { | 83 | if (!cms->d.envelopedData) { |
84 | CMSerror(ERR_R_MALLOC_FAILURE); | 84 | CMSerror(ERR_R_MALLOC_FAILURE); |
85 | return NULL; | 85 | return NULL; |
@@ -190,7 +190,7 @@ cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk, | |||
190 | CMS_KeyTransRecipientInfo *ktri; | 190 | CMS_KeyTransRecipientInfo *ktri; |
191 | int idtype; | 191 | int idtype; |
192 | 192 | ||
193 | ri->d.ktri = M_ASN1_new_of(CMS_KeyTransRecipientInfo); | 193 | ri->d.ktri = (CMS_KeyTransRecipientInfo *)ASN1_item_new(&CMS_KeyTransRecipientInfo_it); |
194 | if (!ri->d.ktri) | 194 | if (!ri->d.ktri) |
195 | return 0; | 195 | return 0; |
196 | ri->type = CMS_RECIPINFO_TRANS; | 196 | ri->type = CMS_RECIPINFO_TRANS; |
@@ -247,7 +247,7 @@ CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags) | |||
247 | goto err; | 247 | goto err; |
248 | 248 | ||
249 | /* Initialize recipient info */ | 249 | /* Initialize recipient info */ |
250 | ri = M_ASN1_new_of(CMS_RecipientInfo); | 250 | ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it); |
251 | if (!ri) | 251 | if (!ri) |
252 | goto merr; | 252 | goto merr; |
253 | 253 | ||
@@ -283,7 +283,7 @@ CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags) | |||
283 | merr: | 283 | merr: |
284 | CMSerror(ERR_R_MALLOC_FAILURE); | 284 | CMSerror(ERR_R_MALLOC_FAILURE); |
285 | err: | 285 | err: |
286 | M_ASN1_free_of(ri, CMS_RecipientInfo); | 286 | ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it); |
287 | return NULL; | 287 | return NULL; |
288 | } | 288 | } |
289 | 289 | ||
@@ -573,11 +573,11 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, | |||
573 | } | 573 | } |
574 | 574 | ||
575 | /* Initialize recipient info */ | 575 | /* Initialize recipient info */ |
576 | ri = M_ASN1_new_of(CMS_RecipientInfo); | 576 | ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it); |
577 | if (!ri) | 577 | if (!ri) |
578 | goto merr; | 578 | goto merr; |
579 | 579 | ||
580 | ri->d.kekri = M_ASN1_new_of(CMS_KEKRecipientInfo); | 580 | ri->d.kekri = (CMS_KEKRecipientInfo *)ASN1_item_new(&CMS_KEKRecipientInfo_it); |
581 | if (!ri->d.kekri) | 581 | if (!ri->d.kekri) |
582 | goto merr; | 582 | goto merr; |
583 | ri->type = CMS_RECIPINFO_KEK; | 583 | ri->type = CMS_RECIPINFO_KEK; |
@@ -585,7 +585,7 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, | |||
585 | kekri = ri->d.kekri; | 585 | kekri = ri->d.kekri; |
586 | 586 | ||
587 | if (otherTypeId) { | 587 | if (otherTypeId) { |
588 | kekri->kekid->other = M_ASN1_new_of(CMS_OtherKeyAttribute); | 588 | kekri->kekid->other = (CMS_OtherKeyAttribute *)ASN1_item_new(&CMS_OtherKeyAttribute_it); |
589 | if (kekri->kekid->other == NULL) | 589 | if (kekri->kekid->other == NULL) |
590 | goto merr; | 590 | goto merr; |
591 | } | 591 | } |
@@ -617,7 +617,7 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, | |||
617 | merr: | 617 | merr: |
618 | CMSerror(ERR_R_MALLOC_FAILURE); | 618 | CMSerror(ERR_R_MALLOC_FAILURE); |
619 | err: | 619 | err: |
620 | M_ASN1_free_of(ri, CMS_RecipientInfo); | 620 | ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it); |
621 | return NULL; | 621 | return NULL; |
622 | } | 622 | } |
623 | 623 | ||
diff --git a/src/lib/libcrypto/cms/cms_ess.c b/src/lib/libcrypto/cms/cms_ess.c index 223612ca43..16b7168f5f 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.19 2019/08/11 10:54:11 jsing Exp $ */ | 1 | /* $OpenBSD: cms_ess.c,v 1.20 2019/08/11 11:04:18 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. |
@@ -357,7 +357,7 @@ cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms) | |||
357 | 357 | ||
358 | err: | 358 | err: |
359 | CMS_ReceiptRequest_free(rr); | 359 | CMS_ReceiptRequest_free(rr); |
360 | M_ASN1_free_of(rct, CMS_Receipt); | 360 | ASN1_item_free((ASN1_VALUE *)rct, &CMS_Receipt_it); |
361 | return r; | 361 | return r; |
362 | } | 362 | } |
363 | 363 | ||
diff --git a/src/lib/libcrypto/cms/cms_kari.c b/src/lib/libcrypto/cms/cms_kari.c index 04bca9dce5..347304ab8c 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.10 2019/08/11 10:43:57 jsing Exp $ */ | 1 | /* $OpenBSD: cms_kari.c,v 1.11 2019/08/11 11:04:18 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. |
@@ -349,7 +349,7 @@ cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk, | |||
349 | CMS_KeyAgreeRecipientInfo *kari; | 349 | CMS_KeyAgreeRecipientInfo *kari; |
350 | CMS_RecipientEncryptedKey *rek = NULL; | 350 | CMS_RecipientEncryptedKey *rek = NULL; |
351 | 351 | ||
352 | ri->d.kari = M_ASN1_new_of(CMS_KeyAgreeRecipientInfo); | 352 | ri->d.kari = (CMS_KeyAgreeRecipientInfo *)ASN1_item_new(&CMS_KeyAgreeRecipientInfo_it); |
353 | if (!ri->d.kari) | 353 | if (!ri->d.kari) |
354 | return 0; | 354 | return 0; |
355 | ri->type = CMS_RECIPINFO_AGREE; | 355 | ri->type = CMS_RECIPINFO_AGREE; |
@@ -357,18 +357,18 @@ cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk, | |||
357 | kari = ri->d.kari; | 357 | kari = ri->d.kari; |
358 | kari->version = 3; | 358 | kari->version = 3; |
359 | 359 | ||
360 | rek = M_ASN1_new_of(CMS_RecipientEncryptedKey); | 360 | rek = (CMS_RecipientEncryptedKey *)ASN1_item_new(&CMS_RecipientEncryptedKey_it); |
361 | if (rek == NULL) | 361 | if (rek == NULL) |
362 | return 0; | 362 | return 0; |
363 | 363 | ||
364 | if (!sk_CMS_RecipientEncryptedKey_push(kari->recipientEncryptedKeys, rek)) { | 364 | if (!sk_CMS_RecipientEncryptedKey_push(kari->recipientEncryptedKeys, rek)) { |
365 | M_ASN1_free_of(rek, CMS_RecipientEncryptedKey); | 365 | ASN1_item_free((ASN1_VALUE *)rek, &CMS_RecipientEncryptedKey_it); |
366 | return 0; | 366 | return 0; |
367 | } | 367 | } |
368 | 368 | ||
369 | if (flags & CMS_USE_KEYID) { | 369 | if (flags & CMS_USE_KEYID) { |
370 | rek->rid->type = CMS_REK_KEYIDENTIFIER; | 370 | rek->rid->type = CMS_REK_KEYIDENTIFIER; |
371 | rek->rid->d.rKeyId = M_ASN1_new_of(CMS_RecipientKeyIdentifier); | 371 | rek->rid->d.rKeyId = (CMS_RecipientKeyIdentifier *)ASN1_item_new(&CMS_RecipientKeyIdentifier_it); |
372 | if (rek->rid->d.rKeyId == NULL) | 372 | if (rek->rid->d.rKeyId == NULL) |
373 | return 0; | 373 | return 0; |
374 | if (!cms_set1_keyid(&rek->rid->d.rKeyId->subjectKeyIdentifier, recip)) | 374 | if (!cms_set1_keyid(&rek->rid->d.rKeyId->subjectKeyIdentifier, recip)) |
@@ -451,7 +451,7 @@ cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) | |||
451 | if (kari->originator->type == -1) { | 451 | if (kari->originator->type == -1) { |
452 | CMS_OriginatorIdentifierOrKey *oik = kari->originator; | 452 | CMS_OriginatorIdentifierOrKey *oik = kari->originator; |
453 | oik->type = CMS_OIK_PUBKEY; | 453 | oik->type = CMS_OIK_PUBKEY; |
454 | oik->d.originatorKey = M_ASN1_new_of(CMS_OriginatorPublicKey); | 454 | oik->d.originatorKey = (CMS_OriginatorPublicKey *)ASN1_item_new(&CMS_OriginatorPublicKey_it); |
455 | if (!oik->d.originatorKey) | 455 | if (!oik->d.originatorKey) |
456 | return 0; | 456 | return 0; |
457 | } | 457 | } |
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index b022d19d4b..389bc3d06e 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms_lib.c,v 1.12 2019/08/11 10:38:27 jsing Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.13 2019/08/11 11:04:18 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. |
@@ -465,11 +465,11 @@ CMS_add0_CertificateChoices(CMS_ContentInfo *cms) | |||
465 | *pcerts = sk_CMS_CertificateChoices_new_null(); | 465 | *pcerts = sk_CMS_CertificateChoices_new_null(); |
466 | if (!*pcerts) | 466 | if (!*pcerts) |
467 | return NULL; | 467 | return NULL; |
468 | cch = M_ASN1_new_of(CMS_CertificateChoices); | 468 | cch = (CMS_CertificateChoices *)ASN1_item_new(&CMS_CertificateChoices_it); |
469 | if (!cch) | 469 | if (!cch) |
470 | return NULL; | 470 | return NULL; |
471 | if (!sk_CMS_CertificateChoices_push(*pcerts, cch)) { | 471 | if (!sk_CMS_CertificateChoices_push(*pcerts, cch)) { |
472 | M_ASN1_free_of(cch, CMS_CertificateChoices); | 472 | ASN1_item_free((ASN1_VALUE *)cch, &CMS_CertificateChoices_it); |
473 | return NULL; | 473 | return NULL; |
474 | } | 474 | } |
475 | 475 | ||
@@ -547,11 +547,11 @@ CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms) | |||
547 | *pcrls = sk_CMS_RevocationInfoChoice_new_null(); | 547 | *pcrls = sk_CMS_RevocationInfoChoice_new_null(); |
548 | if (!*pcrls) | 548 | if (!*pcrls) |
549 | return NULL; | 549 | return NULL; |
550 | rch = M_ASN1_new_of(CMS_RevocationInfoChoice); | 550 | rch = (CMS_RevocationInfoChoice *)ASN1_item_new(&CMS_RevocationInfoChoice_it); |
551 | if (!rch) | 551 | if (!rch) |
552 | return NULL; | 552 | return NULL; |
553 | if (!sk_CMS_RevocationInfoChoice_push(*pcrls, rch)) { | 553 | if (!sk_CMS_RevocationInfoChoice_push(*pcrls, rch)) { |
554 | M_ASN1_free_of(rch, CMS_RevocationInfoChoice); | 554 | ASN1_item_free((ASN1_VALUE *)rch, &CMS_RevocationInfoChoice_it); |
555 | return NULL; | 555 | return NULL; |
556 | } | 556 | } |
557 | 557 | ||
@@ -670,20 +670,20 @@ cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert) | |||
670 | { | 670 | { |
671 | CMS_IssuerAndSerialNumber *ias; | 671 | CMS_IssuerAndSerialNumber *ias; |
672 | 672 | ||
673 | ias = M_ASN1_new_of(CMS_IssuerAndSerialNumber); | 673 | ias = (CMS_IssuerAndSerialNumber *)ASN1_item_new(&CMS_IssuerAndSerialNumber_it); |
674 | if (!ias) | 674 | if (!ias) |
675 | goto err; | 675 | goto err; |
676 | if (!X509_NAME_set(&ias->issuer, X509_get_issuer_name(cert))) | 676 | if (!X509_NAME_set(&ias->issuer, X509_get_issuer_name(cert))) |
677 | goto err; | 677 | goto err; |
678 | if (!ASN1_STRING_copy(ias->serialNumber, X509_get_serialNumber(cert))) | 678 | if (!ASN1_STRING_copy(ias->serialNumber, X509_get_serialNumber(cert))) |
679 | goto err; | 679 | goto err; |
680 | M_ASN1_free_of(*pias, CMS_IssuerAndSerialNumber); | 680 | ASN1_item_free((ASN1_VALUE *)*pias, &CMS_IssuerAndSerialNumber_it); |
681 | *pias = ias; | 681 | *pias = ias; |
682 | 682 | ||
683 | return 1; | 683 | return 1; |
684 | 684 | ||
685 | err: | 685 | err: |
686 | M_ASN1_free_of(ias, CMS_IssuerAndSerialNumber); | 686 | ASN1_item_free((ASN1_VALUE *)ias, &CMS_IssuerAndSerialNumber_it); |
687 | CMSerror(ERR_R_MALLOC_FAILURE); | 687 | CMSerror(ERR_R_MALLOC_FAILURE); |
688 | 688 | ||
689 | return 0; | 689 | return 0; |
diff --git a/src/lib/libcrypto/cms/cms_pwri.c b/src/lib/libcrypto/cms/cms_pwri.c index 6423ddeaf9..ef38a3f0f4 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.24 2019/08/11 10:54:11 jsing Exp $ */ | 1 | /* $OpenBSD: cms_pwri.c,v 1.25 2019/08/11 11:04:18 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. |
@@ -158,11 +158,11 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, | |||
158 | ctx = NULL; | 158 | ctx = NULL; |
159 | 159 | ||
160 | /* Initialize recipient info */ | 160 | /* Initialize recipient info */ |
161 | ri = M_ASN1_new_of(CMS_RecipientInfo); | 161 | ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it); |
162 | if (ri == NULL) | 162 | if (ri == NULL) |
163 | goto merr; | 163 | goto merr; |
164 | 164 | ||
165 | ri->d.pwri = M_ASN1_new_of(CMS_PasswordRecipientInfo); | 165 | ri->d.pwri = (CMS_PasswordRecipientInfo *)ASN1_item_new(&CMS_PasswordRecipientInfo_it); |
166 | if (ri->d.pwri == NULL) | 166 | if (ri->d.pwri == NULL) |
167 | goto merr; | 167 | goto merr; |
168 | ri->type = CMS_RECIPINFO_PASS; | 168 | ri->type = CMS_RECIPINFO_PASS; |
@@ -206,7 +206,7 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, | |||
206 | err: | 206 | err: |
207 | EVP_CIPHER_CTX_free(ctx); | 207 | EVP_CIPHER_CTX_free(ctx); |
208 | if (ri) | 208 | if (ri) |
209 | M_ASN1_free_of(ri, CMS_RecipientInfo); | 209 | ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it); |
210 | X509_ALGOR_free(encalg); | 210 | X509_ALGOR_free(encalg); |
211 | 211 | ||
212 | return NULL; | 212 | return NULL; |
diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 5333d2c9d2..596e5f27a8 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.21 2019/08/11 10:50:23 jsing Exp $ */ | 1 | /* $OpenBSD: cms_sd.c,v 1.22 2019/08/11 11:04:18 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. |
@@ -81,7 +81,7 @@ static CMS_SignedData * | |||
81 | cms_signed_data_init(CMS_ContentInfo *cms) | 81 | cms_signed_data_init(CMS_ContentInfo *cms) |
82 | { | 82 | { |
83 | if (cms->d.other == NULL) { | 83 | if (cms->d.other == NULL) { |
84 | cms->d.signedData = M_ASN1_new_of(CMS_SignedData); | 84 | cms->d.signedData = (CMS_SignedData *)ASN1_item_new(&CMS_SignedData_it); |
85 | if (!cms->d.signedData) { | 85 | if (!cms->d.signedData) { |
86 | CMSerror(ERR_R_MALLOC_FAILURE); | 86 | CMSerror(ERR_R_MALLOC_FAILURE); |
87 | return NULL; | 87 | return NULL; |
@@ -288,7 +288,7 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, | |||
288 | sd = cms_signed_data_init(cms); | 288 | sd = cms_signed_data_init(cms); |
289 | if (!sd) | 289 | if (!sd) |
290 | goto err; | 290 | goto err; |
291 | si = M_ASN1_new_of(CMS_SignerInfo); | 291 | si = (CMS_SignerInfo *)ASN1_item_new(&CMS_SignerInfo_it); |
292 | if (!si) | 292 | if (!si) |
293 | goto merr; | 293 | goto merr; |
294 | /* Call for side-effect of computing hash and caching extensions */ | 294 | /* Call for side-effect of computing hash and caching extensions */ |
@@ -420,7 +420,7 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk, | |||
420 | merr: | 420 | merr: |
421 | CMSerror(ERR_R_MALLOC_FAILURE); | 421 | CMSerror(ERR_R_MALLOC_FAILURE); |
422 | err: | 422 | err: |
423 | M_ASN1_free_of(si, CMS_SignerInfo); | 423 | ASN1_item_free((ASN1_VALUE *)si, &CMS_SignerInfo_it); |
424 | 424 | ||
425 | return NULL; | 425 | return NULL; |
426 | } | 426 | } |