aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_ciphersuite.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-28 07:09:26 +0000
committerlloyd <[email protected]>2012-01-28 07:09:26 +0000
commitee7f6c030776c17a47e9d4f12e59aad86366e0da (patch)
treea1a613ca624268f709b4e10ce474b2b4fc7e604f /src/tls/tls_ciphersuite.cpp
parentada0998533c7b6b8eb782c494f8efdf5b6f7f712 (diff)
Add Camellia ciphersuites from RFC 4132.
Fix Ciphersuite_Preference_Ordering which treated two ciphersuites with the same algos but different keylengths as equivalent, causing them to be lost. Always prefer the longer key.
Diffstat (limited to 'src/tls/tls_ciphersuite.cpp')
-rw-r--r--src/tls/tls_ciphersuite.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/tls/tls_ciphersuite.cpp b/src/tls/tls_ciphersuite.cpp
index 26b52f749..01c35a55a 100644
--- a/src/tls/tls_ciphersuite.cpp
+++ b/src/tls/tls_ciphersuite.cpp
@@ -45,6 +45,12 @@ Ciphersuite Ciphersuite::lookup_ciphersuite(u16bit suite)
case TLS_RSA_WITH_RC4_128_MD5:
return Ciphersuite("RSA", "RSA", "MD5", "ARC4", 16);
+ case TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:
+ return Ciphersuite("RSA", "RSA", "SHA-1", "Camellia", 16);
+
+ case TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:
+ return Ciphersuite("RSA", "RSA", "SHA-1", "Camellia", 32);
+
case TLS_RSA_WITH_SEED_CBC_SHA:
return Ciphersuite("RSA", "RSA", "SHA-1", "SEED", 16);
@@ -73,6 +79,12 @@ Ciphersuite Ciphersuite::lookup_ciphersuite(u16bit suite)
case TLS_DHE_DSS_WITH_RC4_128_SHA:
return Ciphersuite("DSA", "DH", "SHA-1", "ARC4", 16);
+ case TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA:
+ return Ciphersuite("DSA", "DH", "SHA-1", "Camellia", 16);
+
+ case TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA:
+ return Ciphersuite("DSA", "DH", "SHA-1", "Camellia", 32);
+
case TLS_DHE_DSS_WITH_SEED_CBC_SHA:
return Ciphersuite("DSA", "DH", "SHA-1", "SEED", 16);
@@ -93,6 +105,12 @@ Ciphersuite Ciphersuite::lookup_ciphersuite(u16bit suite)
case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:
return Ciphersuite("RSA", "DH", "SHA-1", "3DES", 24);
+ case TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:
+ return Ciphersuite("RSA", "DH", "SHA-1", "Camellia", 16);
+
+ case TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:
+ return Ciphersuite("RSA", "DH", "SHA-1", "Camellia", 32);
+
case TLS_DHE_RSA_WITH_SEED_CBC_SHA:
return Ciphersuite("RSA", "DH", "SHA-1", "SEED", 16);
@@ -275,6 +293,8 @@ std::string Ciphersuite::to_string() const
{
if(cipher_algo() == "3DES")
out << "3DES_EDE";
+ if(cipher_algo() == "Camellia")
+ out << "CAMELLIA_" << Botan::to_string(8*cipher_keylen());
else
out << replace_char(cipher_algo(), '-', '_');
@@ -294,10 +314,10 @@ std::string Ciphersuite::to_string() const
}
Ciphersuite::Ciphersuite(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) :
+ const std::string& kex_algo,
+ const std::string& mac_algo,
+ const std::string& cipher_algo,
+ size_t cipher_algo_keylen) :
m_sig_algo(sig_algo),
m_kex_algo(kex_algo),
m_mac_algo(mac_algo),