aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-03-28 15:07:56 +0000
committerlloyd <[email protected]>2013-03-28 15:07:56 +0000
commit55f11acaa300e5d96de593e69cb7e28d612a1959 (patch)
treeb45b503152e140682befac31fffbb220cd0f21d8
parent24e3acc8bb4da1b1f928a85c54984c99a112f80f (diff)
Have tls_suite_info.py generate the entire source file
instead of just the switch. Next step should be having it be run by configure at build time and a copy of the the params included in build-data
-rwxr-xr-xsrc/build-data/scripts/tls_suite_info.py31
-rw-r--r--src/tls/tls_suite_info.cpp12
2 files changed, 37 insertions, 6 deletions
diff --git a/src/build-data/scripts/tls_suite_info.py b/src/build-data/scripts/tls_suite_info.py
index 386e4c906..7e2ec3acb 100755
--- a/src/build-data/scripts/tls_suite_info.py
+++ b/src/build-data/scripts/tls_suite_info.py
@@ -133,6 +133,28 @@ def main(args = None):
# From http://tools.ietf.org/html/draft-ietf-tls-56-bit-ciphersuites-01
suites['DHE_DSS_WITH_RC4_128_SHA'] = ('0066', to_ciphersuite_info('0066', 'DHE_DSS_WITH_RC4_128_SHA'))
+ print """/*
+* List of TLS cipher suites
+*
+* This file was automatically generated from the IANA assignments
+* by %s
+*
+* Released under the terms of the Botan license
+*/
+
+#include <botan/tls_ciphersuite.h>
+
+namespace Botan {
+
+namespace TLS {
+
+Ciphersuite Ciphersuite::by_id(u16bit suite)
+ {
+
+ switch(suite)
+ {
+""" % (sys.argv[0])
+
for k in sorted(suites.keys()):
print " case 0x%s: // %s" % (suites[k][0], k)
print " return %s;" % (suites[k][1])
@@ -143,5 +165,14 @@ def main(args = None):
# print "0x%s, " % (k),
#print "});"
+ print """ }
+
+ return Ciphersuite(); // some unknown ciphersuite
+ }
+
+}
+
+}"""
+
if __name__ == '__main__':
sys.exit(main())
diff --git a/src/tls/tls_suite_info.cpp b/src/tls/tls_suite_info.cpp
index 33df10776..70d938979 100644
--- a/src/tls/tls_suite_info.cpp
+++ b/src/tls/tls_suite_info.cpp
@@ -1,6 +1,8 @@
/*
-* TLS Cipher Suite
-* (C) 2004-2010,2012 Jack Lloyd
+* List of TLS cipher suites
+*
+* This file was automatically generated from the IANA assignments
+* by ./src/build-data/scripts/tls_suite_info.py
*
* Released under the terms of the Botan license
*/
@@ -13,13 +15,10 @@ namespace TLS {
Ciphersuite Ciphersuite::by_id(u16bit suite)
{
- /*
- * This switch was automatically generated from the IANA assignments
- * by the script src/build-data/scripts/parse_tls_params.py
- */
switch(suite)
{
+
case 0x0013: // DHE_DSS_WITH_3DES_EDE_CBC_SHA
return Ciphersuite(0x0013, "DSA", "DH", "SHA-1", "3DES", 24);
@@ -310,6 +309,7 @@ Ciphersuite Ciphersuite::by_id(u16bit suite)
case 0xC020: // SRP_SHA_WITH_AES_256_CBC_SHA
return Ciphersuite(0xC020, "", "SRP_SHA", "SHA-1", "AES-256", 32);
+
}
return Ciphersuite(); // some unknown ciphersuite