summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_internal.h
diff options
context:
space:
mode:
authorjsing <>2016-08-22 14:51:37 +0000
committerjsing <>2016-08-22 14:51:37 +0000
commit74ebdd842595c2d6c66a0aa102dc5c4b98412c8d (patch)
treee04823f4dbd54041cadc277b3cfa2714bd318c36 /src/lib/libtls/tls_internal.h
parent60132b75420595a9684003b199d3299fe13ec457 (diff)
downloadopenbsd-74ebdd842595c2d6c66a0aa102dc5c4b98412c8d.tar.gz
openbsd-74ebdd842595c2d6c66a0aa102dc5c4b98412c8d.tar.bz2
openbsd-74ebdd842595c2d6c66a0aa102dc5c4b98412c8d.zip
Create contexts for server side SNI - these include the additional SSL_CTX
that is required for certificate switching with libssl and the certificate itself so that we can match against the subject and SANs. Hook up the servername callback and switch to the appropriate SSL_CTX if we find a matching certificate. ok beck@
Diffstat (limited to 'src/lib/libtls/tls_internal.h')
-rw-r--r--src/lib/libtls/tls_internal.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h
index bbd231e00e..428e29c857 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.39 2016/08/15 15:44:58 jsing Exp $ */ 1/* $OpenBSD: tls_internal.h,v 1.40 2016/08/22 14:51:37 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>
@@ -91,6 +91,13 @@ struct tls_conninfo {
91#define TLS_EOF_NO_CLOSE_NOTIFY (1 << 0) 91#define TLS_EOF_NO_CLOSE_NOTIFY (1 << 0)
92#define TLS_HANDSHAKE_COMPLETE (1 << 1) 92#define TLS_HANDSHAKE_COMPLETE (1 << 1)
93 93
94struct tls_sni_ctx {
95 struct tls_sni_ctx *next;
96
97 SSL_CTX *ssl_ctx;
98 X509 *ssl_cert;
99};
100
94struct tls { 101struct tls {
95 struct tls_config *config; 102 struct tls_config *config;
96 struct tls_error error; 103 struct tls_error error;
@@ -103,11 +110,17 @@ struct tls {
103 110
104 SSL *ssl_conn; 111 SSL *ssl_conn;
105 SSL_CTX *ssl_ctx; 112 SSL_CTX *ssl_ctx;
113
114 struct tls_sni_ctx *sni_ctx;
115
106 X509 *ssl_peer_cert; 116 X509 *ssl_peer_cert;
107 117
108 struct tls_conninfo *conninfo; 118 struct tls_conninfo *conninfo;
109}; 119};
110 120
121struct tls_sni_ctx *tls_sni_ctx_new(void);
122void tls_sni_ctx_free(struct tls_sni_ctx *sni_ctx);
123
111struct tls *tls_new(void); 124struct tls *tls_new(void);
112struct tls *tls_server_conn(struct tls *ctx); 125struct tls *tls_server_conn(struct tls *ctx);
113 126