summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_lib.c
diff options
context:
space:
mode:
authorjsing <>2019-08-11 11:04:18 +0000
committerjsing <>2019-08-11 11:04:18 +0000
commitaef380380727e6005f045b926db17dc65d46e675 (patch)
tree9e89724f288806b16eaed0d3d50667bcb47ddbc3 /src/lib/libcrypto/cms/cms_lib.c
parent8e1a02b0b1470213ac669256827ac9f393aaa8a7 (diff)
downloadopenbsd-aef380380727e6005f045b926db17dc65d46e675.tar.gz
openbsd-aef380380727e6005f045b926db17dc65d46e675.tar.bz2
openbsd-aef380380727e6005f045b926db17dc65d46e675.zip
Expand M_ASN1_new_of and M_ASN1_free_of macros.
Diffstat (limited to 'src/lib/libcrypto/cms/cms_lib.c')
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c16
1 files changed, 8 insertions, 8 deletions
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;