summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_conninfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libtls/tls_conninfo.c')
-rw-r--r--src/lib/libtls/tls_conninfo.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c
index 93526fceeb..6caf655536 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.6 2016/08/01 17:32:19 jsing Exp $ */ 1/* $OpenBSD: tls_conninfo.c,v 1.7 2016/08/02 07:47:11 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>
@@ -150,26 +150,6 @@ tls_get_peer_cert_times(struct tls *ctx, time_t *notbefore, time_t *notafter)
150 return (rv); 150 return (rv);
151} 151}
152 152
153static int
154tls_conninfo_alpn_proto(struct tls *ctx)
155{
156 const unsigned char *p;
157 unsigned int len;
158
159 free(ctx->conninfo->alpn);
160 ctx->conninfo->alpn = NULL;
161
162 SSL_get0_alpn_selected(ctx->ssl_conn, &p, &len);
163 if (len > 0) {
164 if ((ctx->conninfo->alpn = malloc(len + 1)) == NULL)
165 return (-1);
166 memcpy(ctx->conninfo->alpn, p, len);
167 ctx->conninfo->alpn[len] = '\0';
168 }
169
170 return (0);
171}
172
173int 153int
174tls_get_conninfo(struct tls *ctx) { 154tls_get_conninfo(struct tls *ctx) {
175 const char * tmp; 155 const char * tmp;
@@ -195,9 +175,6 @@ tls_get_conninfo(struct tls *ctx) {
195 ctx->conninfo->cipher = strdup(tmp); 175 ctx->conninfo->cipher = strdup(tmp);
196 if (ctx->conninfo->cipher == NULL) 176 if (ctx->conninfo->cipher == NULL)
197 goto err; 177 goto err;
198 if (tls_conninfo_alpn_proto(ctx) == -1)
199 goto err;
200
201 return (0); 178 return (0);
202err: 179err:
203 tls_free_conninfo(ctx->conninfo); 180 tls_free_conninfo(ctx->conninfo);
@@ -207,8 +184,6 @@ err:
207void 184void
208tls_free_conninfo(struct tls_conninfo *conninfo) { 185tls_free_conninfo(struct tls_conninfo *conninfo) {
209 if (conninfo != NULL) { 186 if (conninfo != NULL) {
210 free(conninfo->alpn);
211 conninfo->alpn = NULL;
212 free(conninfo->hash); 187 free(conninfo->hash);
213 conninfo->hash = NULL; 188 conninfo->hash = NULL;
214 free(conninfo->subject); 189 free(conninfo->subject);
@@ -223,14 +198,6 @@ tls_free_conninfo(struct tls_conninfo *conninfo) {
223} 198}
224 199
225const char * 200const char *
226tls_conn_alpn_selected(struct tls *ctx)
227{
228 if (ctx->conninfo == NULL)
229 return (NULL);
230 return (ctx->conninfo->alpn);
231}
232
233const char *
234tls_conn_cipher(struct tls *ctx) 201tls_conn_cipher(struct tls *ctx)
235{ 202{
236 if (ctx->conninfo == NULL) 203 if (ctx->conninfo == NULL)