summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_conninfo.c
diff options
context:
space:
mode:
authorjsing <>2016-08-22 14:55:59 +0000
committerjsing <>2016-08-22 14:55:59 +0000
commit9471125540d25a0117670bd41ea6c3a0ff7844eb (patch)
treeb381f554fd76ea61d743e75d83ea05d769d71108 /src/lib/libtls/tls_conninfo.c
parent74ebdd842595c2d6c66a0aa102dc5c4b98412c8d (diff)
downloadopenbsd-9471125540d25a0117670bd41ea6c3a0ff7844eb.tar.gz
openbsd-9471125540d25a0117670bd41ea6c3a0ff7844eb.tar.bz2
openbsd-9471125540d25a0117670bd41ea6c3a0ff7844eb.zip
Provide an API that enables server side SNI support - add the ability to
provide additional keypairs (via tls_config_add_keypair_{file,mem}()) and allow the server to determine what servername the client requested (via tls_conn_servername()). ok beck@
Diffstat (limited to 'src/lib/libtls/tls_conninfo.c')
-rw-r--r--src/lib/libtls/tls_conninfo.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c
index 523b2798d3..281af79866 100644
--- a/src/lib/libtls/tls_conninfo.c
+++ b/src/lib/libtls/tls_conninfo.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_conninfo.c,v 1.9 2016/08/15 14:47:41 jsing Exp $ */ 1/* $OpenBSD: tls_conninfo.c,v 1.10 2016/08/22 14:55:59 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2015 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2015 Bob Beck <beck@openbsd.org>
@@ -199,6 +199,11 @@ tls_get_conninfo(struct tls *ctx)
199 goto err; 199 goto err;
200 if (tls_conninfo_alpn_proto(ctx) == -1) 200 if (tls_conninfo_alpn_proto(ctx) == -1)
201 goto err; 201 goto err;
202 if (ctx->servername != NULL) {
203 if ((ctx->conninfo->servername =
204 strdup(ctx->servername)) == NULL)
205 goto err;
206 }
202 207
203 return (0); 208 return (0);
204err: 209err:
@@ -242,6 +247,14 @@ tls_conn_cipher(struct tls *ctx)
242} 247}
243 248
244const char * 249const char *
250tls_conn_servername(struct tls *ctx)
251{
252 if (ctx->conninfo == NULL)
253 return (NULL);
254 return (ctx->conninfo->servername);
255}
256
257const char *
245tls_conn_version(struct tls *ctx) 258tls_conn_version(struct tls *ctx)
246{ 259{
247 if (ctx->conninfo == NULL) 260 if (ctx->conninfo == NULL)