summaryrefslogtreecommitdiff
path: root/lib/libcrypto/cms
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2019-08-11 11:04:19 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2019-08-11 11:04:19 +0000
commita2e95b793494a19d5a13a759109cba2d125e49f8 (patch)
treeac85c9cbb5af29b298068ffa0a58d6917b3a0b2c /lib/libcrypto/cms
parenta305bbb7b677912997f24af19a240634503eca03 (diff)
Expand M_ASN1_new_of and M_ASN1_free_of macros.
Diffstat (limited to 'lib/libcrypto/cms')
-rw-r--r--lib/libcrypto/cms/cms_cd.c4
-rw-r--r--lib/libcrypto/cms/cms_dd.c4
-rw-r--r--lib/libcrypto/cms/cms_enc.c4
-rw-r--r--lib/libcrypto/cms/cms_env.c18
-rw-r--r--lib/libcrypto/cms/cms_ess.c4
-rw-r--r--lib/libcrypto/cms/cms_kari.c12
-rw-r--r--lib/libcrypto/cms/cms_lib.c16
-rw-r--r--lib/libcrypto/cms/cms_pwri.c8
-rw-r--r--lib/libcrypto/cms/cms_sd.c8
9 files changed, 39 insertions, 39 deletions
diff --git a/lib/libcrypto/cms/cms_cd.c b/lib/libcrypto/cms/cms_cd.c
index 752c808c655..ec67cf11f7a 100644
--- a/lib/libcrypto/cms/cms_cd.c
+++ b/lib/libcrypto/cms/cms_cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_cd.c,v 1.14 2019/08/11 10:38:27 jsing Exp $ */
+/* $OpenBSD: cms_cd.c,v 1.15 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -84,7 +84,7 @@ cms_CompressedData_create(int comp_nid)
if (cms == NULL)
return NULL;
- cd = M_ASN1_new_of(CMS_CompressedData);
+ cd = (CMS_CompressedData *)ASN1_item_new(&CMS_CompressedData_it);
if (cd == NULL)
goto err;
diff --git a/lib/libcrypto/cms/cms_dd.c b/lib/libcrypto/cms/cms_dd.c
index f5295942bf2..f1aafe39fe7 100644
--- a/lib/libcrypto/cms/cms_dd.c
+++ b/lib/libcrypto/cms/cms_dd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_dd.c,v 1.13 2019/08/11 10:50:23 jsing Exp $ */
+/* $OpenBSD: cms_dd.c,v 1.14 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -74,7 +74,7 @@ cms_DigestedData_create(const EVP_MD *md)
if (cms == NULL)
return NULL;
- dd = M_ASN1_new_of(CMS_DigestedData);
+ dd = (CMS_DigestedData *)ASN1_item_new(&CMS_DigestedData_it);
if (dd == NULL)
goto err;
diff --git a/lib/libcrypto/cms/cms_enc.c b/lib/libcrypto/cms/cms_enc.c
index cce6e95b5e4..fd2df99c6c1 100644
--- a/lib/libcrypto/cms/cms_enc.c
+++ b/lib/libcrypto/cms/cms_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_enc.c,v 1.19 2019/08/11 10:54:11 jsing Exp $ */
+/* $OpenBSD: cms_enc.c,v 1.20 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -234,7 +234,7 @@ CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
return 0;
}
if (ciph) {
- cms->d.encryptedData = M_ASN1_new_of(CMS_EncryptedData);
+ cms->d.encryptedData = (CMS_EncryptedData *)ASN1_item_new(&CMS_EncryptedData_it);
if (!cms->d.encryptedData) {
CMSerror(ERR_R_MALLOC_FAILURE);
return 0;
diff --git a/lib/libcrypto/cms/cms_env.c b/lib/libcrypto/cms/cms_env.c
index c1426b457bb..4f1a0b14458 100644
--- a/lib/libcrypto/cms/cms_env.c
+++ b/lib/libcrypto/cms/cms_env.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_env.c,v 1.20 2019/08/11 10:43:57 jsing Exp $ */
+/* $OpenBSD: cms_env.c,v 1.21 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -79,7 +79,7 @@ static CMS_EnvelopedData *
cms_enveloped_data_init(CMS_ContentInfo *cms)
{
if (cms->d.other == NULL) {
- cms->d.envelopedData = M_ASN1_new_of(CMS_EnvelopedData);
+ cms->d.envelopedData = (CMS_EnvelopedData *)ASN1_item_new(&CMS_EnvelopedData_it);
if (!cms->d.envelopedData) {
CMSerror(ERR_R_MALLOC_FAILURE);
return NULL;
@@ -190,7 +190,7 @@ cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk,
CMS_KeyTransRecipientInfo *ktri;
int idtype;
- ri->d.ktri = M_ASN1_new_of(CMS_KeyTransRecipientInfo);
+ ri->d.ktri = (CMS_KeyTransRecipientInfo *)ASN1_item_new(&CMS_KeyTransRecipientInfo_it);
if (!ri->d.ktri)
return 0;
ri->type = CMS_RECIPINFO_TRANS;
@@ -247,7 +247,7 @@ CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags)
goto err;
/* Initialize recipient info */
- ri = M_ASN1_new_of(CMS_RecipientInfo);
+ ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it);
if (!ri)
goto merr;
@@ -283,7 +283,7 @@ CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags)
merr:
CMSerror(ERR_R_MALLOC_FAILURE);
err:
- M_ASN1_free_of(ri, CMS_RecipientInfo);
+ ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it);
return NULL;
}
@@ -573,11 +573,11 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key,
}
/* Initialize recipient info */
- ri = M_ASN1_new_of(CMS_RecipientInfo);
+ ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it);
if (!ri)
goto merr;
- ri->d.kekri = M_ASN1_new_of(CMS_KEKRecipientInfo);
+ ri->d.kekri = (CMS_KEKRecipientInfo *)ASN1_item_new(&CMS_KEKRecipientInfo_it);
if (!ri->d.kekri)
goto merr;
ri->type = CMS_RECIPINFO_KEK;
@@ -585,7 +585,7 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key,
kekri = ri->d.kekri;
if (otherTypeId) {
- kekri->kekid->other = M_ASN1_new_of(CMS_OtherKeyAttribute);
+ kekri->kekid->other = (CMS_OtherKeyAttribute *)ASN1_item_new(&CMS_OtherKeyAttribute_it);
if (kekri->kekid->other == NULL)
goto merr;
}
@@ -617,7 +617,7 @@ CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key,
merr:
CMSerror(ERR_R_MALLOC_FAILURE);
err:
- M_ASN1_free_of(ri, CMS_RecipientInfo);
+ ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it);
return NULL;
}
diff --git a/lib/libcrypto/cms/cms_ess.c b/lib/libcrypto/cms/cms_ess.c
index 223612ca438..16b7168f5fb 100644
--- a/lib/libcrypto/cms/cms_ess.c
+++ b/lib/libcrypto/cms/cms_ess.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_ess.c,v 1.19 2019/08/11 10:54:11 jsing Exp $ */
+/* $OpenBSD: cms_ess.c,v 1.20 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -357,7 +357,7 @@ cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms)
err:
CMS_ReceiptRequest_free(rr);
- M_ASN1_free_of(rct, CMS_Receipt);
+ ASN1_item_free((ASN1_VALUE *)rct, &CMS_Receipt_it);
return r;
}
diff --git a/lib/libcrypto/cms/cms_kari.c b/lib/libcrypto/cms/cms_kari.c
index 04bca9dce59..347304ab8c5 100644
--- a/lib/libcrypto/cms/cms_kari.c
+++ b/lib/libcrypto/cms/cms_kari.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_kari.c,v 1.10 2019/08/11 10:43:57 jsing Exp $ */
+/* $OpenBSD: cms_kari.c,v 1.11 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -349,7 +349,7 @@ cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk,
CMS_KeyAgreeRecipientInfo *kari;
CMS_RecipientEncryptedKey *rek = NULL;
- ri->d.kari = M_ASN1_new_of(CMS_KeyAgreeRecipientInfo);
+ ri->d.kari = (CMS_KeyAgreeRecipientInfo *)ASN1_item_new(&CMS_KeyAgreeRecipientInfo_it);
if (!ri->d.kari)
return 0;
ri->type = CMS_RECIPINFO_AGREE;
@@ -357,18 +357,18 @@ cms_RecipientInfo_kari_init(CMS_RecipientInfo *ri, X509 *recip, EVP_PKEY *pk,
kari = ri->d.kari;
kari->version = 3;
- rek = M_ASN1_new_of(CMS_RecipientEncryptedKey);
+ rek = (CMS_RecipientEncryptedKey *)ASN1_item_new(&CMS_RecipientEncryptedKey_it);
if (rek == NULL)
return 0;
if (!sk_CMS_RecipientEncryptedKey_push(kari->recipientEncryptedKeys, rek)) {
- M_ASN1_free_of(rek, CMS_RecipientEncryptedKey);
+ ASN1_item_free((ASN1_VALUE *)rek, &CMS_RecipientEncryptedKey_it);
return 0;
}
if (flags & CMS_USE_KEYID) {
rek->rid->type = CMS_REK_KEYIDENTIFIER;
- rek->rid->d.rKeyId = M_ASN1_new_of(CMS_RecipientKeyIdentifier);
+ rek->rid->d.rKeyId = (CMS_RecipientKeyIdentifier *)ASN1_item_new(&CMS_RecipientKeyIdentifier_it);
if (rek->rid->d.rKeyId == NULL)
return 0;
if (!cms_set1_keyid(&rek->rid->d.rKeyId->subjectKeyIdentifier, recip))
@@ -451,7 +451,7 @@ cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
if (kari->originator->type == -1) {
CMS_OriginatorIdentifierOrKey *oik = kari->originator;
oik->type = CMS_OIK_PUBKEY;
- oik->d.originatorKey = M_ASN1_new_of(CMS_OriginatorPublicKey);
+ oik->d.originatorKey = (CMS_OriginatorPublicKey *)ASN1_item_new(&CMS_OriginatorPublicKey_it);
if (!oik->d.originatorKey)
return 0;
}
diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c
index b022d19d4b2..389bc3d06e8 100644
--- a/lib/libcrypto/cms/cms_lib.c
+++ b/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_lib.c,v 1.12 2019/08/11 10:38:27 jsing Exp $ */
+/* $OpenBSD: cms_lib.c,v 1.13 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -465,11 +465,11 @@ CMS_add0_CertificateChoices(CMS_ContentInfo *cms)
*pcerts = sk_CMS_CertificateChoices_new_null();
if (!*pcerts)
return NULL;
- cch = M_ASN1_new_of(CMS_CertificateChoices);
+ cch = (CMS_CertificateChoices *)ASN1_item_new(&CMS_CertificateChoices_it);
if (!cch)
return NULL;
if (!sk_CMS_CertificateChoices_push(*pcerts, cch)) {
- M_ASN1_free_of(cch, CMS_CertificateChoices);
+ ASN1_item_free((ASN1_VALUE *)cch, &CMS_CertificateChoices_it);
return NULL;
}
@@ -547,11 +547,11 @@ CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms)
*pcrls = sk_CMS_RevocationInfoChoice_new_null();
if (!*pcrls)
return NULL;
- rch = M_ASN1_new_of(CMS_RevocationInfoChoice);
+ rch = (CMS_RevocationInfoChoice *)ASN1_item_new(&CMS_RevocationInfoChoice_it);
if (!rch)
return NULL;
if (!sk_CMS_RevocationInfoChoice_push(*pcrls, rch)) {
- M_ASN1_free_of(rch, CMS_RevocationInfoChoice);
+ ASN1_item_free((ASN1_VALUE *)rch, &CMS_RevocationInfoChoice_it);
return NULL;
}
@@ -670,20 +670,20 @@ cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert)
{
CMS_IssuerAndSerialNumber *ias;
- ias = M_ASN1_new_of(CMS_IssuerAndSerialNumber);
+ ias = (CMS_IssuerAndSerialNumber *)ASN1_item_new(&CMS_IssuerAndSerialNumber_it);
if (!ias)
goto err;
if (!X509_NAME_set(&ias->issuer, X509_get_issuer_name(cert)))
goto err;
if (!ASN1_STRING_copy(ias->serialNumber, X509_get_serialNumber(cert)))
goto err;
- M_ASN1_free_of(*pias, CMS_IssuerAndSerialNumber);
+ ASN1_item_free((ASN1_VALUE *)*pias, &CMS_IssuerAndSerialNumber_it);
*pias = ias;
return 1;
err:
- M_ASN1_free_of(ias, CMS_IssuerAndSerialNumber);
+ ASN1_item_free((ASN1_VALUE *)ias, &CMS_IssuerAndSerialNumber_it);
CMSerror(ERR_R_MALLOC_FAILURE);
return 0;
diff --git a/lib/libcrypto/cms/cms_pwri.c b/lib/libcrypto/cms/cms_pwri.c
index 6423ddeaf94..ef38a3f0f4d 100644
--- a/lib/libcrypto/cms/cms_pwri.c
+++ b/lib/libcrypto/cms/cms_pwri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_pwri.c,v 1.24 2019/08/11 10:54:11 jsing Exp $ */
+/* $OpenBSD: cms_pwri.c,v 1.25 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -158,11 +158,11 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid,
ctx = NULL;
/* Initialize recipient info */
- ri = M_ASN1_new_of(CMS_RecipientInfo);
+ ri = (CMS_RecipientInfo *)ASN1_item_new(&CMS_RecipientInfo_it);
if (ri == NULL)
goto merr;
- ri->d.pwri = M_ASN1_new_of(CMS_PasswordRecipientInfo);
+ ri->d.pwri = (CMS_PasswordRecipientInfo *)ASN1_item_new(&CMS_PasswordRecipientInfo_it);
if (ri->d.pwri == NULL)
goto merr;
ri->type = CMS_RECIPINFO_PASS;
@@ -206,7 +206,7 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid,
err:
EVP_CIPHER_CTX_free(ctx);
if (ri)
- M_ASN1_free_of(ri, CMS_RecipientInfo);
+ ASN1_item_free((ASN1_VALUE *)ri, &CMS_RecipientInfo_it);
X509_ALGOR_free(encalg);
return NULL;
diff --git a/lib/libcrypto/cms/cms_sd.c b/lib/libcrypto/cms/cms_sd.c
index 5333d2c9d2e..596e5f27a8b 100644
--- a/lib/libcrypto/cms/cms_sd.c
+++ b/lib/libcrypto/cms/cms_sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms_sd.c,v 1.21 2019/08/11 10:50:23 jsing Exp $ */
+/* $OpenBSD: cms_sd.c,v 1.22 2019/08/11 11:04:18 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -81,7 +81,7 @@ static CMS_SignedData *
cms_signed_data_init(CMS_ContentInfo *cms)
{
if (cms->d.other == NULL) {
- cms->d.signedData = M_ASN1_new_of(CMS_SignedData);
+ cms->d.signedData = (CMS_SignedData *)ASN1_item_new(&CMS_SignedData_it);
if (!cms->d.signedData) {
CMSerror(ERR_R_MALLOC_FAILURE);
return NULL;
@@ -288,7 +288,7 @@ CMS_add1_signer(CMS_ContentInfo *cms, X509 *signer, EVP_PKEY *pk,
sd = cms_signed_data_init(cms);
if (!sd)
goto err;
- si = M_ASN1_new_of(CMS_SignerInfo);
+ si = (CMS_SignerInfo *)ASN1_item_new(&CMS_SignerInfo_it);
if (!si)
goto merr;
/* 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,
merr:
CMSerror(ERR_R_MALLOC_FAILURE);
err:
- M_ASN1_free_of(si, CMS_SignerInfo);
+ ASN1_item_free((ASN1_VALUE *)si, &CMS_SignerInfo_it);
return NULL;
}