diff options
author | 2015-09-10 10:26:49 +0000 | |
---|---|---|
committer | 2015-09-10 10:26:49 +0000 | |
commit | ab00dbef8b611ac35ee186e8442f8f94a6488787 (patch) | |
tree | 2da8622e42af1136f120269972520831d0c8671b | |
parent | Change tls_read and tls_write semantics to return an ssize_t to better (diff) | |
download | wireguard-openbsd-ab00dbef8b611ac35ee186e8442f8f94a6488787.tar.xz wireguard-openbsd-ab00dbef8b611ac35ee186e8442f8f94a6488787.zip |
change TLS_READ_AGAIN to TLS_WANT_POLLIN and TLS_WRITE_AGAIN to TLS_WANT_POLLOUT
to make it more clear to users of this api what needs to be done in these error
cases.
Discussed extensively with bluhm@ and jsing@ and others.
ok jsing@
-rw-r--r-- | lib/libtls/tls.c | 8 | ||||
-rw-r--r-- | lib/libtls/tls.h | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/libtls/tls.c b/lib/libtls/tls.c index c89b805af90..448b048b33c 100644 --- a/lib/libtls/tls.c +++ b/lib/libtls/tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls.c,v 1.21 2015/09/10 10:22:28 beck Exp $ */ +/* $OpenBSD: tls.c,v 1.22 2015/09/10 10:26:49 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -337,10 +337,10 @@ tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, const char *prefix) return (0); case SSL_ERROR_WANT_READ: - return (TLS_READ_AGAIN); + return (TLS_WANT_POLLIN); case SSL_ERROR_WANT_WRITE: - return (TLS_WRITE_AGAIN); + return (TLS_WANT_POLLOUT); case SSL_ERROR_SYSCALL: if ((err = ERR_peek_error()) != 0) { @@ -448,7 +448,7 @@ tls_close(struct tls *ctx) if (ssl_ret < 0) { rv = tls_ssl_error(ctx, ctx->ssl_conn, ssl_ret, "shutdown"); - if (rv == TLS_READ_AGAIN || rv == TLS_WRITE_AGAIN) + if (rv == TLS_WANT_POLLIN || rv == TLS_WANT_POLLOUT) goto out; } } diff --git a/lib/libtls/tls.h b/lib/libtls/tls.h index 13b88c31d47..f7c12920e0d 100644 --- a/lib/libtls/tls.h +++ b/lib/libtls/tls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tls.h,v 1.17 2015/09/10 10:22:28 beck Exp $ */ +/* $OpenBSD: tls.h,v 1.18 2015/09/10 10:26:49 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -36,8 +36,8 @@ extern "C" { #define TLS_PROTOCOLS_ALL TLS_PROTOCOL_TLSv1 #define TLS_PROTOCOLS_DEFAULT TLS_PROTOCOL_TLSv1_2 -#define TLS_READ_AGAIN -2 -#define TLS_WRITE_AGAIN -3 +#define TLS_WANT_POLLIN -2 +#define TLS_WANT_POLLOUT -3 struct tls; struct tls_config; |