Replace FUNCerr with ERR_raise_data

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9496)
This commit is contained in:
Rich Salz 2019-07-31 15:24:20 -04:00 committed by Richard Levitte
parent 823ee00a39
commit ff988500c2
15 changed files with 94 additions and 71 deletions

View file

@ -37,10 +37,6 @@
private key for those. This avoids leaking bit 0 of the private key. private key for those. This avoids leaking bit 0 of the private key.
[Bernd Edlinger] [Bernd Edlinger]
*) Added a new FUNCerr() macro that takes a function name.
The macro SYSerr() is deprecated.
[Rich Salz]
*) Significantly reduce secure memory usage by the randomness pools. *) Significantly reduce secure memory usage by the randomness pools.
[Paul Dale] [Paul Dale]

View file

@ -1395,8 +1395,8 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
#ifndef OPENSSL_NO_POSIX_IO #ifndef OPENSSL_NO_POSIX_IO
BIO_get_fp(in, &dbfp); BIO_get_fp(in, &dbfp);
if (fstat(fileno(dbfp), &dbst) == -1) { if (fstat(fileno(dbfp), &dbst) == -1) {
FUNCerr("fstat", errno); ERR_raise_data(ERR_LIB_SYS, errno,
ERR_add_error_data(1, dbfile); "calling fstat(%s)", dbfile);
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto err; goto err;
} }

View file

