summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_conninfo.c
diff options
context:
space:
mode:
authorbeck <>2015-09-13 10:32:46 +0000
committerbeck <>2015-09-13 10:32:46 +0000
commitf93b2a484d9aebe61957094cb379ae61ed797792 (patch)
treeaab2e062ca9f5654643e90c10a858b88227429bb /src/lib/libtls/tls_conninfo.c
parent12350069f382f5c9604542a187f5f13cdc426704 (diff)
downloadopenbsd-f93b2a484d9aebe61957094cb379ae61ed797792.tar.gz
openbsd-f93b2a484d9aebe61957094cb379ae61ed797792.tar.bz2
openbsd-f93b2a484d9aebe61957094cb379ae61ed797792.zip
add visibility of ciper and connection version strings
ok jsing@
Diffstat (limited to 'src/lib/libtls/tls_conninfo.c')
-rw-r--r--src/lib/libtls/tls_conninfo.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c
index 267a8747c9..0c99741b63 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.1 2015/09/12 21:00:38 beck Exp $ */ 1/* $OpenBSD: tls_conninfo.c,v 1.2 2015/09/13 10:32:46 beck 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>
@@ -130,6 +130,12 @@ tls_get_conninfo(struct tls *ctx) {
130 goto err; 130 goto err;
131 if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1) 131 if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1)
132 goto err; 132 goto err;
133 ctx->conninfo->version = strdup(SSL_get_version(ctx->ssl_conn));
134 if (ctx->conninfo->version == NULL)
135 goto err;
136 ctx->conninfo->cipher = strdup(SSL_get_cipher(ctx->ssl_conn));
137 if (ctx->conninfo->cipher == NULL)
138 goto err;
133 } 139 }
134 rv = 0; 140 rv = 0;
135err: 141err:
@@ -145,5 +151,25 @@ tls_free_conninfo(struct tls_conninfo *conninfo) {
145 conninfo->subject = NULL; 151 conninfo->subject = NULL;
146 free(conninfo->issuer); 152 free(conninfo->issuer);
147 conninfo->issuer = NULL; 153 conninfo->issuer = NULL;
154 free(conninfo->version);
155 conninfo->version = NULL;
156 free(conninfo->cipher);
157 conninfo->cipher = NULL;
148 } 158 }
149} 159}
160
161const char *
162tls_conn_cipher(struct tls *ctx)
163{
164 if (ctx->conninfo)
165 return (ctx->conninfo->cipher);
166 return NULL;
167}
168
169const char *
170tls_conn_version(struct tls *ctx)
171{
172 if (ctx->conninfo)
173 return (ctx->conninfo->version);
174 return NULL;
175}