summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-08-23 13:56:09 -0700
committerMatt Caswell <matt@openssl.org>2019-10-31 10:24:32 +0000
commit712c0942939c9aba2f2afadb9e4276b1a3df1345 (patch)
tree32593e052742092e0187515474c30f6e845fa403 /ssl
parent54f30cb57c78e5390d951e4a0c4d0bf2ce0d86a1 (diff)
Simplify NO_KTLS path in SSL_sendfile.
Avoid tripping over errno values from previous system calls in the thread and just hardcode the specific error. BIO_get_ktls_send() should never be true in the NO_KTLS path, so the #ifdef could be moved even higher up to assume that error path in the NO_KTLS case instead. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10045)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_lib.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 794af76530..61c90218e3 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -2061,11 +2061,11 @@ ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags)
return -1;
}
-#ifndef OPENSSL_NO_KTLS
- ret = ktls_sendfile(SSL_get_wfd(s), fd, offset, size, flags);
+#ifdef OPENSSL_NO_KTLS
+ ERR_raise_data(ERR_LIB_SYS, ERR_R_INTERNAL_ERROR, "calling sendfile()");
+ return -1;
#else
- ret = -1;
-#endif
+ ret = ktls_sendfile(SSL_get_wfd(s), fd, offset, size, flags);
if (ret < 0) {
#if defined(EAGAIN) && defined(EINTR) && defined(EBUSY)
if ((get_last_sys_error() == EAGAIN) ||
@@ -2074,16 +2074,12 @@ ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags)
BIO_set_retry_write(s->wbio);
else
#endif
-#ifdef OPENSSL_NO_KTLS
- ERR_raise_data(ERR_LIB_SYS, get_last_sys_error(),
- "calling sendfile()");
-#else
SSLerr(SSL_F_SSL_SENDFILE, SSL_R_UNINITIALIZED);
-#endif
return ret;
}
s->rwstate = SSL_NOTHING;
return ret;
+#endif
}
int SSL_write(SSL *s, const void *buf, int num)