summaryrefslogtreecommitdiff
path: root/lib/libtls/tls.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2016-08-12 15:11:00 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2016-08-12 15:11:00 +0000
commitbf91b154a7b0596d994ed2636f58f1d37b53372e (patch)
tree02af696dd48ab6ca12e765f81b069032d6e84780 /lib/libtls/tls.c
parent92144faf0d7a2ad33a2ba4a2aa82903c07f29c52 (diff)
Add ALPN support to libtls.
ok beck@ doug@
Diffstat (limited to 'lib/libtls/tls.c')
-rw-r--r--lib/libtls/tls.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libtls/tls.c b/lib/libtls/tls.c
index ddf847d390e..4d4910d128d 100644
--- a/lib/libtls/tls.c
+++ b/lib/libtls/tls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls.c,v 1.43 2016/08/02 07:47:11 jsing Exp $ */
+/* $OpenBSD: tls.c,v 1.44 2016/08/12 15:10:59 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -310,6 +310,14 @@ tls_configure_ssl(struct tls *ctx)
if ((ctx->config->protocols & TLS_PROTOCOL_TLSv1_2) == 0)
SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_TLSv1_2);
+ if (ctx->config->alpn != NULL) {
+ if (SSL_CTX_set_alpn_protos(ctx->ssl_ctx, ctx->config->alpn,
+ ctx->config->alpn_len) != 0) {
+ tls_set_errorx(ctx, "failed to set alpn");
+ goto err;
+ }
+ }
+
if (ctx->config->ciphers != NULL) {
if (SSL_CTX_set_cipher_list(ctx->ssl_ctx,
ctx->config->ciphers) != 1) {