summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-11-04 16:14:00 +0100
committerRichard Levitte <levitte@openssl.org>2020-11-13 09:35:31 +0100
commita150f8e1fcc38752fef4d7c75d765d8efc7d46d6 (patch)
treef7f62c9a5d8407d8b17820fbef67378aa7b9ddbb /crypto
parent9311d0c471ca2eaa259e8c1bbbeb7c46394c7ba2 (diff)
CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()
This is not done absolutely everywhere, as there are places where the use of ERR_add_error_data() is quite complex, but at least the simple cases are done. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13318)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/a_mbstr.c11
-rw-r--r--crypto/asn1/asn1_gen.c10
-rw-r--r--crypto/asn1/asn_mime.c12
-rw-r--r--crypto/asn1/asn_mstbl.c8
-rw-r--r--crypto/bio/b_addr.c8
-rw-r--r--crypto/bio/bss_acpt.c8
-rw-r--r--crypto/bio/bss_conn.c8
-rw-r--r--crypto/bio/bss_dgram.c15
-rw-r--r--crypto/cmp/cmp_client.c17
-rw-r--r--crypto/cmp/cmp_msg.c16
-rw-r--r--crypto/cmp/cmp_status.c10
-rw-r--r--crypto/cms/cms_smime.c6
-rw-r--r--crypto/comp/c_zlib.c12
-rw-r--r--crypto/conf/conf_def.c9
-rw-r--r--crypto/conf/conf_lib.c4
-rw-r--r--crypto/conf/conf_mod.c24
-rw-r--r--crypto/conf/conf_ssl.c25
-rw-r--r--crypto/dso/dso_dl.c16
-rw-r--r--crypto/dso/dso_dlfcn.c9
-rw-r--r--crypto/dso/dso_vms.c23
-rw-r--r--crypto/dso/dso_win32.c7
-rw-r--r--crypto/ec/ec_curve.c6
-rw-r--r--crypto/engine/eng_cnf.c12
-rw-r--r--crypto/engine/eng_fat.c5
-rw-r--r--crypto/engine/eng_list.c3
-rw-r--r--crypto/evp/evp_cnf.c5
-rw-r--r--crypto/evp/evp_pbe.c8
-rw-r--r--crypto/evp/evp_pkey.c4
-rw-r--r--crypto/http/http_client.c56
-rw-r--r--crypto/ocsp/ocsp_vfy.c5
-rw-r--r--crypto/pkcs7/pk7_smime.c6
-rw-r--r--crypto/provider_conf.c4
-rw-r--r--crypto/rand/rand_lib.c5
-rw-r--r--crypto/rand/randfile.c19
-rw-r--r--crypto/ts/ts_conf.c13
-rw-r--r--crypto/ts/ts_rsp_verify.c16
-rw-r--r--crypto/ui/ui_lib.c44
-rw-r--r--crypto/ui/ui_openssl.c47
-rw-r--r--crypto/x509/v3_addr.c5
-rw-r--r--crypto/x509/v3_akey.c4
-rw-r--r--crypto/x509/v3_alt.c16
-rw-r--r--crypto/x509/v3_bitst.c5
-rw-r--r--crypto/x509/v3_conf.c30
-rw-r--r--crypto/x509/v3_cpols.c10
-rw-r--r--crypto/x509/v3_extku.c5
-rw-r--r--crypto/x509/v3_info.c20
-rw-r--r--crypto/x509/v3_pcons.c4
-rw-r--r--crypto/x509/v3_pmaps.c10
-rw-r--r--crypto/x509/x509_att.c5
-rw-r--r--crypto/x509/x509name.c5
50 files changed, 271 insertions, 364 deletions
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c
index 9b307dbb9d..7279133c2a 100644
--- a/crypto/asn1/a_mbstr.c
+++ b/crypto/asn1/a_mbstr.c
@@ -49,7 +49,6 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
ASN1_STRING *dest;
unsigned char *p;
int nchar;
- char strbuf[32];
int (*cpyfunc) (unsigned long, void *) = NULL;
if (len == -1)
len = strlen((const char *)in);
@@ -95,16 +94,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
}
if ((minsize > 0) && (nchar < minsize)) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT);
- BIO_snprintf(strbuf, sizeof(strbuf), "%ld", minsize);
- ERR_add_error_data(2, "minsize=", strbuf);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT,
+ "minsize=%ld", minsize);
return -1;
}
if ((maxsize > 0) && (nchar > maxsize)) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG);
- BIO_snprintf(strbuf, sizeof(strbuf), "%ld", maxsize);
- ERR_add_error_data(2, "maxsize=", strbuf);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG,
+ "maxsize=%ld", maxsize);
return -1;
}
diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c
index e717a93653..3c003ee103 100644
--- a/crypto/asn1/asn1_gen.c
+++ b/crypto/asn1/asn1_gen.c
@@ -263,8 +263,7 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
utype = asn1_str2tag(elem, len);
if (utype == -1) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_UNKNOWN_TAG);
- ERR_add_error_data(2, "tag=", elem);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_UNKNOWN_TAG, "tag=%s", elem);
return -1;
}
@@ -347,7 +346,6 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
{
- char erch[2];
long tag_num;
char *eptr;
if (!vstart)
@@ -386,10 +384,8 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
break;
default:
- erch[0] = *eptr;
- erch[1] = 0;
- ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_MODIFIER);
- ERR_add_error_data(2, "Char=", erch);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_INVALID_MODIFIER,
+ "Char=%c", *eptr);
return 0;
}
diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c
index 1e952734d0..8ee0970dc6 100644
--- a/crypto/asn1/asn_mime.c
+++ b/crypto/asn1/asn_mime.c
@@ -453,8 +453,8 @@ ASN1_VALUE *SMIME_read_ASN1_ex(BIO *bio, BIO **bcont, const ASN1_ITEM *it,
if (strcmp(hdr->value, "application/x-pkcs7-signature") &&
strcmp(hdr->value, "application/pkcs7-signature")) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_SIG_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_SIG_INVALID_MIME_TYPE,
+ "type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
sk_BIO_pop_free(parts, BIO_vfree);
return NULL;
@@ -480,8 +480,8 @@ ASN1_VALUE *SMIME_read_ASN1_ex(BIO *bio, BIO **bcont, const ASN1_ITEM *it,
if (strcmp(hdr->value, "application/x-pkcs7-mime") &&
strcmp(hdr->value, "application/pkcs7-mime")) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE,
+ "type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return NULL;
}
@@ -566,8 +566,8 @@ int SMIME_text(BIO *in, BIO *out)
return 0;
}
if (strcmp(hdr->value, "text/plain")) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE);
- ERR_add_error_data(2, "type: ", hdr->value);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE,
+ "type: %s", hdr->value);
sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
return 0;
}
diff --git a/crypto/asn1/asn_mstbl.c b/crypto/asn1/asn_mstbl.c
index 3992468a01..3543cd2256 100644
--- a/crypto/asn1/asn_mstbl.c
+++ b/crypto/asn1/asn_mstbl.c
@@ -96,12 +96,12 @@ static int do_tcreate(const char *value, const char *name)
rv = 1;
err:
if (rv == 0) {
- ERR_raise(ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE);
if (cnf)
- ERR_add_error_data(4, "field=", cnf->name,
- ", value=", cnf->value);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE,
+ "field=%s, value=%s", cnf->name, cnf->value);
else
- ERR_add_error_data(4, "name=", name, ", value=", value);
+ ERR_raise_data(ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE,
+ "name=%s, value=%s", name, value);
} else {
rv = ASN1_STRING_TABLE_add(nid, tbl_min, tbl_max,
tbl_mask, tbl_flags);
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 7a8ac6fb9c..7515cf264b 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -213,12 +213,10 @@ static int addr_strings(const BIO_ADDR *ap, int numeric,
if (ret == EAI_SYSTEM) {
ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getnameinfo()");
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
} else
# endif
{
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
- ERR_add_error_data(1, gai_strerror(ret));
+ ERR_raise_data(ERR_LIB_BIO, ERR_R_SYS_LIB, gai_strerror(ret));
}
return 0;
}
@@ -729,8 +727,8 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
goto retry;
}
# endif
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
- ERR_add_error_data(1, gai_strerror(old_ret ? old_ret : gai_ret));
+ ERR_raise_data(ERR_LIB_BIO, ERR_R_SYS_LIB,
+ gai_strerror(old_ret ? old_ret : gai_ret));
break;
}
} else {
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 3b5c7f1c19..5b776224d6 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -156,10 +156,10 @@ static int acpt_state(BIO *b, BIO_ACCEPT *c)
switch (c->state) {
case ACPT_S_BEFORE:
if (c->param_addr == NULL && c->param_serv == NULL) {
- ERR_raise(ERR_LIB_BIO, BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED);
- ERR_add_error_data(4,
- "hostname=", c->param_addr,
- " service=", c->param_serv);
+ ERR_raise_data(ERR_LIB_BIO,
+ BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED,
+ "hostname=%s, service=%s",
+ c->param_addr, c->param_serv);
goto exit_loop;
}
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index a88d1ce61b..c7bd0a329f 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -89,10 +89,10 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
switch (c->state) {
case BIO_CONN_S_BEFORE:
if (c->param_hostname == NULL && c->param_service == NULL) {
- ERR_raise(ERR_LIB_BIO, BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED);
- ERR_add_error_data(4,
- "hostname=", c->param_hostname,
- " service=", c->param_service);
+ ERR_raise_data(ERR_LIB_BIO,
+ BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED,
+ "hostname=%s service=%s",
+ c->param_hostname, c->param_service);
goto exit_loop;
}
c->state = BIO_CONN_S_GET_ADDR;
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 39b69572f9..45981ab27b 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -843,8 +843,8 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
sizeof(struct sctp_authchunk));
if (ret < 0) {
BIO_vfree(bio);
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
- ERR_add_error_data(1, "Ensure SCTP AUTH chunks are enabled in kernel");
+ ERR_raise_data(ERR_LIB_BIO, ERR_R_SYS_LIB,
+ "Ensure SCTP AUTH chunks are enabled in kernel");
return NULL;
}
auth.sauth_chunk = OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE;
@@ -853,8 +853,8 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
sizeof(struct sctp_authchunk));
if (ret < 0) {
BIO_vfree(bio);
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
- ERR_add_error_data(1, "Ensure SCTP AUTH chunks are enabled in kernel");
+ ERR_raise_data(ERR_LIB_BIO, ERR_R_SYS_LIB,
+ "Ensure SCTP AUTH chunks are enabled in kernel");
return NULL;
}
@@ -891,10 +891,9 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
if (!auth_data || !auth_forward) {
BIO_vfree(bio);
- ERR_raise(ERR_LIB_BIO, ERR_R_SYS_LIB);
- ERR_add_error_data(1,
- "Ensure SCTP AUTH chunks are enabled on the "
- "underlying socket");
+ ERR_raise_data(ERR_LIB_BIO, ERR_R_SYS_LIB,
+ "Ensure SCTP AUTH chunks are enabled on the "
+ "underlying socket");
return NULL;
}
diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c
index dd974413c0..c19eea818f 100644
--- a/crypto/cmp/cmp_client.c
+++ b/crypto/cmp/cmp_client.c
@@ -169,9 +169,9 @@ static int send_receive_check(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *req,
ctx->msg_timeout = msg_timeout; /* restore original value */
if (*rep == NULL) {
- ERR_raise(ERR_LIB_CMP, CMP_R_TRANSFER_ERROR); /* or receiving response */
- ERR_add_error_data(2, "request sent: ", req_type_str);
- ERR_add_error_data(2, ", expected response: ", expected_type_str);
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_TRANSFER_ERROR, /* or receiving response */
+ "request sent: %s, expected response: %s",
+ req_type_str, expected_type_str);
return 0;
}
@@ -633,11 +633,14 @@ static int cert_response(OSSL_CMP_CTX *ctx, int sleep, int rid,
/* not throwing failure earlier as transfer_cb may call ERR_clear_error() */
if (fail_info != 0) {
- ERR_raise(ERR_LIB_CMP, CMP_R_CERTIFICATE_NOT_ACCEPTED);
- ERR_add_error_data(2, "rejecting newly enrolled cert with subject: ",
+ if (txt == NULL)
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTIFICATE_NOT_ACCEPTED,
+ "rejecting newly enrolled cert with subject: %s",
subj);
- if (txt != NULL)
- ERR_add_error_txt("; ", txt);
+ else
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTIFICATE_NOT_ACCEPTED,
+ "rejecting newly enrolled cert with subject: %s; %s",
+ subj, txt);
ret = 0;
}
OPENSSL_free(subj);
diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c
index eff093c6b5..1a4a873168 100644
--- a/crypto/cmp/cmp_msg.c
+++ b/crypto/cmp/cmp_msg.c
@@ -888,14 +888,6 @@ static int suitable_rid(const ASN1_INTEGER *certReqId, int rid)
return rid == trid;
}
-static void add_expected_rid(int rid)
-{
- char str[DECIMAL_SIZE(rid) + 1];
-
- BIO_snprintf(str, sizeof(str), "%d", rid);
- ERR_add_error_data(2, "expected certReqId = ", str);
-}
-
/*
* returns a pointer to the PollResponse with the given CertReqId
* (or the first one in case -1) inside a PollRepContent
@@ -917,8 +909,8 @@ ossl_cmp_pollrepcontent_get0_pollrep(const OSSL_CMP_POLLREPCONTENT *prc,
return pollRep;
}
- ERR_raise(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND);
- add_expected_rid(rid);
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND,
+ "expected certReqId = %d", rid);
return NULL;
}
@@ -943,8 +935,8 @@ ossl_cmp_certrepmessage_get0_certresponse(const OSSL_CMP_CERTREPMESSAGE *crm,
return crep;
}
- ERR_raise(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND);
- add_expected_rid(rid);
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_CERTRESPONSE_NOT_FOUND,
+ "expected certReqId = %d", rid);
return NULL;
}
diff --git a/crypto/cmp/cmp_status.c b/crypto/cmp/cmp_status.c
index 1660906753..dc14f754de 100644
--- a/crypto/cmp/cmp_status.c
+++ b/crypto/cmp/cmp_status.c
@@ -53,13 +53,9 @@ const char *ossl_cmp_PKIStatus_to_string(int status)
case OSSL_CMP_PKISTATUS_keyUpdateWarning:
return "PKIStatus: key update warning - update already done for the cert";
default:
- {
- char buf[40];
- BIO_snprintf(buf, sizeof(buf), "PKIStatus: invalid=%d", status);
- ERR_raise(ERR_LIB_CMP, CMP_R_ERROR_PARSING_PKISTATUS);
- ERR_add_error_data(1, buf);
- return NULL;
- }
+ ERR_raise_data(ERR_LIB_CMP, CMP_R_ERROR_PARSING_PKISTATUS,
+ "PKIStatus: invalid=%d", status);
+ return NULL;
}
}
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index 84cd27afea..5c903f204b 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -281,10 +281,8 @@ static int cms_signerinfo_verify_cert(CMS_SignerInfo *si,
i = X509_verify_cert(ctx);
if (i <= 0) {
j = X509_STORE_CTX_get_error(ctx);
- ERR_raise(ERR_LIB_CMS,
- CMS_R_CERTIFICATE_VERIFY_ERROR);
- ERR_add_error_data(2, "Verify error:",
- X509_verify_cert_error_string(j));
+ ERR_raise_data(ERR_LIB_CMS, CMS_R_CERTIFICATE_VERIFY_ERROR,
+ "Verify error: %s", X509_verify_cert_error_string(j));
goto err;
}
r = 1;
diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c
index 0211da9b91..5d69dc96d2 100644
--- a/crypto/comp/c_zlib.c
+++ b/crypto/comp/c_zlib.c
@@ -397,8 +397,8 @@ static int bio_zlib_read(BIO *b, char *out, int outl)
while (zin->avail_in) {
ret = inflate(zin, 0);
if ((ret != Z_OK) && (ret != Z_STREAM_END)) {
- ERR_raise(ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR,
+ "zlib error: %s", zError(ret));
return 0;
}
/* If EOF or we've read everything then return */
@@ -483,8 +483,8 @@ static int bio_zlib_write(BIO *b, const char *in, int inl)
/* Compress some more */
ret = deflate(zout, 0);
if (ret != Z_OK) {
- ERR_raise(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR,
+ "zlib error: %s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
@@ -532,8 +532,8 @@ static int bio_zlib_flush(BIO *b)
if (ret == Z_STREAM_END)
ctx->odone = 1;
else if (ret != Z_OK) {
- ERR_raise(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR);
- ERR_add_error_data(2, "zlib error:", zError(ret));
+ ERR_raise_data(ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR,
+ "zlib error: %s", zError(ret));
return 0;
}
ctx->ocount = ctx->obufsize - zout->avail_out;
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 5923f88212..2637e17fd8 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -462,8 +462,8 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
continue;
} else if (*p != '=') {
- ERR_raise(ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN);
- ERR_add_error_data(2, "HERE-->", p);
+ ERR_raise_data(ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN,
+ "HERE-->%s", p);
goto err;
}
*end = '\0';
@@ -760,9 +760,8 @@ static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
if (S_ISDIR(st.st_mode)) {
if (*dirctx != NULL) {
- ERR_raise(ERR_LIB_CONF,
- CONF_R_RECURSIVE_DIRECTORY_INCLUDE);
- ERR_add_error_data(1, include);
+ ERR_raise_data(ERR_LIB_CONF, CONF_R_RECURSIVE_DIRECTORY_INCLUDE,
+ "%s", include);
return NULL;
}
/* a directory, load its contents */
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
index d100d5ed5c..1f106d8c07 100644
--- a/crypto/conf/conf_lib.c
+++ b/crypto/conf/conf_lib.c
@@ -279,8 +279,8 @@ char *NCONF_get_string(const CONF *conf, const char *group, const char *name)
ERR_raise(ERR_LIB_CONF, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE);
return NULL;
}
- ERR_raise(ERR_LIB_CONF, CONF_R_NO_VALUE);
- ERR_add_error_data(4, "group=", group, " name=", name);
+ ERR_raise_data(ERR_LIB_CONF, CONF_R_NO_VALUE,
+ "group=%s name=%s", group, name);
return NULL;
}
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index 9a07beb6b6..cb1bf7cd3c 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -121,8 +121,9 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
if (values == NULL) {
if (!(flags & CONF_MFLAGS_SILENT)) {
ERR_clear_last_mark();
- ERR_raise(ERR_LIB_CONF, CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION);
- ERR_add_error_data(2, "openssl_conf=", vsection);
+ ERR_raise_data(ERR_LIB_CONF,
+ CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION,
+ "openssl_conf=%s", vsection);
} else {
ERR_pop_to_mark();
}
@@ -228,8 +229,8 @@ static int module_run(const CONF *cnf, const char *name, const char *value,
if (!md) {
if (!(flags & CONF_MFLAGS_SILENT)) {
- ERR_raise(ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME);
- ERR_add_error_data(2, "module=", name);
+ ERR_raise_data(ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME,
+ "module=%s", name);
}
return -1;
}
@@ -237,14 +238,10 @@ static int module_run(const CONF *cnf, const char *name, const char *value,
ret = module_init(md, name, value, cnf);
if (ret <= 0) {
- if (!(flags & CONF_MFLAGS_SILENT)) {
- char rcode[DECIMAL_SIZE(ret) + 1];
-
- ERR_raise(ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR);
- BIO_snprintf(rcode, sizeof(rcode), "%-8d", ret);
- ERR_add_error_data(6, "module=", name, ", value=", value,
- ", retcode=", rcode);
- }
+ if (!(flags & CONF_MFLAGS_SILENT))
+ ERR_raise_data(ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR,
+ "module=%s, value=%s retcode=%-8d",
+ name, value, ret);
}
return ret;
@@ -287,8 +284,7 @@ static CONF_MODULE *module_load_dso(const CONF *cnf,
err:
DSO_free(dso);
- ERR_raise(ERR_LIB_CONF, errcode);
- ERR_add_error_data(4, "module=", name, ", path=", path);
+ ERR_raise_data(ERR_LIB_CONF, errcode, "module=%s, path=%s", name, path);
return NULL;
}
diff --git a/crypto/conf/conf_ssl.c b/crypto/conf/conf_ssl.c
index 6512dda132..a4b35bab99 100644
--- a/crypto/conf/conf_ssl.c
+++ b/crypto/conf/conf_ssl.c
@@ -68,11 +68,12 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
ssl_conf_section = CONF_imodule_get_value(md);
cmd_lists = NCONF_get_section(cnf, ssl_conf_section);
if (sk_CONF_VALUE_num(cmd_lists) <= 0) {
- if (cmd_lists == NULL)
- ERR_raise(ERR_LIB_CONF, CONF_R_SSL_SECTION_NOT_FOUND);
- else
- ERR_raise(ERR_LIB_CONF, CONF_R_SSL_SECTION_EMPTY);
- ERR_add_error_data(2, "section=", ssl_conf_section);
+ int rcode =
+ cmd_lists == NULL
+ ? CONF_R_SSL_SECTION_NOT_FOUND
+ : CONF_R_SSL_SECTION_EMPTY;
+
+ ERR_raise_data(ERR_LIB_CONF, rcode, "section=%s", ssl_conf_section);
goto err;
}
cnt = sk_CONF_VALUE_num(cmd_lists);
@@ -87,13 +88,13 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value);
if (sk_CONF_VALUE_num(cmds) <= 0) {
- if (cmds == NULL)
- ERR_raise(ERR_LIB_CONF,
- CONF_R_SSL_COMMAND_SECTION_NOT_FOUND);
- else
- ERR_raise(ERR_LIB_CONF,
- CONF_R_SSL_COMMAND_SECTION_EMPTY);
- ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value);
+ int rcode =
+ cmds == NU