summaryrefslogtreecommitdiff
path: root/lib/libcrypto/cms/cms_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/cms/cms_lib.c')
-rw-r--r--lib/libcrypto/cms/cms_lib.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c
index 7f02d6daae8..b022d19d4b2 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.11 2019/08/11 10:15:30 jsing Exp $ */
+/* $OpenBSD: cms_lib.c,v 1.12 2019/08/11 10:38:27 jsing Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
@@ -144,7 +144,7 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont)
else
cont = cms_content_bio(cms);
if (!cont) {
- CMSerr(CMS_F_CMS_DATAINIT, CMS_R_NO_CONTENT);
+ CMSerror(CMS_R_NO_CONTENT);
return NULL;
}
switch (OBJ_obj2nid(cms->contentType)) {
@@ -174,7 +174,7 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont)
break;
default:
- CMSerr(CMS_F_CMS_DATAINIT, CMS_R_UNSUPPORTED_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_TYPE);
return NULL;
}
@@ -201,7 +201,7 @@ CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
long contlen;
mbio = BIO_find_type(cmsbio, BIO_TYPE_MEM);
if (!mbio) {
- CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_CONTENT_NOT_FOUND);
+ CMSerror(CMS_R_CONTENT_NOT_FOUND);
return 0;
}
contlen = BIO_get_mem_data(mbio, &cont);
@@ -228,7 +228,7 @@ CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
return cms_DigestedData_do_final(cms, cmsbio, 0);
default:
- CMSerr(CMS_F_CMS_DATAFINAL, CMS_R_UNSUPPORTED_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_TYPE);
return 0;
}
}
@@ -266,7 +266,7 @@ CMS_get0_content(CMS_ContentInfo *cms)
default:
if (cms->d.other->type == V_ASN1_OCTET_STRING)
return &cms->d.other->value.octet_string;
- CMSerr(CMS_F_CMS_GET0_CONTENT, CMS_R_UNSUPPORTED_CONTENT_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_CONTENT_TYPE);
return NULL;
}
}
@@ -299,7 +299,7 @@ cms_get0_econtent_type(CMS_ContentInfo *cms)
return &cms->d.compressedData->encapContentInfo->eContentType;
default:
- CMSerr(CMS_F_CMS_GET0_ECONTENT_TYPE, CMS_R_UNSUPPORTED_CONTENT_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_CONTENT_TYPE);
return NULL;
}
}
@@ -371,7 +371,7 @@ CMS_set_detached(CMS_ContentInfo *cms, int detached)
(*pos)->flags |= ASN1_STRING_FLAG_CONT;
return 1;
}
- CMSerr(CMS_F_CMS_SET_DETACHED, ERR_R_MALLOC_FAILURE);
+ CMSerror(ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -388,13 +388,12 @@ cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
X509_ALGOR_get0(&digestoid, NULL, NULL, digestAlgorithm);
digest = EVP_get_digestbyobj(digestoid);
if (!digest) {
- CMSerr(CMS_F_CMS_DIGESTALGORITHM_INIT_BIO,
- CMS_R_UNKNOWN_DIGEST_ALGORITHM);
+ CMSerror(CMS_R_UNKNOWN_DIGEST_ALGORITHM);
goto err;
}
mdbio = BIO_new(BIO_f_md());
if (mdbio == NULL || !BIO_set_md(mdbio, digest)) {
- CMSerr(CMS_F_CMS_DIGESTALGORITHM_INIT_BIO, CMS_R_MD_BIO_INIT_ERROR);
+ CMSerror(CMS_R_MD_BIO_INIT_ERROR);
goto err;
}
return mdbio;
@@ -420,8 +419,7 @@ cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, X509_ALGOR *mdalg)
EVP_MD_CTX *mtmp;
chain = BIO_find_type(chain, BIO_TYPE_MD);
if (chain == NULL) {
- CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
- CMS_R_NO_MATCHING_DIGEST);
+ CMSerror(CMS_R_NO_MATCHING_DIGEST);
return 0;
}
BIO_get_md_ctx(chain, &mtmp);
@@ -449,8 +447,7 @@ cms_get0_certificate_choices(CMS_ContentInfo *cms)
return &cms->d.envelopedData->originatorInfo->certificates;
default:
- CMSerr(CMS_F_CMS_GET0_CERTIFICATE_CHOICES,
- CMS_R_UNSUPPORTED_CONTENT_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_CONTENT_TYPE);
return NULL;
}
}
@@ -493,8 +490,7 @@ CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert)
cch = sk_CMS_CertificateChoices_value(*pcerts, i);
if (cch->type == CMS_CERTCHOICE_CERT) {
if (!X509_cmp(cch->d.certificate, cert)) {
- CMSerr(CMS_F_CMS_ADD0_CERT,
- CMS_R_CERTIFICATE_ALREADY_PRESENT);
+ CMSerror(CMS_R_CERTIFICATE_ALREADY_PRESENT);
return 0;
}
}
@@ -533,8 +529,7 @@ cms_get0_revocation_choices(CMS_ContentInfo *cms)
return &cms->d.envelopedData->originatorInfo->crls;
default:
- CMSerr(CMS_F_CMS_GET0_REVOCATION_CHOICES,
- CMS_R_UNSUPPORTED_CONTENT_TYPE);
+ CMSerror(CMS_R_UNSUPPORTED_CONTENT_TYPE);
return NULL;
}
}
@@ -689,7 +684,7 @@ cms_set1_ias(CMS_IssuerAndSerialNumber **pias, X509 *cert)
err:
M_ASN1_free_of(ias, CMS_IssuerAndSerialNumber);
- CMSerr(CMS_F_CMS_SET1_IAS, ERR_R_MALLOC_FAILURE);
+ CMSerror(ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -702,12 +697,12 @@ cms_set1_keyid(ASN1_OCTET_STRING **pkeyid, X509 *cert)
cert_keyid = X509_get0_subject_key_id(cert);
if (cert_keyid == NULL) {
- CMSerr(CMS_F_CMS_SET1_KEYID, CMS_R_CERTIFICATE_HAS_NO_KEYID);
+ CMSerror(CMS_R_CERTIFICATE_HAS_NO_KEYID);
return 0;
}
keyid = ASN1_STRING_dup(cert_keyid);
if (!keyid) {
- CMSerr(CMS_F_CMS_SET1_KEYID, ERR_R_MALLOC_FAILURE);
+ CMSerror(ERR_R_MALLOC_FAILURE);
return 0;
}
ASN1_OCTET_STRING_free(*pkeyid);