aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tls/tls_suites.cpp171
1 files changed, 88 insertions, 83 deletions
diff --git a/src/tls/tls_suites.cpp b/src/tls/tls_suites.cpp
index 46bc4d501..9a541d124 100644
--- a/src/tls/tls_suites.cpp
+++ b/src/tls/tls_suites.cpp
@@ -16,128 +16,133 @@ namespace Botan {
TLS_Ciphersuite TLS_Ciphersuite::lookup_ciphersuite(u16bit suite)
{
// RSA ciphersuites
- if(suite == TLS_RSA_WITH_RC4_128_MD5)
- return TLS_Ciphersuite("RSA", "", "MD5", "ARC4", 16);
- if(suite == TLS_RSA_WITH_RC4_128_SHA)
- return TLS_Ciphersuite("RSA", "", "SHA1", "ARC4", 16);
+ switch(suite)
+ {
+ case TLS_RSA_WITH_RC4_128_MD5:
+ return TLS_Ciphersuite("RSA", "", "MD5", "ARC4", 16);
- if(suite == TLS_RSA_WITH_3DES_EDE_CBC_SHA)
- return TLS_Ciphersuite("RSA", "", "SHA1", "TripleDES", 24);
+ case TLS_RSA_WITH_RC4_128_SHA:
+ return TLS_Ciphersuite("RSA", "", "SHA1", "ARC4", 16);
- if(suite == TLS_RSA_WITH_AES_128_CBC_SHA)
- return TLS_Ciphersuite("RSA", "", "SHA1", "AES-128", 16);
+ case TLS_RSA_WITH_3DES_EDE_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "", "SHA1", "TripleDES", 24);
- if(suite == TLS_RSA_WITH_AES_256_CBC_SHA)
- return TLS_Ciphersuite("RSA", "", "SHA1", "AES-256", 32);
+ case TLS_RSA_WITH_AES_128_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "", "SHA1", "AES-128", 16);
- if(suite == TLS_RSA_WITH_SEED_CBC_SHA)
- return TLS_Ciphersuite("RSA", "", "SHA1", "SEED", 16);
+ case TLS_RSA_WITH_AES_256_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "", "SHA1", "AES-256", 32);
- if(suite == TLS_RSA_WITH_AES_128_CBC_SHA256)
- return TLS_Ciphersuite("RSA", "", "SHA-256", "AES-128", 16);
+ case TLS_RSA_WITH_SEED_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "", "SHA1", "SEED", 16);
- if(suite == TLS_RSA_WITH_AES_256_CBC_SHA256)
- return TLS_Ciphersuite("RSA", "", "SHA-256", "AES-256", 32);
+ case TLS_RSA_WITH_AES_128_CBC_SHA256:
+ return TLS_Ciphersuite("RSA", "", "SHA-256", "AES-128", 16);
- // DHE/DSS ciphersuites
- if(suite == TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA)
- return TLS_Ciphersuite("DSA", "DH", "SHA1", "TripleDES", 24);
+ case TLS_RSA_WITH_AES_256_CBC_SHA256:
+ return TLS_Ciphersuite("RSA", "", "SHA-256", "AES-256", 32);
- if(suite == TLS_DHE_DSS_WITH_AES_128_CBC_SHA)
- return TLS_Ciphersuite("DSA", "DH", "SHA1", "AES-128", 16);
+ // DHE/DSS ciphersuites
+ case TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA:
+ return TLS_Ciphersuite("DSA", "DH", "SHA1", "TripleDES", 24);
- if(suite == TLS_DHE_DSS_WITH_SEED_CBC_SHA)
- return TLS_Ciphersuite("DSA", "DH", "SHA1", "SEED", 16);
+ case TLS_DHE_DSS_WITH_AES_128_CBC_SHA:
+ return TLS_Ciphersuite("DSA", "DH", "SHA1", "AES-128", 16);
- if(suite == TLS_DHE_DSS_WITH_RC4_128_SHA)
- return TLS_Ciphersuite("DSA", "DH", "SHA1", "ARC4", 16);
+ case TLS_DHE_DSS_WITH_SEED_CBC_SHA:
+ return TLS_Ciphersuite("DSA", "DH", "SHA1", "SEED", 16);
- if(suite == TLS_DHE_DSS_WITH_AES_256_CBC_SHA)
- return TLS_Ciphersuite("DSA", "DH", "SHA1", "AES-256", 32);
+ case TLS_DHE_DSS_WITH_RC4_128_SHA:
+ return TLS_Ciphersuite("DSA", "DH", "SHA1", "ARC4", 16);
- if(suite == TLS_DHE_DSS_WITH_AES_128_CBC_SHA256)
- return TLS_Ciphersuite("DSA", "DH", "SHA-256", "AES-128", 16);
+ case TLS_DHE_DSS_WITH_AES_256_CBC_SHA:
+ return TLS_Ciphersuite("DSA", "DH", "SHA1", "AES-256", 32);
- if(suite == TLS_DHE_DSS_WITH_AES_256_CBC_SHA256)
- return TLS_Ciphersuite("DSA", "DH", "SHA-256", "AES-256", 32);
+ case TLS_DHE_DSS_WITH_AES_128_CBC_SHA256:
+ return TLS_Ciphersuite("DSA", "DH", "SHA-256", "AES-128", 16);
- // DHE/RSA ciphersuites
- if(suite == TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA)
- return TLS_Ciphersuite("RSA", "DH", "SHA1", "TripleDES", 24);
+ case TLS_DHE_DSS_WITH_AES_256_CBC_SHA256:
+ return TLS_Ciphersuite("DSA", "DH", "SHA-256", "AES-256", 32);
- if(suite == TLS_DHE_RSA_WITH_AES_128_CBC_SHA)
- return TLS_Ciphersuite("RSA", "DH", "SHA1", "AES-128", 16);
+ // DHE/RSA ciphersuites
+ case TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "DH", "SHA1", "TripleDES", 24);
- if(suite == TLS_DHE_DSS_WITH_SEED_CBC_SHA)
- return TLS_Ciphersuite("RSA", "DH", "SHA1", "SEED", 16);
+ case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "DH", "SHA1", "AES-128", 16);
- if(suite == TLS_DHE_RSA_WITH_AES_256_CBC_SHA)
- return TLS_Ciphersuite("RSA", "DH", "SHA1", "AES-256", 32);
+ case TLS_DHE_RSA_WITH_SEED_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "DH", "SHA1", "SEED", 16);
- if(suite == TLS_DHE_RSA_WITH_AES_128_CBC_SHA256)
- return TLS_Ciphersuite("RSA", "DH", "SHA-256", "AES-128", 16);
+ case TLS_DHE_RSA_WITH_AES_256_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "DH", "SHA1", "AES-256", 32);
- if(suite == TLS_DHE_RSA_WITH_AES_256_CBC_SHA256)
- return TLS_Ciphersuite("RSA", "DH", "SHA-256", "AES-256", 32);
+ case TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:
+ return TLS_Ciphersuite("RSA", "DH", "SHA-256", "AES-128", 16);
- // SRP ciphersuites
- if(suite == TLS_SRP_SHA_RSA_WITH_3DES_EDE_SHA)
- return TLS_Ciphersuite("RSA", "SRP", "SHA1", "TripleDES", 24);
+ case TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:
+ return TLS_Ciphersuite("RSA", "DH", "SHA-256", "AES-256", 32);
- if(suite == TLS_SRP_SHA_DSS_WITH_3DES_EDE_SHA)
- return TLS_Ciphersuite("DSA", "SRP", "SHA1", "TripleDES", 24);
+ // SRP ciphersuites
+ case TLS_SRP_SHA_RSA_WITH_3DES_EDE_SHA:
+ return TLS_Ciphersuite("RSA", "SRP", "SHA1", "TripleDES", 24);
- if(suite == TLS_SRP_SHA_RSA_WITH_AES_128_SHA)
- return TLS_Ciphersuite("RSA", "SRP", "SHA1", "AES-128", 16);
+ case TLS_SRP_SHA_DSS_WITH_3DES_EDE_SHA:
+ return TLS_Ciphersuite("DSA", "SRP", "SHA1", "TripleDES", 24);
- if(suite == TLS_SRP_SHA_DSS_WITH_AES_128_SHA)
- return TLS_Ciphersuite("DSA", "SRP", "SHA1", "AES-128", 16);
+ case TLS_SRP_SHA_RSA_WITH_AES_128_SHA:
+ return TLS_Ciphersuite("RSA", "SRP", "SHA1", "AES-128", 16);
- if(suite == TLS_SRP_SHA_RSA_WITH_AES_256_SHA)
- return TLS_Ciphersuite("RSA", "SRP", "SHA1", "AES-256", 32);
+ case TLS_SRP_SHA_DSS_WITH_AES_128_SHA:
+ return TLS_Ciphersuite("DSA", "SRP", "SHA1", "AES-128", 16);
- if(suite == TLS_SRP_SHA_DSS_WITH_AES_256_SHA)
- return TLS_Ciphersuite("DSA", "SRP", "SHA1", "AES-256", 32);
+ case TLS_SRP_SHA_RSA_WITH_AES_256_SHA:
+ return TLS_Ciphersuite("RSA", "SRP", "SHA1", "AES-256", 32);
- // ECC ciphersuites
- if(suite == TLS_ECDHE_ECDSA_WITH_RC4_128_SHA)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "ARC4", 16);
+ case TLS_SRP_SHA_DSS_WITH_AES_256_SHA:
+ return TLS_Ciphersuite("DSA", "SRP", "SHA1", "AES-256", 32);
- if(suite == TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "TripleDES", 24);
+ // ECC ciphersuites
+ case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "ARC4", 16);
- if(suite == TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "AES-128", 16);
+ case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "TripleDES", 24);
- if(suite == TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "AES-256", 32);
+ case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "AES-128", 16);
- if(suite == TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16);
+ case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA1", "AES-256", 32);
- if(suite == TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA384", "AES-256", 32);
+ case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16);
- if(suite == TLS_ECDHE_RSA_WITH_RC4_128_SHA)
- return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "ARC4", 16);
+ case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-384", "AES-256", 32);
- if(suite == TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA)
- return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "TripleDES", 24);
+ case TLS_ECDHE_RSA_WITH_RC4_128_SHA:
+ return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "ARC4", 16);
- if(suite == TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA)
- return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "AES-128", 16);
+ case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "TripleDES", 24);
- if(suite == TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA)
- return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "AES-256", 32);
+ case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "AES-128", 16);
- if(suite == TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16);
+ case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:
+ return TLS_Ciphersuite("RSA", "ECDH", "SHA1", "AES-256", 32);
- if(suite == TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384)
- return TLS_Ciphersuite("ECDSA", "ECDH", "SHA384", "AES-256", 32);
+ case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16);
- return TLS_Ciphersuite(); // some unknown ciphersuite
+ case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384:
+ return TLS_Ciphersuite("ECDSA", "ECDH", "SHA-384", "AES-256", 32);
+
+ default:
+ return TLS_Ciphersuite(); // some unknown ciphersuite
+ }
}
TLS_Ciphersuite::TLS_Ciphersuite(const std::string& sig_algo,