diff options
author | jsing <> | 2016-08-15 14:04:23 +0000 |
---|---|---|
committer | jsing <> | 2016-08-15 14:04:23 +0000 |
commit | b625f466ed086e94acecb66a8ddd3309cb0e3006 (patch) | |
tree | 0f8db1f8992ad067c26b92b7063f1d0e0e260bb8 /src/lib/libtls/tls_client.c | |
parent | 27106e2b77c6e7da64be6b4849b458e997106b07 (diff) | |
download | openbsd-b625f466ed086e94acecb66a8ddd3309cb0e3006.tar.gz openbsd-b625f466ed086e94acecb66a8ddd3309cb0e3006.tar.bz2 openbsd-b625f466ed086e94acecb66a8ddd3309cb0e3006.zip |
Explicitly pass in an SSL_CTX * to the functions that operate on one,
instead of assuming that they should use the one associated with the TLS
context. This allows these functions to be used with the additional
SSL contexts that are needed to support server-side SNI.
Also rename tls_configure_keypair() to tls_configure_ssl_keypair(), so that
these functions have a common prefix.
ok reyk@
Diffstat (limited to 'src/lib/libtls/tls_client.c')
-rw-r--r-- | src/lib/libtls/tls_client.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libtls/tls_client.c b/src/lib/libtls/tls_client.c index 3847f4c46c..c360ecad52 100644 --- a/src/lib/libtls/tls_client.c +++ b/src/lib/libtls/tls_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_client.c,v 1.33 2016/04/28 17:05:59 jsing Exp $ */ | 1 | /* $OpenBSD: tls_client.c,v 1.34 2016/08/15 14:04:23 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -193,9 +193,10 @@ tls_connect_fds(struct tls *ctx, int fd_read, int fd_write, | |||
193 | goto err; | 193 | goto err; |
194 | } | 194 | } |
195 | 195 | ||
196 | if (tls_configure_ssl(ctx) != 0) | 196 | if (tls_configure_ssl(ctx, ctx->ssl_ctx) != 0) |
197 | goto err; | 197 | goto err; |
198 | if (tls_configure_keypair(ctx, ctx->ssl_ctx, ctx->config->keypair, 0) != 0) | 198 | if (tls_configure_ssl_keypair(ctx, ctx->ssl_ctx, |
199 | ctx->config->keypair, 0) != 0) | ||
199 | goto err; | 200 | goto err; |
200 | 201 | ||
201 | if (ctx->config->verify_name) { | 202 | if (ctx->config->verify_name) { |
@@ -204,9 +205,9 @@ tls_connect_fds(struct tls *ctx, int fd_read, int fd_write, | |||
204 | goto err; | 205 | goto err; |
205 | } | 206 | } |
206 | } | 207 | } |
207 | |||
208 | if (ctx->config->verify_cert && | 208 | if (ctx->config->verify_cert && |
209 | (tls_configure_ssl_verify(ctx, SSL_VERIFY_PEER) == -1)) | 209 | (tls_configure_ssl_verify(ctx, ctx->ssl_ctx, |
210 | SSL_VERIFY_PEER) == -1)) | ||
210 | goto err; | 211 | goto err; |
211 | 212 | ||
212 | if ((ctx->ssl_conn = SSL_new(ctx->ssl_ctx)) == NULL) { | 213 | if ((ctx->ssl_conn = SSL_new(ctx->ssl_ctx)) == NULL) { |