summaryrefslogtreecommitdiffstats
path: root/crypto/bio
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/bio
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/bio')
-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
4 files changed, 18 insertions, 21 deletions
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;
}