@ -207,7 +207,8 @@ static int addr_strings(const BIO_ADDR *ap, int numeric,
flags)) != 0) { flags)) != 0) {
# ifdef EAI_SYSTEM # ifdef EAI_SYSTEM
if (ret == EAI_SYSTEM) { if (ret == EAI_SYSTEM) {
FUNCerr("getnameinfo", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getnameinfo()");
BIOerr(BIO_F_ADDR_STRINGS, ERR_R_SYS_LIB); BIOerr(BIO_F_ADDR_STRINGS, ERR_R_SYS_LIB);
} else } else
# endif # endif
@ -700,7 +701,8 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
switch ((gai_ret = getaddrinfo(host, service, &hints, res))) { switch ((gai_ret = getaddrinfo(host, service, &hints, res))) {
# ifdef EAI_SYSTEM # ifdef EAI_SYSTEM
case EAI_SYSTEM: case EAI_SYSTEM:
FUNCerr("getaddrinfo", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getaddrinfo()");
BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_SYS_LIB); BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_SYS_LIB);
break; break;
# endif # endif
@ -804,12 +806,15 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
*/ */
# if defined(OPENSSL_SYS_VXWORKS) # if defined(OPENSSL_SYS_VXWORKS)
/* h_errno doesn't exist on VxWorks */ /* h_errno doesn't exist on VxWorks */
FUNCerr("gethostbyname", 1000 ); ERR_raise_data(ERR_LIB_SYS, 1000,
"calling gethostbyname()");
# else # else
FUNCerr("gethostbyname", 1000 + h_errno); ERR_raise_data(ERR_LIB_SYS, 1000 + h_errno,
"calling gethostbyname()");
# endif # endif
#else #else
FUNCerr("gethostbyname", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling gethostbyname()");
#endif #endif
ret = 0; ret = 0;
goto err; goto err;
@ -855,7 +860,8 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
se = getservbyname(service, proto); se = getservbyname(service, proto);
if (se == NULL) { if (se == NULL) {
FUNCerr("getservbyname", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getservbyname()");
goto err; goto err;
} }
} else { } else {

View file

@ -129,7 +129,8 @@ int BIO_sock_init(void)
* probed at run-time with DSO_global_lookup. * probed at run-time with DSO_global_lookup.
*/ */
if (WSAStartup(0x0202, &wsa_state) != 0) { if (WSAStartup(0x0202, &wsa_state) != 0) {
FUNCerr("wsastartup", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling wsastartup()");
BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP); BIOerr(BIO_F_BIO_SOCK_INIT, BIO_R_WSASTARTUP);
return -1; return -1;
} }
@ -189,7 +190,8 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
i = ioctlsocket(fd, type, ARG); i = ioctlsocket(fd, type, ARG);
# endif /* __DJGPP__ */ # endif /* __DJGPP__ */
if (i < 0) if (i < 0)
FUNCerr("ioctlsocket", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling ioctlsocket()");
return i; return i;
} }
@ -240,7 +242,8 @@ int BIO_accept(int sock, char **ip_port)
ret = -2; ret = -2;
goto end; goto end;
} }
FUNCerr("accept", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling accept()");
BIOerr(BIO_F_BIO_ACCEPT, BIO_R_ACCEPT_ERROR); BIOerr(BIO_F_BIO_ACCEPT, BIO_R_ACCEPT_ERROR);
goto end; goto end;
} }
@ -305,7 +308,8 @@ int BIO_socket_nbio(int s, int mode)
l = fcntl(s, F_GETFL, 0); l = fcntl(s, F_GETFL, 0);
if (l == -1) { if (l == -1) {
FUNCerr("fcntl", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling fcntl()");
ret = -1; ret = -1;
} else { } else {
# if defined(O_NONBLOCK) # if defined(O_NONBLOCK)
@ -323,7 +327,8 @@ int BIO_socket_nbio(int s, int mode)
ret = fcntl(s, F_SETFL, l); ret = fcntl(s, F_SETFL, l);
if (ret < 0) { if (ret < 0) {
FUNCerr("fcntl", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling fcntl()");
} }
} }
# else # else
@ -346,7 +351,8 @@ int BIO_sock_info(int sock,
ret = getsockname(sock, BIO_ADDR_sockaddr_noconst(info->addr), ret = getsockname(sock, BIO_ADDR_sockaddr_noconst(info->addr),
&addr_len); &addr_len);
if (ret == -1) { if (ret == -1) {
FUNCerr("getsockname", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getsockname()");
BIOerr(BIO_F_BIO_SOCK_INFO, BIO_R_GETSOCKNAME_ERROR); BIOerr(BIO_F_BIO_SOCK_INFO, BIO_R_GETSOCKNAME_ERROR);
return 0; return 0;
} }

View file

@ -46,7 +46,8 @@ int BIO_socket(int domain, int socktype, int protocol, int options)
sock = socket(domain, socktype, protocol); sock = socket(domain, socktype, protocol);
if (sock == -1) { if (sock == -1) {
FUNCerr("socket", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling socket()");
BIOerr(BIO_F_BIO_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET); BIOerr(BIO_F_BIO_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET);
return INVALID_SOCKET; return INVALID_SOCKET;
} }
@ -89,7 +90,8 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
if (options & BIO_SOCK_KEEPALIVE) { if (options & BIO_SOCK_KEEPALIVE) {
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_KEEPALIVE); BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_KEEPALIVE);
return 0; return 0;
} }
@ -98,7 +100,8 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
if (options & BIO_SOCK_NODELAY) { if (options & BIO_SOCK_NODELAY) {
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_NODELAY); BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_NODELAY);
return 0; return 0;
} }
@ -107,7 +110,8 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
if (connect(sock, BIO_ADDR_sockaddr(addr), if (connect(sock, BIO_ADDR_sockaddr(addr),
BIO_ADDR_sockaddr_size(addr)) == -1) { BIO_ADDR_sockaddr_size(addr)) == -1) {
if (!BIO_sock_should_retry(-1)) { if (!BIO_sock_should_retry(-1)) {
FUNCerr("connect", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling connect()");
BIOerr(BIO_F_BIO_CONNECT, BIO_R_CONNECT_ERROR); BIOerr(BIO_F_BIO_CONNECT, BIO_R_CONNECT_ERROR);
} }
return 0; return 0;
@ -150,7 +154,8 @@ int BIO_bind(int sock, const BIO_ADDR *addr, int options)
if (options & BIO_SOCK_REUSEADDR) { if (options & BIO_SOCK_REUSEADDR) {
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_BIND, BIO_R_UNABLE_TO_REUSEADDR); BIOerr(BIO_F_BIO_BIND, BIO_R_UNABLE_TO_REUSEADDR);
return 0; return 0;
} }
@ -158,7 +163,8 @@ int BIO_bind(int sock, const BIO_ADDR *addr, int options)
# endif # endif
if (bind(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) != 0) { if (bind(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) != 0) {
FUNCerr("bind", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling bind()");
BIOerr(BIO_F_BIO_BIND, BIO_R_UNABLE_TO_BIND_SOCKET); BIOerr(BIO_F_BIO_BIND, BIO_R_UNABLE_TO_BIND_SOCKET);
return 0; return 0;
} }
@ -217,7 +223,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
if (getsockopt(sock, SOL_SOCKET, SO_TYPE, if (getsockopt(sock, SOL_SOCKET, SO_TYPE,
(void *)&socktype, &socktype_len) != 0 (void *)&socktype, &socktype_len) != 0
|| socktype_len != sizeof(socktype)) { || socktype_len != sizeof(socktype)) {
FUNCerr("getsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling getsockopt()");
BIOerr(BIO_F_BIO_LISTEN, BIO_R_GETTING_SOCKTYPE); BIOerr(BIO_F_BIO_LISTEN, BIO_R_GETTING_SOCKTYPE);
return 0; return 0;
} }
@ -228,7 +235,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
if (options & BIO_SOCK_KEEPALIVE) { if (options & BIO_SOCK_KEEPALIVE) {
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_KEEPALIVE); BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_KEEPALIVE);
return 0; return 0;
} }
@ -237,7 +245,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
if (options & BIO_SOCK_NODELAY) { if (options & BIO_SOCK_NODELAY) {
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_NODELAY); BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_NODELAY);
return 0; return 0;
} }
@ -252,7 +261,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
on = options & BIO_SOCK_V6_ONLY ? 1 : 0; on = options & BIO_SOCK_V6_ONLY ? 1 : 0;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
(const void *)&on, sizeof(on)) != 0) { (const void *)&on, sizeof(on)) != 0) {
FUNCerr("setsockopt", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
BIOerr(BIO_F_BIO_LISTEN, BIO_R_LISTEN_V6_ONLY); BIOerr(BIO_F_BIO_LISTEN, BIO_R_LISTEN_V6_ONLY);
return 0; return 0;
} }
@ -263,7 +273,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
return 0; return 0;
if (socktype != SOCK_DGRAM && listen(sock, MAX_LISTEN) == -1) { if (socktype != SOCK_DGRAM && listen(sock, MAX_LISTEN) == -1) {
FUNCerr("listen", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling listen()");
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_LISTEN_SOCKET); BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_LISTEN_SOCKET);
return 0; return 0;
} }
@ -290,7 +301,8 @@ int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)
BIO_ADDR_sockaddr_noconst(addr), &len); BIO_ADDR_sockaddr_noconst(addr), &len);
if (accepted_sock == -1) { if (accepted_sock == -1) {
if (!BIO_sock_should_retry(accepted_sock)) { if (!BIO_sock_should_retry(accepted_sock)) {
FUNCerr("accept", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling accept()");
BIOerr(BIO_F_BIO_ACCEPT_EX, BIO_R_ACCEPT_ERROR); BIOerr(BIO_F_BIO_ACCEPT_EX, BIO_R_ACCEPT_ERROR);
} }
return INVALID_SOCKET; return INVALID_SOCKET;

View file

@ -226,10 +226,9 @@ static int acpt_state(BIO *b, BIO_ACCEPT *c)
BIO_ADDRINFO_socktype(c->addr_iter), BIO_ADDRINFO_socktype(c->addr_iter),
BIO_ADDRINFO_protocol(c->addr_iter), 0); BIO_ADDRINFO_protocol(c->addr_iter), 0);
if (ret == (int)INVALID_SOCKET) { if (ret == (int)INVALID_SOCKET) {
FUNCerr("socket", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
ERR_add_error_data(4, "calling socket(%s, %s)",
"hostname=", c->param_addr, c->param_addr, c->param_serv);
" service=", c->param_serv);
BIOerr(BIO_F_ACPT_STATE, BIO_R_UNABLE_TO_CREATE_SOCKET); BIOerr(BIO_F_ACPT_STATE, BIO_R_UNABLE_TO_CREATE_SOCKET);
goto exit_loop; goto exit_loop;
} }

View file

@ -138,10 +138,9 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
BIO_ADDRINFO_socktype(c->addr_iter), BIO_ADDRINFO_socktype(c->addr_iter),
BIO_ADDRINFO_protocol(c->addr_iter), 0); BIO_ADDRINFO_protocol(c->addr_iter), 0);
if (ret == (int)INVALID_SOCKET) { if (ret == (int)INVALID_SOCKET) {
FUNCerr("socket", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
ERR_add_error_data(4, "calling socket(%s, %s)",
"hostname=", c->param_hostname, c->param_hostname, c->param_service);
" service=", c->param_service);
BIOerr(BIO_F_CONN_STATE, BIO_R_UNABLE_TO_CREATE_SOCKET); BIOerr(BIO_F_CONN_STATE, BIO_R_UNABLE_TO_CREATE_SOCKET);
goto exit_loop; goto exit_loop;
} }
@ -170,10 +169,9 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
ERR_clear_error(); ERR_clear_error();
break; break;
} else { } else {
FUNCerr("connect", get_last_socket_error()); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
ERR_add_error_data(4, "calling connect(%s, %s)",
"hostname=", c->param_hostname, c->param_hostname, c->param_service);
" service=", c->param_service);
BIOerr(BIO_F_CONN_STATE, BIO_R_CONNECT_ERROR); BIOerr(BIO_F_CONN_STATE, BIO_R_CONNECT_ERROR);
} }
goto exit_loop; goto exit_loop;
@ -186,10 +184,9 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
i = BIO_sock_error(b->num); i = BIO_sock_error(b->num);
if (i) { if (i) {
BIO_clear_retry_flags(b); BIO_clear_retry_flags(b);
FUNCerr("connect", i); ERR_raise_data(ERR_LIB_SYS, i,
ERR_add_error_data(4, "calling connect(%s, %s)",
"hostname=", c->param_hostname, c->param_hostname, c->param_service);
" service=", c->param_service);
BIOerr(BIO_F_CONN_STATE, BIO_R_NBIO_CONNECT_ERROR); BIOerr(BIO_F_CONN_STATE, BIO_R_NBIO_CONNECT_ERROR);
ret = 0; ret = 0;
goto exit_loop; goto exit_loop;

View file

@ -66,8 +66,9 @@ BIO *BIO_new_file(const char *filename, const char *mode)
fp_flags |= BIO_FP_TEXT; fp_flags |= BIO_FP_TEXT;
if (file == NULL) { if (file == NULL) {
FUNCerr("fopen", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
ERR_add_error_data(5, "fopen('", filename, "','", mode, "')"); "calling fopen(%s, %s)",
filename, mode);
if (errno == ENOENT if (errno == ENOENT
#ifdef ENXIO #ifdef ENXIO
|| errno == ENXIO || errno == ENXIO
@ -146,7 +147,8 @@ static int file_read(BIO *b, char *out, int outl)
if (ret == 0 if (ret == 0
&& (b->flags & BIO_FLAGS_UPLINK_INTERNAL && (b->flags & BIO_FLAGS_UPLINK_INTERNAL
? UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr))) { ? UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr))) {
FUNCerr("fread", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling fread()");
BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB);
ret = -1; ret = -1;
} }
@ -285,8 +287,9 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
# endif # endif
fp = openssl_fopen(ptr, p); fp = openssl_fopen(ptr, p);
if (fp == NULL) { if (fp == NULL) {
FUNCerr("fopen", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
ERR_add_error_data(5, "fopen('", ptr, "','", p, "')"); "calling fopen(%s, %s)",
ptr, p);
BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
ret = 0; ret = 0;
break; break;
@ -313,8 +316,8 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
st = b->flags & BIO_FLAGS_UPLINK_INTERNAL st = b->flags & BIO_FLAGS_UPLINK_INTERNAL
? UP_fflush(b->ptr) : fflush((FILE *)b->ptr); ? UP_fflush(b->ptr) : fflush((FILE *)b->ptr);
if (st == EOF) { if (st == EOF) {
FUNCerr("fflush", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
ERR_add_error_data(1, "fflush()"); "calling fflush()");
BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB);
ret = 0; ret = 0;
} }

View file

@ -673,8 +673,9 @@ static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
BIO *next; BIO *next;
if (stat(include, &st) < 0) { if (stat(include, &st) < 0) {
FUNCerr("stat", errno); ERR_raise_data(ERR_LIB_SYS, errno,
ERR_add_error_data(1, include); "calling stat(%s)",
include);
/* missing include file is not fatal error */ /* missing include file is not fatal error */
return NULL; return NULL;
} }

View file

@ -824,8 +824,9 @@ static OSSL_STORE_LOADER_CTX *file_open(const OSSL_STORE_LOADER *loader,
} }
if (stat(path_data[i].path, &st) < 0) { if (stat(path_data[i].path, &st) < 0) {
FUNCerr("stat", errno); ERR_raise_data(ERR_LIB_SYS, errno,
ERR_add_error_data(1, path_data[i].path); "calling stat(%s)",
path_data[i].path);
} else { } else {
path = path_data[i].path; path = path_data[i].path;
} }

View file

@ -72,7 +72,7 @@ void engine_load_devcrypto_int(void);
static int clean_devcrypto_session(struct session_op *sess) { static int clean_devcrypto_session(struct session_op *sess) {
if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) { if (ioctl(cfd, CIOCFSESSION, &sess->ses) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
memset(sess, 0, sizeof(struct session_op)); memset(sess, 0, sizeof(struct session_op));
@ -208,7 +208,7 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE; cipher_ctx->mode = cipher_d->flags & EVP_CIPH_MODE;
cipher_ctx->blocksize = cipher_d->blocksize; cipher_ctx->blocksize = cipher_d->blocksize;
if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) { if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
@ -260,7 +260,7 @@ static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
#endif #endif
if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) { if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
@ -704,7 +704,7 @@ static int digest_init(EVP_MD_CTX *ctx)
memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess)); memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess));
digest_ctx->sess.mac = digest_d->devcryptoid; digest_ctx->sess.mac = digest_d->devcryptoid;
if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) { if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
return 1; return 1;
@ -743,7 +743,7 @@ static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count)
return 1; return 1;
} }
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
@ -758,7 +758,7 @@ static int digest_final(EVP_MD_CTX *ctx, unsigned char *md)
if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) { if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT)) {
memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx)); memcpy(md, digest_ctx->digest_res, EVP_MD_CTX_size(ctx));
} else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) { } else if (digest_op(digest_ctx, NULL, 0, md, COP_FLAG_FINAL) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
@ -777,14 +777,14 @@ static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
return 1; return 1;
if (!digest_init(to)) { if (!digest_init(to)) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
cphash.src_ses = digest_from->sess.ses; cphash.src_ses = digest_from->sess.ses;
cphash.dst_ses = digest_to->sess.ses; cphash.dst_ses = digest_to->sess.ses;
if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) { if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) {
FUNCerr("ioctl", errno); ERR_raise_data(ERR_LIB_SYS, errno, "calling ioctl()");
return 0; return 0;
} }
return 1; return 1;

