diff options
author | Jack Lloyd <[email protected]> | 2016-01-17 09:53:03 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-17 09:53:03 -0500 |
commit | c04be379f9e607881b5c60c900382c9dd2b9f160 (patch) | |
tree | 5a5f99235376803a7582f2a0ba921fa0dfafc59d /src/lib | |
parent | 5305d7f5da142ecf5e9a88e9680a02622e006cb1 (diff) |
Avoid set<Ciphersuite>
Works around a libstdc++ bug when fuzzing with libFuzzer
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/tls/tls_policy.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/tls/tls_policy.cpp b/src/lib/tls/tls_policy.cpp index 374c5f12b..28ef2f1eb 100644 --- a/src/lib/tls/tls_policy.cpp +++ b/src/lib/tls/tls_policy.cpp @@ -1,6 +1,6 @@ /* * Policies for TLS -* (C) 2004-2010,2012,2015 Jack Lloyd +* (C) 2004-2010,2012,2015,2016 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -270,9 +270,7 @@ std::vector<u16bit> Policy::ciphersuite_list(Protocol_Version version, const std::vector<std::string> kex = allowed_key_exchange_methods(); const std::vector<std::string> sigs = allowed_signature_methods(); - Ciphersuite_Preference_Ordering order(ciphers, macs, kex, sigs); - - std::set<Ciphersuite, Ciphersuite_Preference_Ordering> ciphersuites(order); + std::vector<Ciphersuite> ciphersuites; for(auto&& suite : Ciphersuite::all_known_ciphersuites()) { @@ -301,13 +299,16 @@ std::vector<u16bit> Policy::ciphersuite_list(Protocol_Version version, continue; } - // OK, allow it: - ciphersuites.insert(suite); + // OK, consider it + ciphersuites.push_back(suite); } if(ciphersuites.empty()) throw Exception("Policy does not allow any available cipher suite"); + Ciphersuite_Preference_Ordering order(ciphers, macs, kex, sigs); + std::sort(ciphersuites.begin(), ciphersuites.end(), order); + std::vector<u16bit> ciphersuite_codes; for(auto i : ciphersuites) ciphersuite_codes.push_back(i.ciphersuite_code()); |