diff options
author | 2015-09-13 15:39:15 +0000 | |
---|---|---|
committer | 2015-09-13 15:39:15 +0000 | |
commit | b21e67089b9ae48f0ac67a920bcc1ee41e955c23 (patch) | |
tree | 3661eac3c38cdb0ca05b607c13347cb65651b145 | |
parent | Wrap <rpc/*.h> so that calls go direct and the symbols are all weak. (diff) | |
download | wireguard-openbsd-b21e67089b9ae48f0ac67a920bcc1ee41e955c23.tar.xz wireguard-openbsd-b21e67089b9ae48f0ac67a920bcc1ee41e955c23.zip |
work around the stupid semantics of SSL_read and SSL_write to make sure
we can indicate an EOF properly on tls_read and tls_write
ok jsing@
-rw-r--r-- | lib/libtls/tls.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libtls/tls.c b/lib/libtls/tls.c index 4f89a40be49..3012ea62a63 100644 --- a/lib/libtls/tls.c +++ b/lib/libtls/tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls.c,v 1.28 2015/09/13 13:44:07 beck Exp $ */ +/* $OpenBSD: tls.c,v 1.29 2015/09/13 15:39:15 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -416,7 +416,7 @@ tls_read(struct tls *ctx, void *buf, size_t buflen) } ERR_clear_error(); - if ((ssl_ret = SSL_read(ctx->ssl_conn, buf, buflen)) > 0) { + if ((ssl_ret = SSL_read(ctx->ssl_conn, buf, buflen)) >= 0) { rv = (ssize_t)ssl_ret; goto out; } @@ -445,7 +445,7 @@ tls_write(struct tls *ctx, const void *buf, size_t buflen) } ERR_clear_error(); - if ((ssl_ret = SSL_write(ctx->ssl_conn, buf, buflen)) > 0) { + if ((ssl_ret = SSL_write(ctx->ssl_conn, buf, buflen)) >= 0) { rv = (ssize_t)ssl_ret; goto out; } |