From b3d3feb177ffdc6bb25ec7d46293635877fe80d0 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 14 Jun 2012 19:32:01 +0000 Subject: Profiling with valgrind shows that the 2**16 iteration for finding ciphersuites was actually a substantial hit on handshakes. Add a new function TLS::Ciphersuite::all_known_ciphersuites which will do this once and cache it for future use. --- src/tls/tls_ciphersuite.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/tls/tls_ciphersuite.h') diff --git a/src/tls/tls_ciphersuite.h b/src/tls/tls_ciphersuite.h index dcb4b6a6f..346c34f0b 100644 --- a/src/tls/tls_ciphersuite.h +++ b/src/tls/tls_ciphersuite.h @@ -10,6 +10,7 @@ #include #include +#include namespace Botan { @@ -28,11 +29,15 @@ class BOTAN_DLL Ciphersuite static Ciphersuite by_name(const std::string& name); + static const std::vector& all_known_ciphersuites(); + /** * Formats the ciphersuite back to an RFC-style ciphersuite string */ std::string to_string() const; + u16bit ciphersuite_code() const { return m_ciphersuite_code; } + bool psk_ciphersuite() const; bool ecc_ciphersuite() const; @@ -48,11 +53,13 @@ class BOTAN_DLL Ciphersuite Ciphersuite() : m_cipher_keylen(0) {} - Ciphersuite(const std::string& sig_algo, + Ciphersuite(u16bit ciphersuite_code, + const std::string& sig_algo, const std::string& kex_algo, const std::string& mac_algo, const std::string& cipher_algo, size_t cipher_algo_keylen) : + m_ciphersuite_code(ciphersuite_code), m_sig_algo(sig_algo), m_kex_algo(kex_algo), m_mac_algo(mac_algo), @@ -62,6 +69,7 @@ class BOTAN_DLL Ciphersuite } private: + u16bit m_ciphersuite_code; std::string m_sig_algo, m_kex_algo, m_mac_algo, m_cipher_algo; size_t m_cipher_keylen; }; -- cgit v1.2.3