diff options
author | lloyd <[email protected]> | 2012-06-14 19:32:01 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-06-14 19:32:01 +0000 |
commit | b3d3feb177ffdc6bb25ec7d46293635877fe80d0 (patch) | |
tree | 5cc29ea5810c30095afa59e090f02874fc1c00e7 /src/tls/tls_ciphersuite.h | |
parent | 8227a598cbbd35f3eced99ae2e437df0826769f9 (diff) |
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.
Diffstat (limited to 'src/tls/tls_ciphersuite.h')
-rw-r--r-- | src/tls/tls_ciphersuite.h | 10 |
1 files changed, 9 insertions, 1 deletions
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 <botan/types.h> #include <string> +#include <vector> namespace Botan { @@ -28,11 +29,15 @@ class BOTAN_DLL Ciphersuite static Ciphersuite by_name(const std::string& name); + static const std::vector<Ciphersuite>& 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; }; |