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_internal.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_internal.h')
-rw-r--r-- | src/lib/libtls/tls_internal.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index 78ae542cb6..a5399d5594 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.17 2015/09/10 09:10:42 jsing Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.18 2015/09/10 10:14:20 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -52,7 +52,7 @@ struct tls_config { | |||
52 | #define TLS_SERVER (1 << 1) | 52 | #define TLS_SERVER (1 << 1) |
53 | #define TLS_SERVER_CONN (1 << 2) | 53 | #define TLS_SERVER_CONN (1 << 2) |
54 | 54 | ||
55 | #define TLS_STATE_CONNECTING (1 << 0) | 55 | #define TLS_HANDSHAKE_COMPLETE (1 << 0) |
56 | 56 | ||
57 | struct tls { | 57 | struct tls { |
58 | struct tls_config *config; | 58 | struct tls_config *config; |
@@ -62,6 +62,7 @@ struct tls { | |||
62 | char *errmsg; | 62 | char *errmsg; |
63 | int errnum; | 63 | int errnum; |
64 | 64 | ||
65 | char *servername; | ||
65 | int socket; | 66 | int socket; |
66 | 67 | ||
67 | SSL *ssl_conn; | 68 | SSL *ssl_conn; |
@@ -76,6 +77,8 @@ int tls_configure_keypair(struct tls *ctx, int); | |||
76 | int tls_configure_server(struct tls *ctx); | 77 | int tls_configure_server(struct tls *ctx); |
77 | int tls_configure_ssl(struct tls *ctx); | 78 | int tls_configure_ssl(struct tls *ctx); |
78 | int tls_configure_ssl_verify(struct tls *ctx, int verify); | 79 | int tls_configure_ssl_verify(struct tls *ctx, int verify); |
80 | int tls_handshake_client(struct tls *ctx); | ||
81 | int tls_handshake_server(struct tls *ctx); | ||
79 | int tls_host_port(const char *hostport, char **host, char **port); | 82 | int tls_host_port(const char *hostport, char **host, char **port); |
80 | int tls_set_error(struct tls *ctx, const char *fmt, ...) | 83 | int tls_set_error(struct tls *ctx, const char *fmt, ...) |
81 | __attribute__((__format__ (printf, 2, 3))) | 84 | __attribute__((__format__ (printf, 2, 3))) |