aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tlsv1_common.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-11-27 19:20:18 (GMT)
committerJouni Malinen <j@w1.fi>2011-11-27 19:20:18 (GMT)
commitebe4e8f814456bc74534d7c99e1dd6b184b79858 (patch)
tree1634a60038ddaf635c67ea22e16dcf932868bf21 /src/tls/tlsv1_common.c
parent8307489840f79fab916c6125c03ebb5ad382c9d6 (diff)
downloadhostap-ebe4e8f814456bc74534d7c99e1dd6b184b79858.zip
hostap-ebe4e8f814456bc74534d7c99e1dd6b184b79858.tar.gz
hostap-ebe4e8f814456bc74534d7c99e1dd6b184b79858.tar.bz2
TLS: Add helper functions for version number handling
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/tls/tlsv1_common.c')
-rw-r--r--src/tls/tlsv1_common.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/tls/tlsv1_common.c b/src/tls/tlsv1_common.c
index 2f9dd0f..67b56df 100644
--- a/src/tls/tlsv1_common.c
+++ b/src/tls/tlsv1_common.c
@@ -1,6 +1,6 @@
/*
* TLSv1 common routines
- * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2006-2011, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -239,3 +239,29 @@ void tls_verify_hash_free(struct tls_verify_hash *verify)
verify->sha1_server = NULL;
verify->sha1_cert = NULL;
}
+
+
+int tls_version_ok(u16 ver)
+{
+ if (ver == TLS_VERSION_1)
+ return 1;
+#ifdef CONFIG_TLSV11
+ if (ver == TLS_VERSION_1_1)
+ return 1;
+#endif /* CONFIG_TLSV11 */
+
+ return 0;
+}
+
+
+const char * tls_version_str(u16 ver)
+{
+ switch (ver) {
+ case TLS_VERSION_1:
+ return "1.0";
+ case TLS_VERSION_1_1:
+ return "1.1";
+ }
+
+ return "?";
+}