diff options
Diffstat (limited to 'src/lib/tls/tls_ciphersuite.cpp')
-rw-r--r-- | src/lib/tls/tls_ciphersuite.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/tls/tls_ciphersuite.cpp b/src/lib/tls/tls_ciphersuite.cpp index b8a7e70d7..88837387e 100644 --- a/src/lib/tls/tls_ciphersuite.cpp +++ b/src/lib/tls/tls_ciphersuite.cpp @@ -57,6 +57,18 @@ bool Ciphersuite::ecc_ciphersuite() const auth_method() == Auth_Method::ECDSA; } +bool Ciphersuite::usable_in_version(Protocol_Version version) const + { + if(!version.supports_aead_modes()) + { + // Old versions do not support AEAD, or any MAC but SHA-1 + if(mac_algo() != "SHA-1") + return false; + } + + return true; + } + bool Ciphersuite::cbc_ciphersuite() const { return (mac_algo() != "AEAD"); @@ -81,6 +93,19 @@ Ciphersuite Ciphersuite::by_id(uint16_t suite) return Ciphersuite(); // some unknown ciphersuite } +Ciphersuite Ciphersuite::from_name(const std::string& name) + { + const std::vector<Ciphersuite>& all_suites = all_known_ciphersuites(); + + for(auto suite : all_suites) + { + if(suite.to_string() == name) + return suite; + } + + return Ciphersuite(); // some unknown ciphersuite + } + namespace { bool have_hash(const std::string& prf) |