diff options
author | jsing <> | 2015-09-10 10:14:21 +0000 |
---|---|---|
committer | jsing <> | 2015-09-10 10:14:21 +0000 |
commit | f7415644a66ca9d04e5e06312a163e677032b695 (patch) | |
tree | b1c4283700879b3793a5395cbab5ffd49e03f34f /src/lib/libtls/tls.h | |
parent | fb8be3d22f2620af8ca6f69de96a1d4e5a8d153b (diff) | |
download | openbsd-f7415644a66ca9d04e5e06312a163e677032b695.tar.gz openbsd-f7415644a66ca9d04e5e06312a163e677032b695.tar.bz2 openbsd-f7415644a66ca9d04e5e06312a163e677032b695.zip |
Split tls_handshake() out from tls_accept/tls_connect. By doing this the
tls_accept/tls_connect functions can be guaranteed to succeed or fail and
will no longer return TLS_READ_AGAIN/TLS_WRITE_AGAIN. This also resolves
the semantics of tls_accept_*.
The tls_handshake() function now does I/O and can return
TLS_READ_AGAIN/TLS_WRITE_AGAIN. Calls to tls_read() and tls_write() will
trigger the handshake if it has not already completed, meaning that in many
cases existing code will continue to work.
Discussed over many coffees at l2k15.
ok beck@ bluhm@
Diffstat (limited to 'src/lib/libtls/tls.h')
-rw-r--r-- | src/lib/libtls/tls.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libtls/tls.h b/src/lib/libtls/tls.h index 579a97798e..8548fe1d83 100644 --- a/src/lib/libtls/tls.h +++ b/src/lib/libtls/tls.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls.h,v 1.15 2015/09/10 09:10:42 jsing Exp $ */ | 1 | /* $OpenBSD: tls.h,v 1.16 2015/09/10 10:14:20 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -94,6 +94,7 @@ int tls_connect_fds(struct tls *_ctx, int _fd_read, int _fd_write, | |||
94 | int tls_connect_servername(struct tls *_ctx, const char *_host, | 94 | int tls_connect_servername(struct tls *_ctx, const char *_host, |
95 | const char *_port, const char *_servername); | 95 | const char *_port, const char *_servername); |
96 | int tls_connect_socket(struct tls *_ctx, int _s, const char *_servername); | 96 | int tls_connect_socket(struct tls *_ctx, int _s, const char *_servername); |
97 | int tls_handshake(struct tls *_ctx); | ||
97 | int tls_read(struct tls *_ctx, void *_buf, size_t _buflen, size_t *_outlen); | 98 | int tls_read(struct tls *_ctx, void *_buf, size_t _buflen, size_t *_outlen); |
98 | int tls_write(struct tls *_ctx, const void *_buf, size_t _buflen, | 99 | int tls_write(struct tls *_ctx, const void *_buf, size_t _buflen, |
99 | size_t *_outlen); | 100 | size_t *_outlen); |