From 3f9d452f604956e92a78f13e068530235519f84e Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 10 Apr 2013 22:20:07 +0000 Subject: Make the IV length and MAC keylength explicit in the ciphersuite Add support for alternate PRFs --- src/tls/tls_ciphersuite.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/tls/tls_ciphersuite.cpp') diff --git a/src/tls/tls_ciphersuite.cpp b/src/tls/tls_ciphersuite.cpp index 3a1a9fefd..1cc8a8f2f 100644 --- a/src/tls/tls_ciphersuite.cpp +++ b/src/tls/tls_ciphersuite.cpp @@ -104,22 +104,23 @@ std::string Ciphersuite::to_string() const { if(cipher_algo() == "3DES") out << "3DES_EDE"; - else if(cipher_algo() == "Camellia-128" || cipher_algo() == "Camellia-256") + else if(cipher_algo().find("Camellia") == 0) out << "CAMELLIA_" << std::to_string(8*cipher_keylen()); else - out << replace_char(cipher_algo(), '-', '_'); + out << replace_chars(cipher_algo(), {'-', '/'}, '_'); - out << "_CBC_"; + if(cipher_algo().find("/GCM") != std::string::npos) + out << "_"; + else + out << "_CBC_"; } if(mac_algo() == "SHA-1") out << "SHA"; - else if(mac_algo() == "SHA-256") - out << "SHA256"; - else if(mac_algo() == "SHA-384") - out << "SHA384"; + else if(mac_algo() == "AEAD") + out << erase_chars(prf_algo(), {'-'}); else - out << mac_algo(); + out << erase_chars(mac_algo(), {'-'}); return out.str(); } -- cgit v1.2.3