aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_ciphersuite.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-19 17:25:01 +0000
committerlloyd <[email protected]>2013-04-19 17:25:01 +0000
commit01d7c3d72a71a31c137ddfd994e259d678fde838 (patch)
treefa39676b5c90a3a503a8235ce945272fee9f9bf5 /src/tls/tls_ciphersuite.cpp
parent20816422188a92344d712e010a8ac8bac00810a2 (diff)
Change TLS::Ciphersuite constructor to be non-inline and to take
arguments by const char*. Reduces size of tls_suite_info.o by 80% on Linux with GCC 4.8
Diffstat (limited to 'src/tls/tls_ciphersuite.cpp')
-rw-r--r--src/tls/tls_ciphersuite.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tls/tls_ciphersuite.cpp b/src/tls/tls_ciphersuite.cpp
index 9718a5b08..1dde8514e 100644
--- a/src/tls/tls_ciphersuite.cpp
+++ b/src/tls/tls_ciphersuite.cpp
@@ -56,6 +56,27 @@ Ciphersuite Ciphersuite::by_name(const std::string& name)
return Ciphersuite(); // some unknown ciphersuite
}
+Ciphersuite::Ciphersuite(u16bit ciphersuite_code,
+ const char* sig_algo,
+ const char* kex_algo,
+ const char* cipher_algo,
+ size_t cipher_keylen,
+ size_t cipher_ivlen,
+ const char* mac_algo,
+ size_t mac_keylen,
+ const char* prf_algo) :
+ m_ciphersuite_code(ciphersuite_code),
+ m_sig_algo(sig_algo),
+ m_kex_algo(kex_algo),
+ m_cipher_algo(cipher_algo),
+ m_mac_algo(mac_algo),
+ m_prf_algo(prf_algo),
+ m_cipher_keylen(cipher_keylen),
+ m_cipher_ivlen(cipher_ivlen),
+ m_mac_keylen(mac_keylen)
+ {
+ }
+
bool Ciphersuite::psk_ciphersuite() const
{
return (kex_algo() == "PSK" ||
@@ -68,6 +89,16 @@ bool Ciphersuite::ecc_ciphersuite() const
return (kex_algo() == "ECDH" || sig_algo() == "ECDSA");
}
+bool Ciphersuite::valid() const
+ {
+ if(!m_cipher_keylen)
+ return false;
+
+ // fixme: check that all sub-algorithms are enabled
+
+ return true;
+ }
+
std::string Ciphersuite::to_string() const
{
if(m_cipher_keylen == 0)