diff options
author | lloyd <[email protected]> | 2012-01-24 16:55:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-01-24 16:55:31 +0000 |
commit | da0713fe1ea6ff2c6aba611b4574696e3c957b22 (patch) | |
tree | 7aabbf7969925a81938b787128b23fb658b7b875 /src | |
parent | e4eb73dca7d7a74ecf8ef792d65640c4e44e2ab1 (diff) |
Fix ECC curve negotiation on the server side.
Avoid accidentally negotiating SRP.
Fix TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 which was marked as an ECDSA
suite. Tested to work with OpenSSL 1.0.1 beta.
Remove SHA-384 suites for now so we won't negotiate them as the right
hooks for the PRF do not exist yet.
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/tls_policy.cpp | 11 | ||||
-rw-r--r-- | src/tls/tls_suites.cpp | 58 |
2 files changed, 34 insertions, 35 deletions
diff --git a/src/tls/tls_policy.cpp b/src/tls/tls_policy.cpp index 02263ffa2..f31558b95 100644 --- a/src/tls/tls_policy.cpp +++ b/src/tls/tls_policy.cpp @@ -200,7 +200,7 @@ std::vector<byte> Policy::compression() const */ std::string Policy::choose_curve(const std::vector<std::string>& curve_names) const { - std::vector<std::string> our_curves; + std::vector<std::string> our_curves = allowed_ecc_curves(); for(size_t i = 0; i != our_curves.size(); ++i) if(value_exists(curve_names, our_curves[i])) @@ -231,8 +231,13 @@ u16bit Policy::choose_suite(const std::vector<u16bit>& client_suites, continue; } - if(suite.kex_algo() == "SRP" && have_srp) - return suite_id; + if(suite.kex_algo() == "SRP") + { + if(have_srp) + return suite_id; + else + continue; + } if(value_exists(available_cert_types, suite.sig_algo())) return suite_id; diff --git a/src/tls/tls_suites.cpp b/src/tls/tls_suites.cpp index 07c8a1a9e..52fbbe453 100644 --- a/src/tls/tls_suites.cpp +++ b/src/tls/tls_suites.cpp @@ -97,34 +97,15 @@ Ciphersuite Ciphersuite::lookup_ciphersuite(u16bit suite) case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: return Ciphersuite("RSA", "ECDH", "SHA-1", "AES-256", 32); + case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: + return Ciphersuite("RSA", "ECDH", "SHA-256", "AES-128", 16); + case TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: return Ciphersuite("RSA", "ECDH", "SHA-1", "3DES", 24); case TLS_ECDHE_RSA_WITH_RC4_128_SHA: return Ciphersuite("RSA", "ECDH", "SHA-1", "ARC4", 16); - // SRP/RSA ciphersuites - - case TLS_SRP_SHA_RSA_WITH_AES_128_SHA: - return Ciphersuite("RSA", "SRP/SHA-1", "SHA-1", "AES-128", 16); - - case TLS_SRP_SHA_RSA_WITH_AES_256_SHA: - return Ciphersuite("RSA", "SRP/SHA-1", "SHA-1", "AES-256", 32); - - case TLS_SRP_SHA_RSA_WITH_3DES_EDE_SHA: - return Ciphersuite("RSA", "SRP/SHA-1", "SHA-1", "3DES", 24); - - // SRP/DSA ciphersuites - - case TLS_SRP_SHA_DSS_WITH_AES_128_SHA: - return Ciphersuite("DSA", "SRP/SHA-1", "SHA-1", "AES-128", 16); - - case TLS_SRP_SHA_DSS_WITH_AES_256_SHA: - return Ciphersuite("DSA", "SRP/SHA-1", "SHA-1", "AES-256", 32); - - case TLS_SRP_SHA_DSS_WITH_3DES_EDE_SHA: - return Ciphersuite("DSA", "SRP/SHA-1", "SHA-1", "3DES", 24); - // ECDH/ECDSA ciphersuites case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: @@ -136,21 +117,34 @@ Ciphersuite Ciphersuite::lookup_ciphersuite(u16bit suite) case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: return Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16); - case TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384: - return Ciphersuite("ECDSA", "ECDH", "SHA-384", "AES-256", 32); - - case TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: - return Ciphersuite("ECDSA", "ECDH", "SHA-256", "AES-128", 16); - - case TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384: - return Ciphersuite("ECDSA", "ECDH", "SHA-384", "AES-256", 32); - case TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: return Ciphersuite("ECDSA", "ECDH", "SHA-1", "ARC4", 16); case TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA: return Ciphersuite("ECDSA", "ECDH", "SHA-1", "3DES", 24); + // SRP/RSA ciphersuites + + case TLS_SRP_SHA_RSA_WITH_AES_128_SHA: + return Ciphersuite("RSA", "SRP", "SHA-1", "AES-128", 16); + + case TLS_SRP_SHA_RSA_WITH_AES_256_SHA: + return Ciphersuite("RSA", "SRP", "SHA-1", "AES-256", 32); + + case TLS_SRP_SHA_RSA_WITH_3DES_EDE_SHA: + return Ciphersuite("RSA", "SRP", "SHA-1", "3DES", 24); + + // SRP/DSA ciphersuites + + case TLS_SRP_SHA_DSS_WITH_AES_128_SHA: + return Ciphersuite("DSA", "SRP", "SHA-1", "AES-128", 16); + + case TLS_SRP_SHA_DSS_WITH_AES_256_SHA: + return Ciphersuite("DSA", "SRP", "SHA-1", "AES-256", 32); + + case TLS_SRP_SHA_DSS_WITH_3DES_EDE_SHA: + return Ciphersuite("DSA", "SRP", "SHA-1", "3DES", 24); + default: return Ciphersuite(); // some unknown ciphersuite } @@ -169,7 +163,7 @@ std::string Ciphersuite::to_string() const out << "DHE"; else if(kex_algo() == "ECDH") out << "ECDHE"; - else if(kex_algo() == "SRP/SHA-1") + else if(kex_algo() == "SRP") out << "SRP_SHA"; else if(kex_algo() != "") out << kex_algo(); |