aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2017-12-27 22:29:18 (GMT)
committerJouni Malinen <j@w1.fi>2017-12-28 20:33:06 (GMT)
commitf8697e81094854e478afdbb85a86e2b27f759b91 (patch)
tree3ac440ae6a4bea7c654d893e85dcc4dd53a909a4
parent6e6651d02e9d35460760a89a345e4f63716a74cb (diff)
downloadhostap-f8697e81094854e478afdbb85a86e2b27f759b91.zip
hostap-f8697e81094854e478afdbb85a86e2b27f759b91.tar.gz
hostap-f8697e81094854e478afdbb85a86e2b27f759b91.tar.bz2
GnuTLS: Implement tls_get_version()
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/crypto/tls_gnutls.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/crypto/tls_gnutls.c b/src/crypto/tls_gnutls.c
index 8c76bfa..b94f1ea 100644
--- a/src/crypto/tls_gnutls.c
+++ b/src/crypto/tls_gnutls.c
@@ -1,6 +1,6 @@
/*
* SSL/TLS interface functions for GnuTLS
- * Copyright (c) 2004-2011, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2017, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -1501,8 +1501,18 @@ int tls_connection_set_cipher_list(void *tls_ctx, struct tls_connection *conn,
int tls_get_version(void *ssl_ctx, struct tls_connection *conn,
char *buf, size_t buflen)
{
- /* TODO */
- return -1;
+ gnutls_protocol_t ver;
+
+ ver = gnutls_protocol_get_version(conn->session);
+ if (ver == GNUTLS_TLS1_0)
+ os_strlcpy(buf, "TLSv1", buflen);
+ else if (ver == GNUTLS_TLS1_1)
+ os_strlcpy(buf, "TLSv1.1", buflen);
+ else if (ver == GNUTLS_TLS1_2)
+ os_strlcpy(buf, "TLSv1.2", buflen);
+ else
+ return -1;
+ return 0;
}