aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/tls_ciphersuite.cpp4
-rw-r--r--src/lib/tls/tls_handshake_hash.cpp14
2 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/tls/tls_ciphersuite.cpp b/src/lib/tls/tls_ciphersuite.cpp
index 3c29c3c2b..a15f936be 100644
--- a/src/lib/tls/tls_ciphersuite.cpp
+++ b/src/lib/tls/tls_ciphersuite.cpp
@@ -37,9 +37,7 @@ bool Ciphersuite::ecc_ciphersuite() const
bool Ciphersuite::cbc_ciphersuite() const
{
- return (cipher_algo() == "3DES" || cipher_algo() == "SEED" ||
- cipher_algo() == "AES-128" || cipher_algo() == "AES-256" ||
- cipher_algo() == "Camellia-128" || cipher_algo() == "Camellia-256");
+ return (mac_algo() != "AEAD");
}
Ciphersuite Ciphersuite::by_id(u16bit suite)
diff --git a/src/lib/tls/tls_handshake_hash.cpp b/src/lib/tls/tls_handshake_hash.cpp
index 540f1de14..7bac87bc8 100644
--- a/src/lib/tls/tls_handshake_hash.cpp
+++ b/src/lib/tls/tls_handshake_hash.cpp
@@ -19,16 +19,12 @@ namespace TLS {
secure_vector<byte> Handshake_Hash::final(Protocol_Version version,
const std::string& mac_algo) const
{
- auto choose_hash = [=]() {
- if(!version.supports_ciphersuite_specific_prf())
- return "Parallel(MD5,SHA-160)";
+ std::string hash_algo = mac_algo;
+ if(!version.supports_ciphersuite_specific_prf())
+ hash_algo = "Parallel(MD5,SHA-160)";
+ else if(mac_algo == "MD5" || mac_algo == "SHA-1")
+ hash_algo = "SHA-256";
- if(mac_algo == "MD5" || mac_algo == "SHA-1")
- return "SHA-256";
- return mac_algo.c_str();
- };
-
- const std::string hash_algo = choose_hash();
std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
hash->update(m_data);
return hash->final();