diff options
author | Jack Lloyd <[email protected]> | 2016-08-17 11:13:28 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-08-17 11:13:28 -0400 |
commit | 199c53632878f3eb73a12239b23eaf1929225e5b (patch) | |
tree | 7ba2bc687c30fd99e435dc67ff8df6ca525a8c7a /src/scripts | |
parent | c3c4f22ec2c65f32f55255eeac69c9923a0c7c05 (diff) | |
parent | b740f4dd6957d9beaf451854907916f1fb5f7a20 (diff) |
Merge GH #583 Clean up TLS ciphersuite handling
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/tls_suite_info.py | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/src/scripts/tls_suite_info.py b/src/scripts/tls_suite_info.py index 1f094f4b5..1d059b3f9 100755 --- a/src/scripts/tls_suite_info.py +++ b/src/scripts/tls_suite_info.py @@ -293,48 +293,25 @@ namespace Botan { namespace TLS { -std::vector<u16bit> Ciphersuite::all_known_ciphersuite_ids() +//static +const std::vector<Ciphersuite>& Ciphersuite::all_known_ciphersuites() { - return std::vector<u16bit>{ + // Note that this list of ciphersuites is ordered by id! + static const std::vector<Ciphersuite> g_ciphersuite_list = { """ - for i in sorted(suites.keys()): - suite_info += " 0x%s,\n" % (i) - - suite_info += """ }; -} - -Ciphersuite Ciphersuite::by_id(u16bit suite) - { - switch(suite) - { -""" - - """ - Ciphersuite(u16bit ciphersuite_code, - const char* sig_algo, - const char* kex_algo, - const char* cipher_algo, - size_t cipher_keylen, - size_t nonce_bytes_from_handshake, - size_t nonce_bytes_from_record, - const char* mac_algo, - size_t mac_keylen, - const char* prf_algo = ""); - """ - for code in sorted(suites.keys()): info = suites[code] assert len(info) == 11 suite_expr = 'Ciphersuite(0x%s, "%s", "%s", "%s", "%s", %d, %d, %d, "%s", %d, "%s")' % ( code, info[0], info[2], info[3], info[4], info[5], info[6], info[7], info[8], info[9], info[10]) - suite_info += " case 0x%s:\n" % (code) - suite_info += " return %s;\n\n" % (suite_expr) + suite_info += " " + suite_expr + ",\n" + - suite_info += """ } + suite_info += """ }; - return Ciphersuite(); // some unknown ciphersuite + return g_ciphersuite_list; } } |