diff options
author | jsing <> | 2019-11-02 13:37:59 +0000 |
---|---|---|
committer | jsing <> | 2019-11-02 13:37:59 +0000 |
commit | 914deddb0bc7631f9603d3f22c07d8b3b6031d80 (patch) | |
tree | 26dff2e2873d1fd641e2d14891cef32db1d1f78c /src/lib/libtls/tls_conninfo.c | |
parent | b644d775987df82f8b5579d05ae3e3fb2bace0f7 (diff) | |
download | openbsd-914deddb0bc7631f9603d3f22c07d8b3b6031d80.tar.gz openbsd-914deddb0bc7631f9603d3f22c07d8b3b6031d80.tar.bz2 openbsd-914deddb0bc7631f9603d3f22c07d8b3b6031d80.zip |
Provide tls_conn_cipher_strength().
This returns the strength in bits of the symmetric cipher used for the
connection.
Diff from gilles@
ok tb@
Diffstat (limited to 'src/lib/libtls/tls_conninfo.c')
-rw-r--r-- | src/lib/libtls/tls_conninfo.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c index 8e479ed84c..d44dc842b6 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.20 2018/02/10 04:48:44 jsing Exp $ */ | 1 | /* $OpenBSD: tls_conninfo.c,v 1.21 2019/11/02 13:37: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> |
@@ -246,6 +246,7 @@ tls_conninfo_populate(struct tls *ctx) | |||
246 | goto err; | 246 | goto err; |
247 | if ((ctx->conninfo->cipher = strdup(tmp)) == NULL) | 247 | if ((ctx->conninfo->cipher = strdup(tmp)) == NULL) |
248 | goto err; | 248 | goto err; |
249 | ctx->conninfo->cipher_strength = SSL_get_cipher_bits(ctx->ssl_conn, NULL); | ||
249 | 250 | ||
250 | if (ctx->servername != NULL) { | 251 | if (ctx->servername != NULL) { |
251 | if ((ctx->conninfo->servername = | 252 | if ((ctx->conninfo->servername = |
@@ -312,6 +313,14 @@ tls_conn_cipher(struct tls *ctx) | |||
312 | return (ctx->conninfo->cipher); | 313 | return (ctx->conninfo->cipher); |
313 | } | 314 | } |
314 | 315 | ||
316 | int | ||
317 | tls_conn_cipher_strength(struct tls *ctx) | ||
318 | { | ||
319 | if (ctx->conninfo == NULL) | ||
320 | return (0); | ||
321 | return (ctx->conninfo->cipher_strength); | ||
322 | } | ||
323 | |||
315 | const char * | 324 | const char * |
316 | tls_conn_servername(struct tls *ctx) | 325 | tls_conn_servername(struct tls *ctx) |
317 | { | 326 | { |