View file

@ -110,7 +110,6 @@ typedef struct err_state_st {
# if ! OPENSSL_API_3 # if ! OPENSSL_API_3
# define SYSerr(f,r) ERR_raise(ERR_LIB_SYS,(r)) # define SYSerr(f,r) ERR_raise(ERR_LIB_SYS,(r))
# endif # endif
# define FUNCerr(f,r) ERR_raise_data(ERR_LIB_SYS,(r),"calling function %s",(f))
# define BNerr(f,r) ERR_raise(ERR_LIB_RSA,(r)) # define BNerr(f,r) ERR_raise(ERR_LIB_RSA,(r))
# define RSAerr(f,r) ERR_raise(ERR_LIB_RSA,(r)) # define RSAerr(f,r) ERR_raise(ERR_LIB_RSA,(r))
# define DHerr(f,r) ERR_raise(ERR_LIB_DH,(r)) # define DHerr(f,r) ERR_raise(ERR_LIB_DH,(r))

View file

@ -766,8 +766,9 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
} }
if (errno) { if (errno) {
FUNCerr("readdir", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')"); "calling OPENSSL_dir_read(%s)",
dir);
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
goto err; goto err;
} }

View file

@ -2075,7 +2075,8 @@ ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags)
else else
#endif #endif
#ifdef OPENSSL_NO_KTLS #ifdef OPENSSL_NO_KTLS
FUNCerr("sendfile", get_last_sys_error()); ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
"calling sendfile()");
#else #else
SSLerr(SSL_F_SSL_SENDFILE, SSL_R_UNINITIALIZED); SSLerr(SSL_F_SSL_SENDFILE, SSL_R_UNINITIALIZED);
#endif #endif

View file

@ -54,12 +54,13 @@ static int platform_error(void)
file = __FILE__; file = __FILE__;
line = __LINE__ + 1; /* The error is generated on the next line */ line = __LINE__ + 1; /* The error is generated on the next line */
FUNCerr("exit", ERR_R_INTERNAL_ERROR); ERR_raise_data(ERR_LIB_SYS, ERR_R_INTERNAL_ERROR,
"calling exit()");
if (!TEST_ulong_ne(e = ERR_get_error_line_data(&f, &l, &data, NULL), 0) if (!TEST_ulong_ne(e = ERR_get_error_line_data(&f, &l, &data, NULL), 0)
|| !TEST_int_eq(ERR_GET_REASON(e), ERR_R_INTERNAL_ERROR) || !TEST_int_eq(ERR_GET_REASON(e), ERR_R_INTERNAL_ERROR)
|| !TEST_int_eq(l, line) || !TEST_int_eq(l, line)
|| !TEST_str_eq(f, file) || !TEST_str_eq(f, file)
|| !TEST_str_eq(data, "calling function exit")) || !TEST_str_eq(data, "calling exit()"))
return 0; return 0;
return 1; return 1;
} }