aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-11-29 17:41:37 (GMT)
committerJouni Malinen <j@w1.fi>2015-11-29 17:41:37 (GMT)
commit20804fe8448df81a875e0b62d3ee01e696caa90a (patch)
tree67f3c096a347590870e9f33aeb38cf64476dad08 /src/tls
parentbb0a72ab4621fff633ac719d71de04f574850b65 (diff)
downloadhostap-20804fe8448df81a875e0b62d3ee01e696caa90a.zip
hostap-20804fe8448df81a875e0b62d3ee01e696caa90a.tar.gz
hostap-20804fe8448df81a875e0b62d3ee01e696caa90a.tar.bz2
TLS: Add support for tls_get_version()
This allows wpa_supplicant to return eap_tls_version STATUS information when using the internal TLS client implementation. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/tlsv1_client.c23
-rw-r--r--src/tls/tlsv1_client.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/src/tls/tlsv1_client.c b/src/tls/tlsv1_client.c
index 49ebf2f..26f055c 100644
--- a/src/tls/tlsv1_client.c
+++ b/src/tls/tlsv1_client.c
@@ -838,3 +838,26 @@ void tlsv1_client_set_cb(struct tlsv1_client *conn,
conn->cb_ctx = cb_ctx;
conn->cert_in_cb = !!cert_in_cb;
}
+
+
+int tlsv1_client_get_version(struct tlsv1_client *conn, char *buf,
+ size_t buflen)
+{
+ if (!conn)
+ return -1;
+ switch (conn->rl.tls_version) {
+ case TLS_VERSION_1:
+ os_strlcpy(buf, "TLSv1", buflen);
+ break;
+ case TLS_VERSION_1_1:
+ os_strlcpy(buf, "TLSv1.1", buflen);
+ break;
+ case TLS_VERSION_1_2:
+ os_strlcpy(buf, "TLSv1.2", buflen);
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/tls/tlsv1_client.h b/src/tls/tlsv1_client.h
index bbfb8bd..95bd545 100644
--- a/src/tls/tlsv1_client.h
+++ b/src/tls/tlsv1_client.h
@@ -56,5 +56,7 @@ void tlsv1_client_set_cb(struct tlsv1_client *conn,
union tls_event_data *data),
void *cb_ctx,
int cert_in_cb);
+int tlsv1_client_get_version(struct tlsv1_client *conn, char *buf,
+ size_t buflen);
#endif /* TLSV1_CLIENT_H */